th: revert throttles

This commit is contained in:
Kouhai 2024-01-13 14:17:40 -08:00
parent d1559d4dee
commit 569931db6f

View file

@ -66,7 +66,6 @@ class Rack::Attack
IpBlock.blocked?(req.remote_ip)
end
if !!ENV['TH_DEACTIVATE_AUTHED_THROTTLES']
throttle('throttle_authenticated_api', limit: 1_500, period: 5.minutes) do |req|
req.authenticated_user_id if req.api_request?
end
@ -74,13 +73,10 @@ class Rack::Attack
throttle('throttle_per_token_api', limit: 300, period: 5.minutes) do |req|
req.authenticated_token_id if req.api_request?
end
end
if !!ENV['TH_DEACTIVATE_UNAUTHED_API_THROTTLES']
throttle('throttle_unauthenticated_api', limit: 300, period: 5.minutes) do |req|
req.throttleable_remote_ip if req.api_request? && req.unauthenticated?
end
end
throttle('throttle_api_media', limit: 30, period: 30.minutes) do |req|
req.authenticated_user_id if req.post? && req.path.match?(%r{\A/api/v\d+/media\z}i)
@ -94,11 +90,9 @@ class Rack::Attack
req.throttleable_remote_ip if req.post? && req.path == '/api/v1/accounts'
end
if !!ENV['TH_DEACTIVATE_AUTHED_THROTTLES']
throttle('throttle_authenticated_paging', limit: 300, period: 15.minutes) do |req|
req.authenticated_user_id if req.paging_request?
end
end
throttle('throttle_unauthenticated_paging', limit: 300, period: 15.minutes) do |req|
req.throttleable_remote_ip if req.paging_request? && req.unauthenticated?