Merge branch 'master' of https://github.com/FarmBot/Farmbot-Web-App into staging
commit
4edfa20b60
|
@ -94,7 +94,8 @@ class DashboardController < ApplicationController
|
|||
rescue
|
||||
report = { problem: "Crashed while parsing report" }
|
||||
end
|
||||
Rollbar.info("CSP Violation", report)
|
||||
# We get too many CSP reports.
|
||||
# Rollbar.info("CSP Violation", report)
|
||||
|
||||
render json: report
|
||||
end
|
||||
|
|
|
@ -7,10 +7,12 @@ class LogService < AbstractServiceRunner
|
|||
T.new(1.hour) => 0.5 * 10_000,
|
||||
T.new(1.day) => 0.5 * 100_000
|
||||
|
||||
LOG_TPL = "FBOS LOG (device_%s): %s"
|
||||
|
||||
def process(delivery_info, payload)
|
||||
params = { routing_key: delivery_info.routing_key, payload: payload }
|
||||
m = AmqpLogParser.run!(params)
|
||||
puts "#{m.device_id}: #{m.payload["message"]}" if Rails.env.production?
|
||||
puts LOG_TPL % [m.device_id, m.payload["message"]] if Rails.env.production?
|
||||
THROTTLE_POLICY.track(m.device_id)
|
||||
maybe_deliver(m)
|
||||
end
|
||||
|
|
|
@ -20,14 +20,15 @@ describe DashboardController do
|
|||
end
|
||||
|
||||
it "receives CSP violation reports (malformed JSON)" do
|
||||
expect(Rollbar).to receive(:info)
|
||||
.with("CSP Violation", { problem: "Crashed while parsing report" })
|
||||
# expect(Rollbar).to receive(:info)
|
||||
# .with("CSP Violation", { problem: "Crashed while parsing report" })
|
||||
post :csp_reports, body: "NOT JSON ! ! !"
|
||||
expect(json).to eq(problem: "Crashed while parsing report")
|
||||
end
|
||||
|
||||
it "receives CSP violation reports (malformed JSON)" do
|
||||
expect(Rollbar).to receive(:info).with("CSP Violation", {})
|
||||
post :csp_reports, body: {}.to_json, params: { format: :json }
|
||||
expect(json).to eq({})
|
||||
end
|
||||
|
||||
it "creates a new user" do
|
||||
|
|
Loading…
Reference in New Issue