|
|
|
@ -66,12 +66,14 @@ class Rack::Attack
|
|
|
|
|
IpBlock.blocked?(req.remote_ip)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
throttle('throttle_authenticated_api', limit: 1_500, period: 5.minutes) do |req|
|
|
|
|
|
req.authenticated_user_id if req.api_request?
|
|
|
|
|
end
|
|
|
|
|
if !!ENV['TH_DEACTIVATE_AUTHED_API_THROTTLES']
|
|
|
|
|
throttle('throttle_authenticated_api', limit: 1_500, period: 5.minutes) do |req|
|
|
|
|
|
req.authenticated_user_id if req.api_request?
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
throttle('throttle_per_token_api', limit: 300, period: 5.minutes) do |req|
|
|
|
|
|
req.authenticated_token_id if req.api_request?
|
|
|
|
|
throttle('throttle_per_token_api', limit: 300, period: 5.minutes) do |req|
|
|
|
|
|
req.authenticated_token_id if req.api_request?
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
throttle('throttle_unauthenticated_api', limit: 300, period: 5.minutes) do |req|
|
|
|
|
|