diff options
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | lib/pleroma/config_db.ex | 2 | ||||
| -rw-r--r-- | test/pleroma/web/admin_api/controllers/config_controller_test.exs | 34 | 
3 files changed, 36 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 1553245e5..6e13b3875 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).  - Try to save exported ConfigDB settings (migrate_from_db) in the system temp directory if default location is not writable.  - Uploading custom instance thumbnail via AdminAPI/AdminFE generated invalid URL to the image +- Applying ConcurrentLimiter settings via AdminAPI  ## [2.3.0] - 2020-03-01 diff --git a/lib/pleroma/config_db.ex b/lib/pleroma/config_db.ex index b874e0e37..cb57673e3 100644 --- a/lib/pleroma/config_db.ex +++ b/lib/pleroma/config_db.ex @@ -387,6 +387,6 @@ defmodule Pleroma.ConfigDB do    @spec module_name?(String.t()) :: boolean()    def module_name?(string) do      Regex.match?(~r/^(Pleroma|Phoenix|Tesla|Quack|Ueberauth|Swoosh)\./, string) or -      string in ["Oban", "Ueberauth", "ExSyslogger"] +      string in ["Oban", "Ueberauth", "ExSyslogger", "ConcurrentLimiter"]    end  end diff --git a/test/pleroma/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs index c4d07d61c..c39c1b1e1 100644 --- a/test/pleroma/web/admin_api/controllers/config_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs @@ -1452,6 +1452,40 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do        assert res = %{"thumbnail" => "https://example.com/media/new_thumbnail.jpg"}      end + +    test "Concurrent Limiter", %{conn: conn} do +      clear_config([ConcurrentLimiter]) + +      params = %{ +        "group" => ":pleroma", +        "key" => "ConcurrentLimiter", +        "value" => [ +          %{ +            "tuple" => [ +              "Pleroma.Web.RichMedia.Helpers", +              [ +                %{"tuple" => [":max_running", 6]}, +                %{"tuple" => [":max_waiting", 6]} +              ] +            ] +          }, +          %{ +            "tuple" => [ +              "Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy", +              [ +                %{"tuple" => [":max_running", 7]}, +                %{"tuple" => [":max_waiting", 7]} +              ] +            ] +          } +        ] +      } + +      assert conn +             |> put_req_header("content-type", "application/json") +             |> post("/api/pleroma/admin/config", %{"configs" => [params]}) +             |> json_response_and_validate_schema(200) +    end    end    describe "GET /api/pleroma/admin/config/descriptions" do  | 
