mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 12:31:42 +00:00
feat: ignorar reportes de bots con device_detector #14334
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
4689d10e8d
commit
74e371eb36
1 changed files with 9 additions and 3 deletions
|
@ -9,10 +9,11 @@ module Api
|
|||
# Generar un stacktrace en segundo plano y enviarlo por correo
|
||||
# solo si la API key es verificable. Del otro lado siempre
|
||||
# respondemos con lo mismo.
|
||||
def create
|
||||
if site&.airbrake_valid? airbrake_token
|
||||
def create
|
||||
if site&.airbrake_valid? airbrake_token && !detected_device.bot?
|
||||
BacktraceJob.perform_later site_id: params[:site_id],
|
||||
params: airbrake_params.to_h
|
||||
params: airbrake_params.to_h
|
||||
end
|
||||
end
|
||||
|
||||
render status: 201, json: { id: 1, url: '' }
|
||||
|
@ -34,6 +35,11 @@ module Api
|
|||
def airbrake_token
|
||||
@airbrake_token ||= params[:key]
|
||||
end
|
||||
|
||||
# @return [DeviceDetector]
|
||||
def detected_device
|
||||
@detected_device ||= DeviceDetector.new(request.headers)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue