Add rate limiting for search endpoints

This commit is contained in:
Egor Kislitsyn 2019-06-11 14:28:39 +07:00
parent 2e5affce61
commit bc8f059367
2 changed files with 4 additions and 0 deletions

View file

@ -503,6 +503,8 @@
config :http_signatures, config :http_signatures,
adapter: Pleroma.Signature adapter: Pleroma.Signature
config :pleroma, :rate_limit, search: [{1000, 10}, {1000, 30}]
# Import environment specific config. This must remain at the bottom # Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above. # of this file so it overrides the configuration defined above.
import_config "#{Mix.env()}.exs" import_config "#{Mix.env()}.exs"

View file

@ -55,6 +55,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
when action in [:account_register] when action in [:account_register]
) )
plug(Pleroma.Plugs.RateLimiter, :search when action in [:search, :search2, :account_search])
@local_mastodon_name "Mastodon-Local" @local_mastodon_name "Mastodon-Local"
action_fallback(:errors) action_fallback(:errors)