th: revert throttles

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

View file

@ -66,20 +66,16 @@ 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
throttle('throttle_per_token_api', limit: 300, period: 5.minutes) do |req|
req.authenticated_token_id if req.api_request?
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_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
throttle('throttle_per_token_api', limit: 300, period: 5.minutes) do |req|
req.authenticated_token_id if req.api_request?
end
throttle('throttle_unauthenticated_api', limit: 300, period: 5.minutes) do |req|
req.throttleable_remote_ip if req.api_request? && req.unauthenticated?
end
throttle('throttle_api_media', limit: 30, period: 30.minutes) do |req|
@ -94,10 +90,8 @@ 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
throttle('throttle_authenticated_paging', limit: 300, period: 15.minutes) do |req|
req.authenticated_user_id if req.paging_request?
end
throttle('throttle_unauthenticated_paging', limit: 300, period: 15.minutes) do |req|