5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 14:21:41 +00:00

feat: ignorar reportes de bots con device_detector #14334
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
jazzari 2023-09-22 13:51:36 -03:00
parent 4689d10e8d
commit 74e371eb36

View file

@ -10,10 +10,11 @@ module Api
# solo si la API key es verificable. Del otro lado siempre # solo si la API key es verificable. Del otro lado siempre
# respondemos con lo mismo. # respondemos con lo mismo.
def create def create
if site&.airbrake_valid? airbrake_token if site&.airbrake_valid? airbrake_token && !detected_device.bot?
BacktraceJob.perform_later site_id: params[:site_id], BacktraceJob.perform_later site_id: params[:site_id],
params: airbrake_params.to_h params: airbrake_params.to_h
end end
end
render status: 201, json: { id: 1, url: '' } render status: 201, json: { id: 1, url: '' }
end end
@ -34,6 +35,11 @@ module Api
def airbrake_token def airbrake_token
@airbrake_token ||= params[:key] @airbrake_token ||= params[:key]
end end
# @return [DeviceDetector]
def detected_device
@detected_device ||= DeviceDetector.new(request.headers)
end
end end
end end
end end