Prune stale TODOs
parent
24ba9e6c0f
commit
e2431965a4
|
@ -26,16 +26,19 @@ module Api
|
|||
|
||||
private
|
||||
|
||||
# TODO: Come back and fix this. Rails 5 params conflict with
|
||||
# the way we do things right now. We used to just use the params
|
||||
# object (it was a hash), but now it is a proper object.
|
||||
# Rails 5 params are no longer simple hashes. This was for security reasons.
|
||||
# Our API does not do things the "Rails way" (we use Mutations for input
|
||||
# sanitation) so we can ignore this and grab the raw input.
|
||||
def raw_json
|
||||
@raw_json ||= JSON.parse(request.body.read).tap{ |x| symbolize(x) }
|
||||
rescue JSON::ParserError
|
||||
raise OnlyJson
|
||||
end
|
||||
|
||||
# Just a hack to prevent runtime errors when people POST JSON arrays.
|
||||
# PROBLEM: We want to deep_symbolize_keys! on all JSON inputs, but what if
|
||||
# the user POSTs an Array? It will crash because [] does not respond_to
|
||||
# deep_symbolize_keys! This is the workaround. I could probably use a
|
||||
# refinement.
|
||||
def symbolize(x)
|
||||
x.is_a?(Array) ? x.map(&:deep_symbolize_keys!) : x.deep_symbolize_keys!
|
||||
end
|
||||
|
|
|
@ -32,10 +32,8 @@ module Api
|
|||
def maybe_migrate(sequences)
|
||||
end
|
||||
|
||||
# TODO: Come back and fix this. Rails 5 has changed the way it handles
|
||||
# params.
|
||||
def sequence_params
|
||||
@seq_i_guess ||= raw_json[:sequence] || raw_json || {}
|
||||
@sequence_params ||= raw_json[:sequence] || raw_json || {}
|
||||
end
|
||||
|
||||
def sequence
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
class DashboardController < ApplicationController
|
||||
# TODO: Possbile Hack?
|
||||
# Better ways to support HTML5 push state routing in Rails?
|
||||
# I really don't like this controller. But I have not found a better way to
|
||||
# support HTML5 push state routing.
|
||||
# If anyone knows a better way to support push state routing, please let me
|
||||
# know.
|
||||
THE_FRONTEND_APP = File.read("public/app/index.html").html_safe # Cache in memory.
|
||||
ACME_SECRET = ENV["ACME_SECRET"]
|
||||
# TODO: Possbile Hack? find better ways to support HTML5 push state routing
|
||||
# in Rails when the frontend and the backend are decoupled? I really don't
|
||||
# like this controller but have not found a better way to support HTML5 push
|
||||
# state routing. If anyone knows a better way to support push state routing,
|
||||
# please let me know.
|
||||
THE_FRONTEND_APP = File.read("public/app/index.html").html_safe
|
||||
ACME_SECRET = ENV["ACME_SECRET"]
|
||||
|
||||
def index
|
||||
render html: THE_FRONTEND_APP, layout: false
|
||||
end
|
||||
|
||||
# This endpoint gets hit by Certbot / Let's Encrypt when its time to verify
|
||||
# You control a domain name.
|
||||
# Hit by Certbot / Let's Encrypt when its time to verify control of domain.
|
||||
def lets_encrypt
|
||||
render plain: ACME_SECRET
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ class SessionToken < AbstractJwtToken
|
|||
self.new([{
|
||||
sub: user.email,
|
||||
iat: iat,
|
||||
jti: SecureRandom.uuid, # TODO: Add ability to revoke.
|
||||
jti: SecureRandom.uuid, # Used for revokation if need be.
|
||||
iss: iss,
|
||||
exp: exp,
|
||||
mqtt: MQTT,
|
||||
|
|
|
@ -69,8 +69,9 @@ module Sync
|
|||
@logs ||= device.logs.last(Log::PAGE_SIZE)
|
||||
end
|
||||
|
||||
# The UI does not yet support creation of tool bays
|
||||
# This is a temporary stub
|
||||
# PROBLEM: The UI does not offer a means of creating tool bays. You must
|
||||
# have a ToolBay to create a ToolSlot or Tool. Temporary fix: Create a
|
||||
# ToolBay in the background if the user does not have one.
|
||||
# TODO: Remove this when UI level creation of tool bays happens.
|
||||
def maybe_initialize_a_tool_bay
|
||||
unless device.tool_bays.any?
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# NOTE ABOUT THIS FILE
|
||||
|
||||
#=================================================+
|
||||
# PLEASE READ: |
|
||||
#=================================================+
|
||||
|
@ -14,38 +12,5 @@ Rollbar.configure do |config|
|
|||
config.access_token = ENV['ROLLBAR_ACCESS_TOKEN'] || "NO_ROLLBAR_ACCESS"
|
||||
config.enabled = Rails.env.production? ? true : false
|
||||
config.person_method = "current_device"
|
||||
|
||||
# Add exception class names to the exception_level_filters hash to
|
||||
# change the level that exception is reported at. Note that if an exception
|
||||
# has already been reported and logged the level will need to be changed
|
||||
# via the rollbar interface.
|
||||
# Valid levels: 'critical', 'error', 'warning', 'info', 'debug', 'ignore'
|
||||
# 'ignore' will cause the exception to not be reported at all.
|
||||
# config.exception_level_filters.merge!('MyCriticalException' => 'critical')
|
||||
#
|
||||
# You can also specify a callable, which will be called with the exception instance.
|
||||
# config.exception_level_filters.merge!('MyCriticalException' => lambda { |e| 'critical' })
|
||||
|
||||
# Enable asynchronous reporting (uses girl_friday or Threading if girl_friday
|
||||
# is not installed)
|
||||
# config.use_async = true
|
||||
# Supply your own async handler:
|
||||
# config.async_handler = Proc.new { |payload|
|
||||
# Thread.new { Rollbar.process_from_async_handler(payload) }
|
||||
# }
|
||||
|
||||
# Enable asynchronous reporting (using sucker_punch)
|
||||
# config.use_sucker_punch
|
||||
|
||||
# Enable delayed reporting (using Sidekiq)
|
||||
# config.use_sidekiq
|
||||
# You can supply custom Sidekiq options:
|
||||
# config.use_sidekiq 'queue' => 'default'
|
||||
|
||||
# If you run your staging application instance in production environment then
|
||||
# you'll want to override the environment reported by `Rails.env` with an
|
||||
# environment variable like this: `ROLLBAR_ENV=staging`. This is a recommended
|
||||
# setup for Heroku. See:
|
||||
# https://devcenter.heroku.com/articles/deploying-to-a-custom-rails-environment
|
||||
config.environment = $API_URL || ENV['ROLLBAR_ENV'] || Rails.env
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue