1
0
Fork 0
forked from mirrors/akkoma

RateLimiter module name

This commit is contained in:
Alexander Strizhakov 2020-06-24 09:35:00 +03:00
parent 3be8ab5103
commit 4b1863ca4e
No known key found for this signature in database
GPG key ID: 022896A53AEF1381
11 changed files with 17 additions and 17 deletions

View file

@ -17,7 +17,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
alias Pleroma.Maps
alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug
alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.Plugs.RateLimiter
alias Pleroma.Web.Plugs.RateLimiter
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Builder

View file

@ -15,7 +15,7 @@ defmodule Pleroma.Web.MastodonAPI.AuthController do
action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
plug(Pleroma.Plugs.RateLimiter, [name: :password_reset] when action == :password_reset)
plug(Pleroma.Web.Plugs.RateLimiter, [name: :password_reset] when action == :password_reset)
@local_mastodon_name "Mastodon-Local"

View file

@ -7,7 +7,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do
alias Pleroma.Activity
alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.Plugs.RateLimiter
alias Pleroma.Web.Plugs.RateLimiter
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Web

View file

@ -14,7 +14,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do
alias Pleroma.Bookmark
alias Pleroma.Object
alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.Plugs.RateLimiter
alias Pleroma.Web.Plugs.RateLimiter
alias Pleroma.Repo
alias Pleroma.ScheduledActivity
alias Pleroma.User

View file

@ -12,7 +12,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineController do
alias Pleroma.Pagination
alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug
alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.Plugs.RateLimiter
alias Pleroma.Web.Plugs.RateLimiter
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub

View file

@ -6,7 +6,7 @@ defmodule Pleroma.Web.MongooseIM.MongooseIMController do
use Pleroma.Web, :controller
alias Pleroma.Plugs.AuthenticationPlug
alias Pleroma.Plugs.RateLimiter
alias Pleroma.Web.Plugs.RateLimiter
alias Pleroma.Repo
alias Pleroma.User

View file

@ -8,7 +8,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do
alias Pleroma.Helpers.UriHelper
alias Pleroma.Maps
alias Pleroma.MFA
alias Pleroma.Plugs.RateLimiter
alias Pleroma.Web.Plugs.RateLimiter
alias Pleroma.Registration
alias Pleroma.Repo
alias Pleroma.User

View file

@ -7,7 +7,7 @@ defmodule Pleroma.Web.OStatus.OStatusController do
alias Pleroma.Activity
alias Pleroma.Object
alias Pleroma.Plugs.RateLimiter
alias Pleroma.Web.Plugs.RateLimiter
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPubController
alias Pleroma.Web.ActivityPub.Visibility

View file

@ -10,7 +10,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountController do
alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug
alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.Plugs.RateLimiter
alias Pleroma.Web.Plugs.RateLimiter
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.MastodonAPI.StatusView

View file

@ -2,7 +2,7 @@
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Plugs.RateLimiter do
defmodule Pleroma.Web.Plugs.RateLimiter do
@moduledoc """
## Configuration
@ -35,8 +35,8 @@ defmodule Pleroma.Plugs.RateLimiter do
AllowedSyntax:
plug(Pleroma.Plugs.RateLimiter, name: :limiter_name)
plug(Pleroma.Plugs.RateLimiter, options) # :name is a required option
plug(Pleroma.Web.Plugs.RateLimiter, name: :limiter_name)
plug(Pleroma.Web.Plugs.RateLimiter, options) # :name is a required option
Allowed options:
@ -46,11 +46,11 @@ defmodule Pleroma.Plugs.RateLimiter do
Inside a controller:
plug(Pleroma.Plugs.RateLimiter, [name: :one] when action == :one)
plug(Pleroma.Plugs.RateLimiter, [name: :two] when action in [:two, :three])
plug(Pleroma.Web.Plugs.RateLimiter, [name: :one] when action == :one)
plug(Pleroma.Web.Plugs.RateLimiter, [name: :two] when action in [:two, :three])
plug(
Pleroma.Plugs.RateLimiter,
Pleroma.Web.Plugs.RateLimiter,
[name: :status_id_action, bucket_name: "status_id_action:fav_unfav", params: ["id"]]
when action in ~w(fav_status unfav_status)a
)
@ -59,7 +59,7 @@ defmodule Pleroma.Plugs.RateLimiter do
pipeline :api do
...
plug(Pleroma.Plugs.RateLimiter, name: :one)
plug(Pleroma.Web.Plugs.RateLimiter, name: :one)
...
end
"""

View file

@ -7,7 +7,7 @@ defmodule Pleroma.Web.Plugs.RateLimiterTest do
alias Phoenix.ConnTest
alias Pleroma.Config
alias Pleroma.Plugs.RateLimiter
alias Pleroma.Web.Plugs.RateLimiter
alias Plug.Conn
import Pleroma.Factory