mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-07 20:26:15 +00:00
Merge 3434768ab7
into fbe9728f36
This commit is contained in:
commit
3c85c2c3e2
|
@ -82,8 +82,16 @@ class Rack::Attack
|
|||
req.authenticated_user_id if req.post? && req.path.match?(%r{\A/api/v\d+/media\z}i)
|
||||
end
|
||||
|
||||
throttle('throttle_media_proxy', limit: 30, period: 10.minutes) do |req|
|
||||
req.throttleable_remote_ip if req.path.start_with?('/media_proxy')
|
||||
throttle('throttle_media_proxy_authenticated', limit: 200, period: 10.minutes) do |req|
|
||||
if req.path.start_with?('/media_proxy') && (req.authenticated_user_id || req.warden_user_id)
|
||||
req.authenticated_user_id || req.warden_user_id
|
||||
end
|
||||
end
|
||||
|
||||
throttle('throttle_media_proxy_unauthenticated', limit: 30, period: 1.hour) do |req|
|
||||
if req.path.start_with?('/media_proxy') && !req.authenticated_user_id && !req.warden_user_id
|
||||
req.throttleable_remote_ip
|
||||
end
|
||||
end
|
||||
|
||||
throttle('throttle_api_sign_up', limit: 5, period: 30.minutes) do |req|
|
||||
|
|
Loading…
Reference in New Issue
Block a user