From b573711e9c8200ecdd4a722ce1e02b48d3f74cce Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sat, 20 Jun 2020 18:37:44 +0300 Subject: [PATCH 01/62] file locations consistency --- .credo.exs | 6 +- lib/credo/check/consistency/file_location.ex | 132 +++++++++++++++++++ 2 files changed, 134 insertions(+), 4 deletions(-) create mode 100644 lib/credo/check/consistency/file_location.ex diff --git a/.credo.exs b/.credo.exs index 46d45d015..83e34a2b4 100644 --- a/.credo.exs +++ b/.credo.exs @@ -25,7 +25,7 @@ # # If you create your own checks, you must specify the source files for # them here, so they can be loaded by Credo before running the analysis. - requires: [], + requires: ["./lib/credo/check/consistency/file_location.ex"], # # Credo automatically checks for updates, like e.g. Hex does. # You can disable this behaviour below: @@ -71,7 +71,6 @@ # set this value to 0 (zero). {Credo.Check.Design.TagTODO, exit_status: 0}, {Credo.Check.Design.TagFIXME, exit_status: 0}, - {Credo.Check.Readability.FunctionNames}, {Credo.Check.Readability.LargeNumbers}, {Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 100}, @@ -91,7 +90,6 @@ {Credo.Check.Readability.VariableNames}, {Credo.Check.Readability.Semicolons}, {Credo.Check.Readability.SpaceAfterCommas}, - {Credo.Check.Refactor.DoubleBooleanNegation}, {Credo.Check.Refactor.CondStatements}, {Credo.Check.Refactor.CyclomaticComplexity}, @@ -102,7 +100,6 @@ {Credo.Check.Refactor.Nesting}, {Credo.Check.Refactor.PipeChainStart}, {Credo.Check.Refactor.UnlessWithElse}, - {Credo.Check.Warning.BoolOperationOnSameValues}, {Credo.Check.Warning.IExPry}, {Credo.Check.Warning.IoInspect}, @@ -131,6 +128,7 @@ # Custom checks can be created using `mix credo.gen.check`. # + {Credo.Check.Consistency.FileLocation} ] } ] diff --git a/lib/credo/check/consistency/file_location.ex b/lib/credo/check/consistency/file_location.ex new file mode 100644 index 000000000..5ef17b894 --- /dev/null +++ b/lib/credo/check/consistency/file_location.ex @@ -0,0 +1,132 @@ +defmodule Credo.Check.Consistency.FileLocation do + @moduledoc false + + # credo:disable-for-this-file Credo.Check.Readability.Specs + + @checkdoc """ + File location should follow the namespace hierarchy of the module it defines. + + Examples: + + - `lib/my_system.ex` should define the `MySystem` module + - `lib/my_system/accounts.ex` should define the `MySystem.Accounts` module + """ + @explanation [warning: @checkdoc] + + # `use Credo.Check` required that module attributes are already defined, so we need to place these attributes + # before use/alias expressions. + # credo:disable-for-next-line VBT.Credo.Check.Consistency.ModuleLayout + use Credo.Check, category: :warning, base_priority: :high + + alias Credo.Code + + def run(source_file, params \\ []) do + case verify(source_file, params) do + :ok -> + [] + + {:error, module, expected_file} -> + error(IssueMeta.for(source_file, params), module, expected_file) + end + end + + defp verify(source_file, params) do + source_file.filename + |> Path.relative_to_cwd() + |> verify(Code.ast(source_file), params) + end + + @doc false + def verify(relative_path, ast, params) do + if verify_path?(relative_path, params), + do: ast |> main_module() |> verify_module(relative_path, params), + else: :ok + end + + defp verify_path?(relative_path, params) do + case Path.split(relative_path) do + ["lib" | _] -> not exclude?(relative_path, params) + ["test", "support" | _] -> false + ["test", "test_helper.exs"] -> false + ["test" | _] -> not exclude?(relative_path, params) + _ -> false + end + end + + defp exclude?(relative_path, params) do + params + |> Keyword.get(:exclude, []) + |> Enum.any?(&String.starts_with?(relative_path, &1)) + end + + defp main_module(ast) do + {_ast, modules} = Macro.prewalk(ast, [], &traverse/2) + Enum.at(modules, -1) + end + + defp traverse({:defmodule, _meta, args}, modules) do + [{:__aliases__, _, name_parts}, _module_body] = args + {args, [Module.concat(name_parts) | modules]} + end + + defp traverse(ast, state), do: {ast, state} + + # empty file - shouldn't really happen, but we'll let it through + defp verify_module(nil, _relative_path, _params), do: :ok + + defp verify_module(main_module, relative_path, params) do + parsed_path = parsed_path(relative_path, params) + + expected_file = + expected_file_base(parsed_path.root, main_module) <> + Path.extname(parsed_path.allowed) + + if expected_file == parsed_path.allowed, + do: :ok, + else: {:error, main_module, expected_file} + end + + defp parsed_path(relative_path, params) do + parts = Path.split(relative_path) + + allowed = + Keyword.get(params, :ignore_folder_namespace, %{}) + |> Stream.flat_map(fn {root, folders} -> Enum.map(folders, &Path.join([root, &1])) end) + |> Stream.map(&Path.split/1) + |> Enum.find(&List.starts_with?(parts, &1)) + |> case do + nil -> + relative_path + + ignore_parts -> + Stream.drop(ignore_parts, -1) + |> Enum.concat(Stream.drop(parts, length(ignore_parts))) + |> Path.join() + end + + %{root: hd(parts), allowed: allowed} + end + + defp expected_file_base(root_folder, module) do + {parent_namespace, module_name} = module |> Module.split() |> Enum.split(-1) + + relative_path = + if parent_namespace == [], + do: "", + else: parent_namespace |> Module.concat() |> Macro.underscore() + + file_name = module_name |> Module.concat() |> Macro.underscore() + + Path.join([root_folder, relative_path, file_name]) + end + + defp error(issue_meta, module, expected_file) do + format_issue(issue_meta, + message: + "Mismatch between file name and main module #{inspect(module)}. " <> + "Expected file path to be #{expected_file}. " <> + "Either move the file or rename the module.", + line_no: 1 + ) + end +end From 6bf85440b373c9b2fa1e8e7184dcf87518600306 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sat, 20 Jun 2020 19:09:04 +0300 Subject: [PATCH 02/62] mix tasks consistency --- lib/mix/tasks/pleroma/{ecto => }/ecto.ex | 0 lib/mix/tasks/pleroma/{robotstxt.ex => robots_txt.ex} | 0 test/{tasks => mix}/pleroma_test.exs | 0 test/{tasks => mix/tasks/pleroma}/app_test.exs | 0 test/{tasks => mix/tasks/pleroma}/config_test.exs | 0 test/{tasks => mix/tasks/pleroma}/count_statuses_test.exs | 0 test/{tasks => mix/tasks/pleroma}/database_test.exs | 0 test/{tasks => mix/tasks/pleroma}/digest_test.exs | 0 test/{tasks => mix/tasks/pleroma}/ecto/migrate_test.exs | 0 test/{tasks => mix/tasks/pleroma}/ecto/rollback_test.exs | 0 test/{tasks/ecto => mix/tasks/pleroma}/ecto_test.exs | 0 test/{tasks => mix/tasks/pleroma}/email_test.exs | 0 test/{tasks => mix/tasks/pleroma}/emoji_test.exs | 0 test/{tasks => mix/tasks/pleroma}/frontend_test.exs | 0 test/{tasks => mix/tasks/pleroma}/instance_test.exs | 2 +- .../{tasks => mix/tasks/pleroma}/refresh_counter_cache_test.exs | 0 test/{tasks => mix/tasks/pleroma}/relay_test.exs | 0 test/{tasks => mix/tasks/pleroma}/robots_txt_test.exs | 0 test/{tasks => mix/tasks/pleroma}/uploads_test.exs | 0 test/{tasks => mix/tasks/pleroma}/user_test.exs | 0 20 files changed, 1 insertion(+), 1 deletion(-) rename lib/mix/tasks/pleroma/{ecto => }/ecto.ex (100%) rename lib/mix/tasks/pleroma/{robotstxt.ex => robots_txt.ex} (100%) rename test/{tasks => mix}/pleroma_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/app_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/config_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/count_statuses_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/database_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/digest_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/ecto/migrate_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/ecto/rollback_test.exs (100%) rename test/{tasks/ecto => mix/tasks/pleroma}/ecto_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/email_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/emoji_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/frontend_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/instance_test.exs (98%) rename test/{tasks => mix/tasks/pleroma}/refresh_counter_cache_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/relay_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/robots_txt_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/uploads_test.exs (100%) rename test/{tasks => mix/tasks/pleroma}/user_test.exs (100%) diff --git a/lib/mix/tasks/pleroma/ecto/ecto.ex b/lib/mix/tasks/pleroma/ecto.ex similarity index 100% rename from lib/mix/tasks/pleroma/ecto/ecto.ex rename to lib/mix/tasks/pleroma/ecto.ex diff --git a/lib/mix/tasks/pleroma/robotstxt.ex b/lib/mix/tasks/pleroma/robots_txt.ex similarity index 100% rename from lib/mix/tasks/pleroma/robotstxt.ex rename to lib/mix/tasks/pleroma/robots_txt.ex diff --git a/test/tasks/pleroma_test.exs b/test/mix/pleroma_test.exs similarity index 100% rename from test/tasks/pleroma_test.exs rename to test/mix/pleroma_test.exs diff --git a/test/tasks/app_test.exs b/test/mix/tasks/pleroma/app_test.exs similarity index 100% rename from test/tasks/app_test.exs rename to test/mix/tasks/pleroma/app_test.exs diff --git a/test/tasks/config_test.exs b/test/mix/tasks/pleroma/config_test.exs similarity index 100% rename from test/tasks/config_test.exs rename to test/mix/tasks/pleroma/config_test.exs diff --git a/test/tasks/count_statuses_test.exs b/test/mix/tasks/pleroma/count_statuses_test.exs similarity index 100% rename from test/tasks/count_statuses_test.exs rename to test/mix/tasks/pleroma/count_statuses_test.exs diff --git a/test/tasks/database_test.exs b/test/mix/tasks/pleroma/database_test.exs similarity index 100% rename from test/tasks/database_test.exs rename to test/mix/tasks/pleroma/database_test.exs diff --git a/test/tasks/digest_test.exs b/test/mix/tasks/pleroma/digest_test.exs similarity index 100% rename from test/tasks/digest_test.exs rename to test/mix/tasks/pleroma/digest_test.exs diff --git a/test/tasks/ecto/migrate_test.exs b/test/mix/tasks/pleroma/ecto/migrate_test.exs similarity index 100% rename from test/tasks/ecto/migrate_test.exs rename to test/mix/tasks/pleroma/ecto/migrate_test.exs diff --git a/test/tasks/ecto/rollback_test.exs b/test/mix/tasks/pleroma/ecto/rollback_test.exs similarity index 100% rename from test/tasks/ecto/rollback_test.exs rename to test/mix/tasks/pleroma/ecto/rollback_test.exs diff --git a/test/tasks/ecto/ecto_test.exs b/test/mix/tasks/pleroma/ecto_test.exs similarity index 100% rename from test/tasks/ecto/ecto_test.exs rename to test/mix/tasks/pleroma/ecto_test.exs diff --git a/test/tasks/email_test.exs b/test/mix/tasks/pleroma/email_test.exs similarity index 100% rename from test/tasks/email_test.exs rename to test/mix/tasks/pleroma/email_test.exs diff --git a/test/tasks/emoji_test.exs b/test/mix/tasks/pleroma/emoji_test.exs similarity index 100% rename from test/tasks/emoji_test.exs rename to test/mix/tasks/pleroma/emoji_test.exs diff --git a/test/tasks/frontend_test.exs b/test/mix/tasks/pleroma/frontend_test.exs similarity index 100% rename from test/tasks/frontend_test.exs rename to test/mix/tasks/pleroma/frontend_test.exs diff --git a/test/tasks/instance_test.exs b/test/mix/tasks/pleroma/instance_test.exs similarity index 98% rename from test/tasks/instance_test.exs rename to test/mix/tasks/pleroma/instance_test.exs index 914ccb10a..8a02710ee 100644 --- a/test/tasks/instance_test.exs +++ b/test/mix/tasks/pleroma/instance_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.InstanceTest do +defmodule Mix.Tasks.Pleroma.InstanceTest do use ExUnit.Case setup do diff --git a/test/tasks/refresh_counter_cache_test.exs b/test/mix/tasks/pleroma/refresh_counter_cache_test.exs similarity index 100% rename from test/tasks/refresh_counter_cache_test.exs rename to test/mix/tasks/pleroma/refresh_counter_cache_test.exs diff --git a/test/tasks/relay_test.exs b/test/mix/tasks/pleroma/relay_test.exs similarity index 100% rename from test/tasks/relay_test.exs rename to test/mix/tasks/pleroma/relay_test.exs diff --git a/test/tasks/robots_txt_test.exs b/test/mix/tasks/pleroma/robots_txt_test.exs similarity index 100% rename from test/tasks/robots_txt_test.exs rename to test/mix/tasks/pleroma/robots_txt_test.exs diff --git a/test/tasks/uploads_test.exs b/test/mix/tasks/pleroma/uploads_test.exs similarity index 100% rename from test/tasks/uploads_test.exs rename to test/mix/tasks/pleroma/uploads_test.exs diff --git a/test/tasks/user_test.exs b/test/mix/tasks/pleroma/user_test.exs similarity index 100% rename from test/tasks/user_test.exs rename to test/mix/tasks/pleroma/user_test.exs From 7dffaef4799b0e867e91e19b76567c0e1a19bb43 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 23 Jun 2020 18:16:47 +0300 Subject: [PATCH 03/62] tests consistency --- test/fixtures/modules/runtime_module.ex | 2 +- test/{ => pleroma}/activity/ir/topics_test.exs | 0 test/{ => pleroma}/activity_test.exs | 0 test/{ => pleroma}/bbs/handler_test.exs | 0 test/{ => pleroma}/bookmark_test.exs | 0 test/{ => pleroma}/captcha_test.exs | 0 test/{ => pleroma}/chat/message_reference_test.exs | 0 test/{ => pleroma}/chat_test.exs | 0 test/{ => pleroma}/config/deprecation_warnings_test.exs | 0 test/{ => pleroma}/config/holder_test.exs | 0 test/{ => pleroma}/config/loader_test.exs | 0 test/{ => pleroma}/config/transfer_task_test.exs | 0 test/{config => pleroma}/config_db_test.exs | 0 test/{ => pleroma}/config_test.exs | 0 test/{ => pleroma}/conversation/participation_test.exs | 0 test/{ => pleroma}/conversation_test.exs | 0 test/{ => pleroma}/docs/generator_test.exs | 0 test/{ => pleroma}/earmark_renderer_test.exs | 0 .../activity_pub/object_validators}/date_time_test.exs | 2 +- .../activity_pub/object_validators}/object_id_test.exs | 2 +- .../activity_pub/object_validators}/recipients_test.exs | 2 +- .../activity_pub/object_validators}/safe_text_test.exs | 2 +- test/{ => pleroma}/emails/admin_email_test.exs | 0 test/{ => pleroma}/emails/mailer_test.exs | 0 test/{ => pleroma}/emails/user_email_test.exs | 0 test/{ => pleroma}/emoji/formatter_test.exs | 0 test/{ => pleroma}/emoji/loader_test.exs | 0 test/{ => pleroma}/emoji_test.exs | 0 test/{ => pleroma}/filter_test.exs | 0 test/{ => pleroma}/following_relationship_test.exs | 0 test/{ => pleroma}/formatter_test.exs | 0 test/{ => pleroma}/healthcheck_test.exs | 0 test/{ => pleroma}/html_test.exs | 0 test/{ => pleroma}/http/adapter_helper/gun_test.exs | 0 test/{ => pleroma}/http/adapter_helper/hackney_test.exs | 0 test/{ => pleroma}/http/adapter_helper_test.exs | 0 test/{ => pleroma}/http/request_builder_test.exs | 0 test/{ => pleroma}/http_test.exs | 0 test/{web => pleroma}/instances/instance_test.exs | 0 test/{web/instances => pleroma}/instances_test.exs | 0 test/{federation => pleroma/integration}/federation_test.exs | 0 test/{ => pleroma}/integration/mastodon_websocket_test.exs | 0 test/{ => pleroma}/job_queue_monitor_test.exs | 0 test/{ => pleroma}/keys_test.exs | 0 test/{ => pleroma}/list_test.exs | 0 test/{ => pleroma}/marker_test.exs | 0 test/{ => pleroma}/mfa/backup_codes_test.exs | 0 test/{ => pleroma}/mfa/totp_test.exs | 0 test/{ => pleroma}/mfa_test.exs | 0 .../migration_helper/notification_backfill_test.exs | 0 test/{ => pleroma}/moderation_log_test.exs | 0 test/{ => pleroma}/notification_test.exs | 0 test/{ => pleroma}/object/containment_test.exs | 0 test/{ => pleroma}/object/fetcher_test.exs | 0 test/{ => pleroma}/object_test.exs | 0 test/{ => pleroma}/otp_version_test.exs | 0 test/{ => pleroma}/pagination_test.exs | 0 test/{ => pleroma}/registration_test.exs | 0 test/{ => pleroma}/repo_test.exs | 0 test/{reverse_proxy => pleroma}/reverse_proxy_test.exs | 0 test/{ => pleroma}/runtime_test.exs | 3 ++- test/{ => pleroma}/safe_jsonb_set_test.exs | 0 test/{ => pleroma}/scheduled_activity_test.exs | 0 test/{ => pleroma}/signature_test.exs | 0 test/{ => pleroma}/stats_test.exs | 0 test/{ => pleroma}/upload/filter/anonymize_filename_test.exs | 0 test/{ => pleroma}/upload/filter/dedupe_test.exs | 0 test/{ => pleroma}/upload/filter/mogrifun_test.exs | 0 test/{ => pleroma}/upload/filter/mogrify_test.exs | 0 test/{ => pleroma}/upload/filter_test.exs | 0 test/{ => pleroma}/upload_test.exs | 0 test/{ => pleroma}/uploaders/local_test.exs | 0 test/{ => pleroma}/uploaders/s3_test.exs | 0 test/{ => pleroma}/user/notification_setting_test.exs | 0 test/{ => pleroma}/user_invite_token_test.exs | 0 test/{ => pleroma}/user_relationship_test.exs | 0 test/{ => pleroma}/user_search_test.exs | 0 test/{ => pleroma}/user_test.exs | 0 .../web/activity_pub/activity_pub_controller_test.exs | 0 test/{ => pleroma}/web/activity_pub/activity_pub_test.exs | 0 .../web/activity_pub}/force_bot_unlisted_policy_test.exs | 0 .../web/activity_pub/mrf/activity_expiration_policy_test.exs | 0 .../web/activity_pub/mrf/anti_followbot_policy_test.exs | 0 .../web/activity_pub/mrf/anti_link_spam_policy_test.exs | 0 .../web/activity_pub/mrf/ensure_re_prepended_test.exs | 0 .../web/activity_pub/mrf/hellthread_policy_test.exs | 0 .../{ => pleroma}/web/activity_pub/mrf/keyword_policy_test.exs | 0 .../web/activity_pub/mrf/media_proxy_warming_policy_test.exs} | 0 .../{ => pleroma}/web/activity_pub/mrf/mention_policy_test.exs | 0 .../web/activity_pub/mrf/no_placeholder_text_policy_test.exs | 0 .../web/activity_pub/mrf/normalize_markup_test.exs | 0 .../web/activity_pub/mrf/object_age_policy_test.exs | 0 .../web/activity_pub/mrf/reject_non_public_test.exs | 0 test/{ => pleroma}/web/activity_pub/mrf/simple_policy_test.exs | 0 .../web/activity_pub/mrf/steal_emoji_policy_test.exs | 0 .../web/activity_pub/mrf/subchain_policy_test.exs | 0 test/{ => pleroma}/web/activity_pub/mrf/tag_policy_test.exs | 0 .../web/activity_pub/mrf/user_allow_list_policy_test.exs} | 0 .../web/activity_pub/mrf/vocabulary_policy_test.exs | 0 .../activity_pub/mrf => pleroma/web/activity_pub}/mrf_test.exs | 0 test/{ => pleroma}/web/activity_pub/pipeline_test.exs | 0 test/{ => pleroma}/web/activity_pub/publisher_test.exs | 0 test/{ => pleroma}/web/activity_pub/relay_test.exs | 0 test/{ => pleroma}/web/activity_pub/side_effects_test.exs | 0 .../web/activity_pub/transmogrifier/announce_handling_test.exs | 0 .../web/activity_pub/transmogrifier/chat_message_test.exs | 0 .../web/activity_pub/transmogrifier/delete_handling_test.exs | 0 .../activity_pub/transmogrifier/emoji_react_handling_test.exs | 0 .../web/activity_pub/transmogrifier/follow_handling_test.exs | 0 .../web/activity_pub/transmogrifier/like_handling_test.exs | 0 .../web/activity_pub/transmogrifier/undo_handling_test.exs | 0 test/{ => pleroma}/web/activity_pub/transmogrifier_test.exs | 0 test/{ => pleroma}/web/activity_pub/utils_test.exs | 0 test/{ => pleroma}/web/activity_pub/views/object_view_test.exs | 0 test/{ => pleroma}/web/activity_pub/views/user_view_test.exs | 0 .../web/activity_pub/visibility_test.exs} | 0 .../web/admin_api/controllers/admin_api_controller_test.exs | 0 .../web/admin_api/controllers/config_controller_test.exs | 0 .../web/admin_api/controllers/invite_controller_test.exs | 0 .../controllers/media_proxy_cache_controller_test.exs | 0 .../web/admin_api/controllers/oauth_app_controller_test.exs | 0 .../web/admin_api/controllers/relay_controller_test.exs | 0 .../web/admin_api/controllers/report_controller_test.exs | 0 .../web/admin_api/controllers/status_controller_test.exs | 0 test/{ => pleroma}/web/admin_api/search_test.exs | 0 test/{ => pleroma}/web/admin_api/views/report_view_test.exs | 0 test/{ => pleroma}/web/api_spec/schema_examples_test.exs | 0 .../web/auth/auth_controller_test.exs} | 2 +- test/{ => pleroma}/web/auth/authenticator_test.exs | 0 test/{ => pleroma}/web/auth/basic_auth_test.exs | 0 test/{ => pleroma}/web/auth/pleroma_authenticator_test.exs | 0 test/{ => pleroma}/web/auth/totp_authenticator_test.exs | 0 test/{ => pleroma}/web/chat_channel_test.exs | 0 .../web/common_api/utils_test.exs} | 0 test/{web/common_api => pleroma/web}/common_api_test.exs | 0 test/{ => pleroma}/web/fallback_test.exs | 0 test/{ => pleroma}/web/federator_test.exs | 0 test/{ => pleroma}/web/feed/tag_controller_test.exs | 0 test/{ => pleroma}/web/feed/user_controller_test.exs | 0 .../web/mastodon_api/controllers/account_controller_test.exs | 0 .../web/mastodon_api/controllers/app_controller_test.exs | 0 .../web/mastodon_api/controllers/auth_controller_test.exs | 0 .../mastodon_api/controllers/conversation_controller_test.exs | 0 .../mastodon_api/controllers/custom_emoji_controller_test.exs | 0 .../mastodon_api/controllers/domain_block_controller_test.exs | 0 .../web/mastodon_api/controllers/filter_controller_test.exs | 0 .../controllers/follow_request_controller_test.exs | 0 .../web/mastodon_api/controllers/instance_controller_test.exs | 0 .../web/mastodon_api/controllers/list_controller_test.exs | 0 .../web/mastodon_api/controllers/marker_controller_test.exs | 0 .../web/mastodon_api/controllers/media_controller_test.exs | 0 .../mastodon_api/controllers/notification_controller_test.exs | 0 .../web/mastodon_api/controllers/poll_controller_test.exs | 0 .../web/mastodon_api/controllers/report_controller_test.exs | 0 .../controllers/scheduled_activity_controller_test.exs | 0 .../web/mastodon_api/controllers/search_controller_test.exs | 0 .../web/mastodon_api/controllers/status_controller_test.exs | 0 .../mastodon_api/controllers/subscription_controller_test.exs | 0 .../mastodon_api/controllers/suggestion_controller_test.exs | 0 .../web/mastodon_api/controllers/timeline_controller_test.exs | 0 .../web/mastodon_api}/masto_fe_controller_test.exs | 2 +- .../web/mastodon_api/mastodon_api_controller_test.exs | 0 test/{ => pleroma}/web/mastodon_api/mastodon_api_test.exs | 0 .../web/mastodon_api}/update_credentials_test.exs | 2 +- .../{ => pleroma}/web/mastodon_api/views/account_view_test.exs | 0 .../web/mastodon_api/views/conversation_view_test.exs | 0 test/{ => pleroma}/web/mastodon_api/views/list_view_test.exs | 0 test/{ => pleroma}/web/mastodon_api/views/marker_view_test.exs | 0 .../web/mastodon_api/views/notification_view_test.exs | 0 test/{ => pleroma}/web/mastodon_api/views/poll_view_test.exs | 0 .../web/mastodon_api/views/scheduled_activity_view_test.exs | 0 test/{ => pleroma}/web/mastodon_api/views/status_view_test.exs | 0 .../web/mastodon_api/views/subscription_view_test.exs | 0 .../web/media_proxy/invalidation}/http_test.exs | 0 .../web/media_proxy/invalidation}/script_test.exs | 0 test/{ => pleroma}/web/media_proxy/invalidation_test.exs | 0 .../web/media_proxy/media_proxy_controller_test.exs | 0 test/{web/media_proxy => pleroma/web}/media_proxy_test.exs | 0 test/{ => pleroma}/web/metadata/player_view_test.exs | 0 .../metadata => pleroma/web/metadata/providers}/feed_test.exs | 0 .../web/metadata/providers/open_graph_test.exs} | 0 .../web/metadata/providers}/rel_me_test.exs | 0 .../web/metadata/providers}/restrict_indexing_test.exs | 0 .../web/metadata/providers}/twitter_card_test.exs | 0 test/{ => pleroma}/web/metadata/utils_test.exs | 0 test/{web/metadata => pleroma/web}/metadata_test.exs | 0 .../mongooseim => pleroma/web}/mongoose_im_controller_test.exs | 2 +- test/{ => pleroma}/web/node_info_test.exs | 0 test/{web/oauth => pleroma/web/o_auth}/app_test.exs | 0 test/{web/oauth => pleroma/web/o_auth}/authorization_test.exs | 0 .../oauth => pleroma/web/o_auth}/ldap_authorization_test.exs | 0 test/{web/oauth => pleroma/web/o_auth}/mfa_controller_test.exs | 0 .../web/o_auth/o_auth_controller_test.exs} | 0 test/{web/oauth => pleroma/web/o_auth}/token/utils_test.exs | 0 test/{web/oauth => pleroma/web/o_auth}/token_test.exs | 0 .../web/o_status/o_status_controller_test.exs} | 0 .../web/pleroma_api/controllers/account_controller_test.exs | 0 .../web/pleroma_api/controllers/chat_controller_test.exs | 0 .../pleroma_api/controllers/conversation_controller_test.exs | 0 .../web/pleroma_api/controllers/emoji_pack_controller_test.exs | 0 .../pleroma_api/controllers/emoji_reaction_controller_test.exs | 0 .../web/pleroma_api/controllers/mascot_controller_test.exs | 0 .../pleroma_api/controllers/notification_controller_test.exs | 0 .../web/pleroma_api/controllers/scrobble_controller_test.exs | 0 .../controllers/two_factor_authentication_controller_test.exs | 0 .../pleroma_api/views/chat_message_reference_view_test.exs} | 2 +- test/{ => pleroma}/web/pleroma_api/views/chat_view_test.exs | 0 .../{ => pleroma}/web/pleroma_api/views/scrobble_view_test.exs | 0 .../web}/plugs/admin_secret_authentication_plug_test.exs | 2 +- test/{ => pleroma/web}/plugs/authentication_plug_test.exs | 2 +- test/{ => pleroma/web}/plugs/basic_auth_decoder_plug_test.exs | 2 +- test/{ => pleroma/web}/plugs/cache_control_test.exs | 2 +- test/{ => pleroma/web}/plugs/cache_test.exs | 2 +- .../{ => pleroma/web}/plugs/ensure_authenticated_plug_test.exs | 2 +- .../web}/plugs/ensure_public_or_authenticated_plug_test.exs | 2 +- test/{ => pleroma/web}/plugs/ensure_user_key_plug_test.exs | 2 +- test/{ => pleroma}/web/plugs/federating_plug_test.exs | 2 +- test/{ => pleroma/web}/plugs/http_security_plug_test.exs | 0 test/{ => pleroma/web}/plugs/http_signature_plug_test.exs | 0 test/{ => pleroma/web}/plugs/idempotency_plug_test.exs | 2 +- test/{ => pleroma/web}/plugs/instance_static_test.exs | 2 +- .../web}/plugs/legacy_authentication_plug_test.exs | 2 +- .../web/plugs/mapped_signature_to_identity_plug_test.exs} | 0 .../web/plugs/o_auth_plug_test.exs} | 2 +- .../web/plugs/o_auth_scopes_plug_test.exs} | 2 +- .../plug_test.exs => pleroma/web/plugs/plug_helper_test.exs} | 2 +- test/{ => pleroma/web}/plugs/rate_limiter_test.exs | 2 +- test/{ => pleroma/web}/plugs/remote_ip_test.exs | 2 +- .../web}/plugs/session_authentication_plug_test.exs | 2 +- test/{ => pleroma/web}/plugs/set_format_plug_test.exs | 2 +- test/{ => pleroma/web}/plugs/set_locale_plug_test.exs | 2 +- test/{ => pleroma/web}/plugs/set_user_session_id_plug_test.exs | 2 +- test/{ => pleroma/web}/plugs/uploaded_media_plug_test.exs | 2 +- test/{ => pleroma/web}/plugs/user_enabled_plug_test.exs | 2 +- test/{ => pleroma/web}/plugs/user_fetcher_plug_test.exs | 2 +- test/{ => pleroma/web}/plugs/user_is_admin_plug_test.exs | 2 +- test/{ => pleroma}/web/push/impl_test.exs | 0 test/{ => pleroma}/web/rel_me_test.exs | 0 test/{ => pleroma}/web/rich_media/helpers_test.exs | 0 test/{ => pleroma}/web/rich_media/parser_test.exs | 0 .../web/rich_media/parsers/ttl}/aws_signed_url_test.exs | 2 +- .../{ => pleroma}/web/rich_media/parsers/twitter_card_test.exs | 0 test/{ => pleroma}/web/static_fe/static_fe_controller_test.exs | 0 test/{web/streamer => pleroma/web}/streamer_test.exs | 0 .../web/twitter_api/controller_test.exs} | 0 .../{ => pleroma}/web/twitter_api/password_controller_test.exs | 0 .../web/twitter_api/remote_follow_controller_test.exs | 0 test/{ => pleroma}/web/twitter_api/twitter_api_test.exs | 0 test/{ => pleroma}/web/twitter_api/util_controller_test.exs | 0 test/{ => pleroma}/web/uploader_controller_test.exs | 0 test/{ => pleroma}/web/views/error_view_test.exs | 0 .../web/web_finger/web_finger_controller_test.exs | 0 test/{web/web_finger => pleroma/web}/web_finger_test.exs | 0 test/{ => pleroma}/workers/cron/digest_emails_worker_test.exs | 0 .../workers/cron/new_users_digest_worker_test.exs | 0 test/{ => pleroma}/workers/scheduled_activity_worker_test.exs | 0 test/{ => pleroma}/xml_builder_test.exs | 0 test/support/{captcha_mock.ex => captcha/mock.ex} | 0 258 files changed, 38 insertions(+), 37 deletions(-) rename test/{ => pleroma}/activity/ir/topics_test.exs (100%) rename test/{ => pleroma}/activity_test.exs (100%) rename test/{ => pleroma}/bbs/handler_test.exs (100%) rename test/{ => pleroma}/bookmark_test.exs (100%) rename test/{ => pleroma}/captcha_test.exs (100%) rename test/{ => pleroma}/chat/message_reference_test.exs (100%) rename test/{ => pleroma}/chat_test.exs (100%) rename test/{ => pleroma}/config/deprecation_warnings_test.exs (100%) rename test/{ => pleroma}/config/holder_test.exs (100%) rename test/{ => pleroma}/config/loader_test.exs (100%) rename test/{ => pleroma}/config/transfer_task_test.exs (100%) rename test/{config => pleroma}/config_db_test.exs (100%) rename test/{ => pleroma}/config_test.exs (100%) rename test/{ => pleroma}/conversation/participation_test.exs (100%) rename test/{ => pleroma}/conversation_test.exs (100%) rename test/{ => pleroma}/docs/generator_test.exs (100%) rename test/{ => pleroma}/earmark_renderer_test.exs (100%) rename test/{web/activity_pub/object_validators/types => pleroma/ecto_type/activity_pub/object_validators}/date_time_test.exs (92%) rename test/{web/activity_pub/object_validators/types => pleroma/ecto_type/activity_pub/object_validators}/object_id_test.exs (92%) rename test/{web/activity_pub/object_validators/types => pleroma/ecto_type/activity_pub/object_validators}/recipients_test.exs (93%) rename test/{web/activity_pub/object_validators/types => pleroma/ecto_type/activity_pub/object_validators}/safe_text_test.exs (92%) rename test/{ => pleroma}/emails/admin_email_test.exs (100%) rename test/{ => pleroma}/emails/mailer_test.exs (100%) rename test/{ => pleroma}/emails/user_email_test.exs (100%) rename test/{ => pleroma}/emoji/formatter_test.exs (100%) rename test/{ => pleroma}/emoji/loader_test.exs (100%) rename test/{ => pleroma}/emoji_test.exs (100%) rename test/{ => pleroma}/filter_test.exs (100%) rename test/{ => pleroma}/following_relationship_test.exs (100%) rename test/{ => pleroma}/formatter_test.exs (100%) rename test/{ => pleroma}/healthcheck_test.exs (100%) rename test/{ => pleroma}/html_test.exs (100%) rename test/{ => pleroma}/http/adapter_helper/gun_test.exs (100%) rename test/{ => pleroma}/http/adapter_helper/hackney_test.exs (100%) rename test/{ => pleroma}/http/adapter_helper_test.exs (100%) rename test/{ => pleroma}/http/request_builder_test.exs (100%) rename test/{ => pleroma}/http_test.exs (100%) rename test/{web => pleroma}/instances/instance_test.exs (100%) rename test/{web/instances => pleroma}/instances_test.exs (100%) rename test/{federation => pleroma/integration}/federation_test.exs (100%) rename test/{ => pleroma}/integration/mastodon_websocket_test.exs (100%) rename test/{ => pleroma}/job_queue_monitor_test.exs (100%) rename test/{ => pleroma}/keys_test.exs (100%) rename test/{ => pleroma}/list_test.exs (100%) rename test/{ => pleroma}/marker_test.exs (100%) rename test/{ => pleroma}/mfa/backup_codes_test.exs (100%) rename test/{ => pleroma}/mfa/totp_test.exs (100%) rename test/{ => pleroma}/mfa_test.exs (100%) rename test/{ => pleroma}/migration_helper/notification_backfill_test.exs (100%) rename test/{ => pleroma}/moderation_log_test.exs (100%) rename test/{ => pleroma}/notification_test.exs (100%) rename test/{ => pleroma}/object/containment_test.exs (100%) rename test/{ => pleroma}/object/fetcher_test.exs (100%) rename test/{ => pleroma}/object_test.exs (100%) rename test/{ => pleroma}/otp_version_test.exs (100%) rename test/{ => pleroma}/pagination_test.exs (100%) rename test/{ => pleroma}/registration_test.exs (100%) rename test/{ => pleroma}/repo_test.exs (100%) rename test/{reverse_proxy => pleroma}/reverse_proxy_test.exs (100%) rename test/{ => pleroma}/runtime_test.exs (69%) rename test/{ => pleroma}/safe_jsonb_set_test.exs (100%) rename test/{ => pleroma}/scheduled_activity_test.exs (100%) rename test/{ => pleroma}/signature_test.exs (100%) rename test/{ => pleroma}/stats_test.exs (100%) rename test/{ => pleroma}/upload/filter/anonymize_filename_test.exs (100%) rename test/{ => pleroma}/upload/filter/dedupe_test.exs (100%) rename test/{ => pleroma}/upload/filter/mogrifun_test.exs (100%) rename test/{ => pleroma}/upload/filter/mogrify_test.exs (100%) rename test/{ => pleroma}/upload/filter_test.exs (100%) rename test/{ => pleroma}/upload_test.exs (100%) rename test/{ => pleroma}/uploaders/local_test.exs (100%) rename test/{ => pleroma}/uploaders/s3_test.exs (100%) rename test/{ => pleroma}/user/notification_setting_test.exs (100%) rename test/{ => pleroma}/user_invite_token_test.exs (100%) rename test/{ => pleroma}/user_relationship_test.exs (100%) rename test/{ => pleroma}/user_search_test.exs (100%) rename test/{ => pleroma}/user_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/activity_pub_controller_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/activity_pub_test.exs (100%) rename test/{web/activity_pub/mrf => pleroma/web/activity_pub}/force_bot_unlisted_policy_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/activity_expiration_policy_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/anti_followbot_policy_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/anti_link_spam_policy_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/ensure_re_prepended_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/hellthread_policy_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/keyword_policy_test.exs (100%) rename test/{web/activity_pub/mrf/mediaproxy_warming_policy_test.exs => pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs} (100%) rename test/{ => pleroma}/web/activity_pub/mrf/mention_policy_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/no_placeholder_text_policy_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/normalize_markup_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/object_age_policy_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/reject_non_public_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/simple_policy_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/steal_emoji_policy_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/subchain_policy_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/mrf/tag_policy_test.exs (100%) rename test/{web/activity_pub/mrf/user_allowlist_policy_test.exs => pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs} (100%) rename test/{ => pleroma}/web/activity_pub/mrf/vocabulary_policy_test.exs (100%) rename test/{web/activity_pub/mrf => pleroma/web/activity_pub}/mrf_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/pipeline_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/publisher_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/relay_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/side_effects_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/announce_handling_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/chat_message_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/delete_handling_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/emoji_react_handling_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/follow_handling_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/like_handling_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/undo_handling_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/utils_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/views/object_view_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/views/user_view_test.exs (100%) rename test/{web/activity_pub/visibilty_test.exs => pleroma/web/activity_pub/visibility_test.exs} (100%) rename test/{ => pleroma}/web/admin_api/controllers/admin_api_controller_test.exs (100%) rename test/{ => pleroma}/web/admin_api/controllers/config_controller_test.exs (100%) rename test/{ => pleroma}/web/admin_api/controllers/invite_controller_test.exs (100%) rename test/{ => pleroma}/web/admin_api/controllers/media_proxy_cache_controller_test.exs (100%) rename test/{ => pleroma}/web/admin_api/controllers/oauth_app_controller_test.exs (100%) rename test/{ => pleroma}/web/admin_api/controllers/relay_controller_test.exs (100%) rename test/{ => pleroma}/web/admin_api/controllers/report_controller_test.exs (100%) rename test/{ => pleroma}/web/admin_api/controllers/status_controller_test.exs (100%) rename test/{ => pleroma}/web/admin_api/search_test.exs (100%) rename test/{ => pleroma}/web/admin_api/views/report_view_test.exs (100%) rename test/{ => pleroma}/web/api_spec/schema_examples_test.exs (100%) rename test/{web/auth/auth_test_controller_test.exs => pleroma/web/auth/auth_controller_test.exs} (99%) rename test/{ => pleroma}/web/auth/authenticator_test.exs (100%) rename test/{ => pleroma}/web/auth/basic_auth_test.exs (100%) rename test/{ => pleroma}/web/auth/pleroma_authenticator_test.exs (100%) rename test/{ => pleroma}/web/auth/totp_authenticator_test.exs (100%) rename test/{ => pleroma}/web/chat_channel_test.exs (100%) rename test/{web/common_api/common_api_utils_test.exs => pleroma/web/common_api/utils_test.exs} (100%) rename test/{web/common_api => pleroma/web}/common_api_test.exs (100%) rename test/{ => pleroma}/web/fallback_test.exs (100%) rename test/{ => pleroma}/web/federator_test.exs (100%) rename test/{ => pleroma}/web/feed/tag_controller_test.exs (100%) rename test/{ => pleroma}/web/feed/user_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/account_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/app_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/auth_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/conversation_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/custom_emoji_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/domain_block_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/filter_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/follow_request_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/instance_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/list_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/marker_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/media_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/notification_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/poll_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/report_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/scheduled_activity_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/search_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/status_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/subscription_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/suggestion_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/controllers/timeline_controller_test.exs (100%) rename test/{web => pleroma/web/mastodon_api}/masto_fe_controller_test.exs (97%) rename test/{ => pleroma}/web/mastodon_api/mastodon_api_controller_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/mastodon_api_test.exs (100%) rename test/{web/mastodon_api/controllers/account_controller => pleroma/web/mastodon_api}/update_credentials_test.exs (99%) rename test/{ => pleroma}/web/mastodon_api/views/account_view_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/views/conversation_view_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/views/list_view_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/views/marker_view_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/views/notification_view_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/views/poll_view_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/views/scheduled_activity_view_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/views/status_view_test.exs (100%) rename test/{ => pleroma}/web/mastodon_api/views/subscription_view_test.exs (100%) rename test/{web/media_proxy/invalidations => pleroma/web/media_proxy/invalidation}/http_test.exs (100%) rename test/{web/media_proxy/invalidations => pleroma/web/media_proxy/invalidation}/script_test.exs (100%) rename test/{ => pleroma}/web/media_proxy/invalidation_test.exs (100%) rename test/{ => pleroma}/web/media_proxy/media_proxy_controller_test.exs (100%) rename test/{web/media_proxy => pleroma/web}/media_proxy_test.exs (100%) rename test/{ => pleroma}/web/metadata/player_view_test.exs (100%) rename test/{web/metadata => pleroma/web/metadata/providers}/feed_test.exs (100%) rename test/{web/metadata/opengraph_test.exs => pleroma/web/metadata/providers/open_graph_test.exs} (100%) rename test/{web/metadata => pleroma/web/metadata/providers}/rel_me_test.exs (100%) rename test/{web/metadata => pleroma/web/metadata/providers}/restrict_indexing_test.exs (100%) rename test/{web/metadata => pleroma/web/metadata/providers}/twitter_card_test.exs (100%) rename test/{ => pleroma}/web/metadata/utils_test.exs (100%) rename test/{web/metadata => pleroma/web}/metadata_test.exs (100%) rename test/{web/mongooseim => pleroma/web}/mongoose_im_controller_test.exs (97%) rename test/{ => pleroma}/web/node_info_test.exs (100%) rename test/{web/oauth => pleroma/web/o_auth}/app_test.exs (100%) rename test/{web/oauth => pleroma/web/o_auth}/authorization_test.exs (100%) rename test/{web/oauth => pleroma/web/o_auth}/ldap_authorization_test.exs (100%) rename test/{web/oauth => pleroma/web/o_auth}/mfa_controller_test.exs (100%) rename test/{web/oauth/oauth_controller_test.exs => pleroma/web/o_auth/o_auth_controller_test.exs} (100%) rename test/{web/oauth => pleroma/web/o_auth}/token/utils_test.exs (100%) rename test/{web/oauth => pleroma/web/o_auth}/token_test.exs (100%) rename test/{web/ostatus/ostatus_controller_test.exs => pleroma/web/o_status/o_status_controller_test.exs} (100%) rename test/{ => pleroma}/web/pleroma_api/controllers/account_controller_test.exs (100%) rename test/{ => pleroma}/web/pleroma_api/controllers/chat_controller_test.exs (100%) rename test/{ => pleroma}/web/pleroma_api/controllers/conversation_controller_test.exs (100%) rename test/{ => pleroma}/web/pleroma_api/controllers/emoji_pack_controller_test.exs (100%) rename test/{ => pleroma}/web/pleroma_api/controllers/emoji_reaction_controller_test.exs (100%) rename test/{ => pleroma}/web/pleroma_api/controllers/mascot_controller_test.exs (100%) rename test/{ => pleroma}/web/pleroma_api/controllers/notification_controller_test.exs (100%) rename test/{ => pleroma}/web/pleroma_api/controllers/scrobble_controller_test.exs (100%) rename test/{ => pleroma}/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs (100%) rename test/{web/pleroma_api/views/chat/message_reference_view_test.exs => pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs} (97%) rename test/{ => pleroma}/web/pleroma_api/views/chat_view_test.exs (100%) rename test/{ => pleroma}/web/pleroma_api/views/scrobble_view_test.exs (100%) rename test/{ => pleroma/web}/plugs/admin_secret_authentication_plug_test.exs (96%) rename test/{ => pleroma/web}/plugs/authentication_plug_test.exs (98%) rename test/{ => pleroma/web}/plugs/basic_auth_decoder_plug_test.exs (94%) rename test/{ => pleroma/web}/plugs/cache_control_test.exs (92%) rename test/{ => pleroma/web}/plugs/cache_test.exs (99%) rename test/{ => pleroma/web}/plugs/ensure_authenticated_plug_test.exs (98%) rename test/{ => pleroma/web}/plugs/ensure_public_or_authenticated_plug_test.exs (94%) rename test/{ => pleroma/web}/plugs/ensure_user_key_plug_test.exs (92%) rename test/{ => pleroma}/web/plugs/federating_plug_test.exs (93%) rename test/{ => pleroma/web}/plugs/http_security_plug_test.exs (100%) rename test/{ => pleroma/web}/plugs/http_signature_plug_test.exs (100%) rename test/{ => pleroma/web}/plugs/idempotency_plug_test.exs (98%) rename test/{ => pleroma/web}/plugs/instance_static_test.exs (97%) rename test/{ => pleroma/web}/plugs/legacy_authentication_plug_test.exs (97%) rename test/{plugs/mapped_identity_to_signature_plug_test.exs => pleroma/web/plugs/mapped_signature_to_identity_plug_test.exs} (100%) rename test/{plugs/oauth_plug_test.exs => pleroma/web/plugs/o_auth_plug_test.exs} (98%) rename test/{plugs/oauth_scopes_plug_test.exs => pleroma/web/plugs/o_auth_scopes_plug_test.exs} (99%) rename test/{web/plugs/plug_test.exs => pleroma/web/plugs/plug_helper_test.exs} (98%) rename test/{ => pleroma/web}/plugs/rate_limiter_test.exs (99%) rename test/{ => pleroma/web}/plugs/remote_ip_test.exs (98%) rename test/{ => pleroma/web}/plugs/session_authentication_plug_test.exs (95%) rename test/{ => pleroma/web}/plugs/set_format_plug_test.exs (94%) rename test/{ => pleroma/web}/plugs/set_locale_plug_test.exs (95%) rename test/{ => pleroma/web}/plugs/set_user_session_id_plug_test.exs (94%) rename test/{ => pleroma/web}/plugs/uploaded_media_plug_test.exs (95%) rename test/{ => pleroma/web}/plugs/user_enabled_plug_test.exs (96%) rename test/{ => pleroma/web}/plugs/user_fetcher_plug_test.exs (94%) rename test/{ => pleroma/web}/plugs/user_is_admin_plug_test.exs (94%) rename test/{ => pleroma}/web/push/impl_test.exs (100%) rename test/{ => pleroma}/web/rel_me_test.exs (100%) rename test/{ => pleroma}/web/rich_media/helpers_test.exs (100%) rename test/{ => pleroma}/web/rich_media/parser_test.exs (100%) rename test/{web/rich_media => pleroma/web/rich_media/parsers/ttl}/aws_signed_url_test.exs (97%) rename test/{ => pleroma}/web/rich_media/parsers/twitter_card_test.exs (100%) rename test/{ => pleroma}/web/static_fe/static_fe_controller_test.exs (100%) rename test/{web/streamer => pleroma/web}/streamer_test.exs (100%) rename test/{web/twitter_api/twitter_api_controller_test.exs => pleroma/web/twitter_api/controller_test.exs} (100%) rename test/{ => pleroma}/web/twitter_api/password_controller_test.exs (100%) rename test/{ => pleroma}/web/twitter_api/remote_follow_controller_test.exs (100%) rename test/{ => pleroma}/web/twitter_api/twitter_api_test.exs (100%) rename test/{ => pleroma}/web/twitter_api/util_controller_test.exs (100%) rename test/{ => pleroma}/web/uploader_controller_test.exs (100%) rename test/{ => pleroma}/web/views/error_view_test.exs (100%) rename test/{ => pleroma}/web/web_finger/web_finger_controller_test.exs (100%) rename test/{web/web_finger => pleroma/web}/web_finger_test.exs (100%) rename test/{ => pleroma}/workers/cron/digest_emails_worker_test.exs (100%) rename test/{ => pleroma}/workers/cron/new_users_digest_worker_test.exs (100%) rename test/{ => pleroma}/workers/scheduled_activity_worker_test.exs (100%) rename test/{ => pleroma}/xml_builder_test.exs (100%) rename test/support/{captcha_mock.ex => captcha/mock.ex} (100%) diff --git a/test/fixtures/modules/runtime_module.ex b/test/fixtures/modules/runtime_module.ex index f11032b57..e348c499e 100644 --- a/test/fixtures/modules/runtime_module.ex +++ b/test/fixtures/modules/runtime_module.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule RuntimeModule do +defmodule Fixtures.Modules.RuntimeModule do @moduledoc """ This is a dummy module to test custom runtime modules. """ diff --git a/test/activity/ir/topics_test.exs b/test/pleroma/activity/ir/topics_test.exs similarity index 100% rename from test/activity/ir/topics_test.exs rename to test/pleroma/activity/ir/topics_test.exs diff --git a/test/activity_test.exs b/test/pleroma/activity_test.exs similarity index 100% rename from test/activity_test.exs rename to test/pleroma/activity_test.exs diff --git a/test/bbs/handler_test.exs b/test/pleroma/bbs/handler_test.exs similarity index 100% rename from test/bbs/handler_test.exs rename to test/pleroma/bbs/handler_test.exs diff --git a/test/bookmark_test.exs b/test/pleroma/bookmark_test.exs similarity index 100% rename from test/bookmark_test.exs rename to test/pleroma/bookmark_test.exs diff --git a/test/captcha_test.exs b/test/pleroma/captcha_test.exs similarity index 100% rename from test/captcha_test.exs rename to test/pleroma/captcha_test.exs diff --git a/test/chat/message_reference_test.exs b/test/pleroma/chat/message_reference_test.exs similarity index 100% rename from test/chat/message_reference_test.exs rename to test/pleroma/chat/message_reference_test.exs diff --git a/test/chat_test.exs b/test/pleroma/chat_test.exs similarity index 100% rename from test/chat_test.exs rename to test/pleroma/chat_test.exs diff --git a/test/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs similarity index 100% rename from test/config/deprecation_warnings_test.exs rename to test/pleroma/config/deprecation_warnings_test.exs diff --git a/test/config/holder_test.exs b/test/pleroma/config/holder_test.exs similarity index 100% rename from test/config/holder_test.exs rename to test/pleroma/config/holder_test.exs diff --git a/test/config/loader_test.exs b/test/pleroma/config/loader_test.exs similarity index 100% rename from test/config/loader_test.exs rename to test/pleroma/config/loader_test.exs diff --git a/test/config/transfer_task_test.exs b/test/pleroma/config/transfer_task_test.exs similarity index 100% rename from test/config/transfer_task_test.exs rename to test/pleroma/config/transfer_task_test.exs diff --git a/test/config/config_db_test.exs b/test/pleroma/config_db_test.exs similarity index 100% rename from test/config/config_db_test.exs rename to test/pleroma/config_db_test.exs diff --git a/test/config_test.exs b/test/pleroma/config_test.exs similarity index 100% rename from test/config_test.exs rename to test/pleroma/config_test.exs diff --git a/test/conversation/participation_test.exs b/test/pleroma/conversation/participation_test.exs similarity index 100% rename from test/conversation/participation_test.exs rename to test/pleroma/conversation/participation_test.exs diff --git a/test/conversation_test.exs b/test/pleroma/conversation_test.exs similarity index 100% rename from test/conversation_test.exs rename to test/pleroma/conversation_test.exs diff --git a/test/docs/generator_test.exs b/test/pleroma/docs/generator_test.exs similarity index 100% rename from test/docs/generator_test.exs rename to test/pleroma/docs/generator_test.exs diff --git a/test/earmark_renderer_test.exs b/test/pleroma/earmark_renderer_test.exs similarity index 100% rename from test/earmark_renderer_test.exs rename to test/pleroma/earmark_renderer_test.exs diff --git a/test/web/activity_pub/object_validators/types/date_time_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs similarity index 92% rename from test/web/activity_pub/object_validators/types/date_time_test.exs rename to test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs index 10310c801..812463454 100644 --- a/test/web/activity_pub/object_validators/types/date_time_test.exs +++ b/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.ActivityPub.ObjectValidators.Types.DateTimeTest do +defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.DateTimeTest do alias Pleroma.EctoType.ActivityPub.ObjectValidators.DateTime use Pleroma.DataCase diff --git a/test/web/activity_pub/object_validators/types/object_id_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs similarity index 92% rename from test/web/activity_pub/object_validators/types/object_id_test.exs rename to test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs index e0ab76379..732e2365f 100644 --- a/test/web/activity_pub/object_validators/types/object_id_test.exs +++ b/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.ObjectValidators.Types.ObjectIDTest do +defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.ObjectIDTest do alias Pleroma.EctoType.ActivityPub.ObjectValidators.ObjectID use Pleroma.DataCase diff --git a/test/web/activity_pub/object_validators/types/recipients_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs similarity index 93% rename from test/web/activity_pub/object_validators/types/recipients_test.exs rename to test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs index c09265f0d..2e6a0c83d 100644 --- a/test/web/activity_pub/object_validators/types/recipients_test.exs +++ b/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.ObjectValidators.Types.RecipientsTest do +defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.RecipientsTest do alias Pleroma.EctoType.ActivityPub.ObjectValidators.Recipients use Pleroma.DataCase diff --git a/test/web/activity_pub/object_validators/types/safe_text_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs similarity index 92% rename from test/web/activity_pub/object_validators/types/safe_text_test.exs rename to test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs index 9c08606f6..7eddd2388 100644 --- a/test/web/activity_pub/object_validators/types/safe_text_test.exs +++ b/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.ActivityPub.ObjectValidators.Types.SafeTextTest do +defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.SafeTextTest do use Pleroma.DataCase alias Pleroma.EctoType.ActivityPub.ObjectValidators.SafeText diff --git a/test/emails/admin_email_test.exs b/test/pleroma/emails/admin_email_test.exs similarity index 100% rename from test/emails/admin_email_test.exs rename to test/pleroma/emails/admin_email_test.exs diff --git a/test/emails/mailer_test.exs b/test/pleroma/emails/mailer_test.exs similarity index 100% rename from test/emails/mailer_test.exs rename to test/pleroma/emails/mailer_test.exs diff --git a/test/emails/user_email_test.exs b/test/pleroma/emails/user_email_test.exs similarity index 100% rename from test/emails/user_email_test.exs rename to test/pleroma/emails/user_email_test.exs diff --git a/test/emoji/formatter_test.exs b/test/pleroma/emoji/formatter_test.exs similarity index 100% rename from test/emoji/formatter_test.exs rename to test/pleroma/emoji/formatter_test.exs diff --git a/test/emoji/loader_test.exs b/test/pleroma/emoji/loader_test.exs similarity index 100% rename from test/emoji/loader_test.exs rename to test/pleroma/emoji/loader_test.exs diff --git a/test/emoji_test.exs b/test/pleroma/emoji_test.exs similarity index 100% rename from test/emoji_test.exs rename to test/pleroma/emoji_test.exs diff --git a/test/filter_test.exs b/test/pleroma/filter_test.exs similarity index 100% rename from test/filter_test.exs rename to test/pleroma/filter_test.exs diff --git a/test/following_relationship_test.exs b/test/pleroma/following_relationship_test.exs similarity index 100% rename from test/following_relationship_test.exs rename to test/pleroma/following_relationship_test.exs diff --git a/test/formatter_test.exs b/test/pleroma/formatter_test.exs similarity index 100% rename from test/formatter_test.exs rename to test/pleroma/formatter_test.exs diff --git a/test/healthcheck_test.exs b/test/pleroma/healthcheck_test.exs similarity index 100% rename from test/healthcheck_test.exs rename to test/pleroma/healthcheck_test.exs diff --git a/test/html_test.exs b/test/pleroma/html_test.exs similarity index 100% rename from test/html_test.exs rename to test/pleroma/html_test.exs diff --git a/test/http/adapter_helper/gun_test.exs b/test/pleroma/http/adapter_helper/gun_test.exs similarity index 100% rename from test/http/adapter_helper/gun_test.exs rename to test/pleroma/http/adapter_helper/gun_test.exs diff --git a/test/http/adapter_helper/hackney_test.exs b/test/pleroma/http/adapter_helper/hackney_test.exs similarity index 100% rename from test/http/adapter_helper/hackney_test.exs rename to test/pleroma/http/adapter_helper/hackney_test.exs diff --git a/test/http/adapter_helper_test.exs b/test/pleroma/http/adapter_helper_test.exs similarity index 100% rename from test/http/adapter_helper_test.exs rename to test/pleroma/http/adapter_helper_test.exs diff --git a/test/http/request_builder_test.exs b/test/pleroma/http/request_builder_test.exs similarity index 100% rename from test/http/request_builder_test.exs rename to test/pleroma/http/request_builder_test.exs diff --git a/test/http_test.exs b/test/pleroma/http_test.exs similarity index 100% rename from test/http_test.exs rename to test/pleroma/http_test.exs diff --git a/test/web/instances/instance_test.exs b/test/pleroma/instances/instance_test.exs similarity index 100% rename from test/web/instances/instance_test.exs rename to test/pleroma/instances/instance_test.exs diff --git a/test/web/instances/instances_test.exs b/test/pleroma/instances_test.exs similarity index 100% rename from test/web/instances/instances_test.exs rename to test/pleroma/instances_test.exs diff --git a/test/federation/federation_test.exs b/test/pleroma/integration/federation_test.exs similarity index 100% rename from test/federation/federation_test.exs rename to test/pleroma/integration/federation_test.exs diff --git a/test/integration/mastodon_websocket_test.exs b/test/pleroma/integration/mastodon_websocket_test.exs similarity index 100% rename from test/integration/mastodon_websocket_test.exs rename to test/pleroma/integration/mastodon_websocket_test.exs diff --git a/test/job_queue_monitor_test.exs b/test/pleroma/job_queue_monitor_test.exs similarity index 100% rename from test/job_queue_monitor_test.exs rename to test/pleroma/job_queue_monitor_test.exs diff --git a/test/keys_test.exs b/test/pleroma/keys_test.exs similarity index 100% rename from test/keys_test.exs rename to test/pleroma/keys_test.exs diff --git a/test/list_test.exs b/test/pleroma/list_test.exs similarity index 100% rename from test/list_test.exs rename to test/pleroma/list_test.exs diff --git a/test/marker_test.exs b/test/pleroma/marker_test.exs similarity index 100% rename from test/marker_test.exs rename to test/pleroma/marker_test.exs diff --git a/test/mfa/backup_codes_test.exs b/test/pleroma/mfa/backup_codes_test.exs similarity index 100% rename from test/mfa/backup_codes_test.exs rename to test/pleroma/mfa/backup_codes_test.exs diff --git a/test/mfa/totp_test.exs b/test/pleroma/mfa/totp_test.exs similarity index 100% rename from test/mfa/totp_test.exs rename to test/pleroma/mfa/totp_test.exs diff --git a/test/mfa_test.exs b/test/pleroma/mfa_test.exs similarity index 100% rename from test/mfa_test.exs rename to test/pleroma/mfa_test.exs diff --git a/test/migration_helper/notification_backfill_test.exs b/test/pleroma/migration_helper/notification_backfill_test.exs similarity index 100% rename from test/migration_helper/notification_backfill_test.exs rename to test/pleroma/migration_helper/notification_backfill_test.exs diff --git a/test/moderation_log_test.exs b/test/pleroma/moderation_log_test.exs similarity index 100% rename from test/moderation_log_test.exs rename to test/pleroma/moderation_log_test.exs diff --git a/test/notification_test.exs b/test/pleroma/notification_test.exs similarity index 100% rename from test/notification_test.exs rename to test/pleroma/notification_test.exs diff --git a/test/object/containment_test.exs b/test/pleroma/object/containment_test.exs similarity index 100% rename from test/object/containment_test.exs rename to test/pleroma/object/containment_test.exs diff --git a/test/object/fetcher_test.exs b/test/pleroma/object/fetcher_test.exs similarity index 100% rename from test/object/fetcher_test.exs rename to test/pleroma/object/fetcher_test.exs diff --git a/test/object_test.exs b/test/pleroma/object_test.exs similarity index 100% rename from test/object_test.exs rename to test/pleroma/object_test.exs diff --git a/test/otp_version_test.exs b/test/pleroma/otp_version_test.exs similarity index 100% rename from test/otp_version_test.exs rename to test/pleroma/otp_version_test.exs diff --git a/test/pagination_test.exs b/test/pleroma/pagination_test.exs similarity index 100% rename from test/pagination_test.exs rename to test/pleroma/pagination_test.exs diff --git a/test/registration_test.exs b/test/pleroma/registration_test.exs similarity index 100% rename from test/registration_test.exs rename to test/pleroma/registration_test.exs diff --git a/test/repo_test.exs b/test/pleroma/repo_test.exs similarity index 100% rename from test/repo_test.exs rename to test/pleroma/repo_test.exs diff --git a/test/reverse_proxy/reverse_proxy_test.exs b/test/pleroma/reverse_proxy_test.exs similarity index 100% rename from test/reverse_proxy/reverse_proxy_test.exs rename to test/pleroma/reverse_proxy_test.exs diff --git a/test/runtime_test.exs b/test/pleroma/runtime_test.exs similarity index 69% rename from test/runtime_test.exs rename to test/pleroma/runtime_test.exs index a1a6c57cd..010594fcd 100644 --- a/test/runtime_test.exs +++ b/test/pleroma/runtime_test.exs @@ -6,6 +6,7 @@ defmodule Pleroma.RuntimeTest do use ExUnit.Case, async: true test "it loads custom runtime modules" do - assert {:module, RuntimeModule} == Code.ensure_compiled(RuntimeModule) + assert {:module, Fixtures.Modules.RuntimeModule} == + Code.ensure_compiled(Fixtures.Modules.RuntimeModule) end end diff --git a/test/safe_jsonb_set_test.exs b/test/pleroma/safe_jsonb_set_test.exs similarity index 100% rename from test/safe_jsonb_set_test.exs rename to test/pleroma/safe_jsonb_set_test.exs diff --git a/test/scheduled_activity_test.exs b/test/pleroma/scheduled_activity_test.exs similarity index 100% rename from test/scheduled_activity_test.exs rename to test/pleroma/scheduled_activity_test.exs diff --git a/test/signature_test.exs b/test/pleroma/signature_test.exs similarity index 100% rename from test/signature_test.exs rename to test/pleroma/signature_test.exs diff --git a/test/stats_test.exs b/test/pleroma/stats_test.exs similarity index 100% rename from test/stats_test.exs rename to test/pleroma/stats_test.exs diff --git a/test/upload/filter/anonymize_filename_test.exs b/test/pleroma/upload/filter/anonymize_filename_test.exs similarity index 100% rename from test/upload/filter/anonymize_filename_test.exs rename to test/pleroma/upload/filter/anonymize_filename_test.exs diff --git a/test/upload/filter/dedupe_test.exs b/test/pleroma/upload/filter/dedupe_test.exs similarity index 100% rename from test/upload/filter/dedupe_test.exs rename to test/pleroma/upload/filter/dedupe_test.exs diff --git a/test/upload/filter/mogrifun_test.exs b/test/pleroma/upload/filter/mogrifun_test.exs similarity index 100% rename from test/upload/filter/mogrifun_test.exs rename to test/pleroma/upload/filter/mogrifun_test.exs diff --git a/test/upload/filter/mogrify_test.exs b/test/pleroma/upload/filter/mogrify_test.exs similarity index 100% rename from test/upload/filter/mogrify_test.exs rename to test/pleroma/upload/filter/mogrify_test.exs diff --git a/test/upload/filter_test.exs b/test/pleroma/upload/filter_test.exs similarity index 100% rename from test/upload/filter_test.exs rename to test/pleroma/upload/filter_test.exs diff --git a/test/upload_test.exs b/test/pleroma/upload_test.exs similarity index 100% rename from test/upload_test.exs rename to test/pleroma/upload_test.exs diff --git a/test/uploaders/local_test.exs b/test/pleroma/uploaders/local_test.exs similarity index 100% rename from test/uploaders/local_test.exs rename to test/pleroma/uploaders/local_test.exs diff --git a/test/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs similarity index 100% rename from test/uploaders/s3_test.exs rename to test/pleroma/uploaders/s3_test.exs diff --git a/test/user/notification_setting_test.exs b/test/pleroma/user/notification_setting_test.exs similarity index 100% rename from test/user/notification_setting_test.exs rename to test/pleroma/user/notification_setting_test.exs diff --git a/test/user_invite_token_test.exs b/test/pleroma/user_invite_token_test.exs similarity index 100% rename from test/user_invite_token_test.exs rename to test/pleroma/user_invite_token_test.exs diff --git a/test/user_relationship_test.exs b/test/pleroma/user_relationship_test.exs similarity index 100% rename from test/user_relationship_test.exs rename to test/pleroma/user_relationship_test.exs diff --git a/test/user_search_test.exs b/test/pleroma/user_search_test.exs similarity index 100% rename from test/user_search_test.exs rename to test/pleroma/user_search_test.exs diff --git a/test/user_test.exs b/test/pleroma/user_test.exs similarity index 100% rename from test/user_test.exs rename to test/pleroma/user_test.exs diff --git a/test/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs similarity index 100% rename from test/web/activity_pub/activity_pub_controller_test.exs rename to test/pleroma/web/activity_pub/activity_pub_controller_test.exs diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs similarity index 100% rename from test/web/activity_pub/activity_pub_test.exs rename to test/pleroma/web/activity_pub/activity_pub_test.exs diff --git a/test/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs b/test/pleroma/web/activity_pub/force_bot_unlisted_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs rename to test/pleroma/web/activity_pub/force_bot_unlisted_policy_test.exs diff --git a/test/web/activity_pub/mrf/activity_expiration_policy_test.exs b/test/pleroma/web/activity_pub/mrf/activity_expiration_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/activity_expiration_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/activity_expiration_policy_test.exs diff --git a/test/web/activity_pub/mrf/anti_followbot_policy_test.exs b/test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/anti_followbot_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs diff --git a/test/web/activity_pub/mrf/anti_link_spam_policy_test.exs b/test/pleroma/web/activity_pub/mrf/anti_link_spam_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/anti_link_spam_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/anti_link_spam_policy_test.exs diff --git a/test/web/activity_pub/mrf/ensure_re_prepended_test.exs b/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs similarity index 100% rename from test/web/activity_pub/mrf/ensure_re_prepended_test.exs rename to test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs diff --git a/test/web/activity_pub/mrf/hellthread_policy_test.exs b/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/hellthread_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs diff --git a/test/web/activity_pub/mrf/keyword_policy_test.exs b/test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/keyword_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs diff --git a/test/web/activity_pub/mrf/mediaproxy_warming_policy_test.exs b/test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/mediaproxy_warming_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs diff --git a/test/web/activity_pub/mrf/mention_policy_test.exs b/test/pleroma/web/activity_pub/mrf/mention_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/mention_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/mention_policy_test.exs diff --git a/test/web/activity_pub/mrf/no_placeholder_text_policy_test.exs b/test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/no_placeholder_text_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs diff --git a/test/web/activity_pub/mrf/normalize_markup_test.exs b/test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs similarity index 100% rename from test/web/activity_pub/mrf/normalize_markup_test.exs rename to test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs diff --git a/test/web/activity_pub/mrf/object_age_policy_test.exs b/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/object_age_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs diff --git a/test/web/activity_pub/mrf/reject_non_public_test.exs b/test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs similarity index 100% rename from test/web/activity_pub/mrf/reject_non_public_test.exs rename to test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs diff --git a/test/web/activity_pub/mrf/simple_policy_test.exs b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/simple_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/simple_policy_test.exs diff --git a/test/web/activity_pub/mrf/steal_emoji_policy_test.exs b/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/steal_emoji_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs diff --git a/test/web/activity_pub/mrf/subchain_policy_test.exs b/test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/subchain_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs diff --git a/test/web/activity_pub/mrf/tag_policy_test.exs b/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/tag_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/tag_policy_test.exs diff --git a/test/web/activity_pub/mrf/user_allowlist_policy_test.exs b/test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/user_allowlist_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs diff --git a/test/web/activity_pub/mrf/vocabulary_policy_test.exs b/test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs similarity index 100% rename from test/web/activity_pub/mrf/vocabulary_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs diff --git a/test/web/activity_pub/mrf/mrf_test.exs b/test/pleroma/web/activity_pub/mrf_test.exs similarity index 100% rename from test/web/activity_pub/mrf/mrf_test.exs rename to test/pleroma/web/activity_pub/mrf_test.exs diff --git a/test/web/activity_pub/pipeline_test.exs b/test/pleroma/web/activity_pub/pipeline_test.exs similarity index 100% rename from test/web/activity_pub/pipeline_test.exs rename to test/pleroma/web/activity_pub/pipeline_test.exs diff --git a/test/web/activity_pub/publisher_test.exs b/test/pleroma/web/activity_pub/publisher_test.exs similarity index 100% rename from test/web/activity_pub/publisher_test.exs rename to test/pleroma/web/activity_pub/publisher_test.exs diff --git a/test/web/activity_pub/relay_test.exs b/test/pleroma/web/activity_pub/relay_test.exs similarity index 100% rename from test/web/activity_pub/relay_test.exs rename to test/pleroma/web/activity_pub/relay_test.exs diff --git a/test/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs similarity index 100% rename from test/web/activity_pub/side_effects_test.exs rename to test/pleroma/web/activity_pub/side_effects_test.exs diff --git a/test/web/activity_pub/transmogrifier/announce_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/announce_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/chat_message_test.exs b/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/chat_message_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs diff --git a/test/web/activity_pub/transmogrifier/delete_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/delete_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/emoji_react_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/emoji_react_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/follow_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/follow_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/like_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/like_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/undo_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/undo_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier_test.exs rename to test/pleroma/web/activity_pub/transmogrifier_test.exs diff --git a/test/web/activity_pub/utils_test.exs b/test/pleroma/web/activity_pub/utils_test.exs similarity index 100% rename from test/web/activity_pub/utils_test.exs rename to test/pleroma/web/activity_pub/utils_test.exs diff --git a/test/web/activity_pub/views/object_view_test.exs b/test/pleroma/web/activity_pub/views/object_view_test.exs similarity index 100% rename from test/web/activity_pub/views/object_view_test.exs rename to test/pleroma/web/activity_pub/views/object_view_test.exs diff --git a/test/web/activity_pub/views/user_view_test.exs b/test/pleroma/web/activity_pub/views/user_view_test.exs similarity index 100% rename from test/web/activity_pub/views/user_view_test.exs rename to test/pleroma/web/activity_pub/views/user_view_test.exs diff --git a/test/web/activity_pub/visibilty_test.exs b/test/pleroma/web/activity_pub/visibility_test.exs similarity index 100% rename from test/web/activity_pub/visibilty_test.exs rename to test/pleroma/web/activity_pub/visibility_test.exs diff --git a/test/web/admin_api/controllers/admin_api_controller_test.exs b/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs similarity index 100% rename from test/web/admin_api/controllers/admin_api_controller_test.exs rename to test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs diff --git a/test/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs similarity index 100% rename from test/web/admin_api/controllers/config_controller_test.exs rename to test/pleroma/web/admin_api/controllers/config_controller_test.exs diff --git a/test/web/admin_api/controllers/invite_controller_test.exs b/test/pleroma/web/admin_api/controllers/invite_controller_test.exs similarity index 100% rename from test/web/admin_api/controllers/invite_controller_test.exs rename to test/pleroma/web/admin_api/controllers/invite_controller_test.exs diff --git a/test/web/admin_api/controllers/media_proxy_cache_controller_test.exs b/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs similarity index 100% rename from test/web/admin_api/controllers/media_proxy_cache_controller_test.exs rename to test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs diff --git a/test/web/admin_api/controllers/oauth_app_controller_test.exs b/test/pleroma/web/admin_api/controllers/oauth_app_controller_test.exs similarity index 100% rename from test/web/admin_api/controllers/oauth_app_controller_test.exs rename to test/pleroma/web/admin_api/controllers/oauth_app_controller_test.exs diff --git a/test/web/admin_api/controllers/relay_controller_test.exs b/test/pleroma/web/admin_api/controllers/relay_controller_test.exs similarity index 100% rename from test/web/admin_api/controllers/relay_controller_test.exs rename to test/pleroma/web/admin_api/controllers/relay_controller_test.exs diff --git a/test/web/admin_api/controllers/report_controller_test.exs b/test/pleroma/web/admin_api/controllers/report_controller_test.exs similarity index 100% rename from test/web/admin_api/controllers/report_controller_test.exs rename to test/pleroma/web/admin_api/controllers/report_controller_test.exs diff --git a/test/web/admin_api/controllers/status_controller_test.exs b/test/pleroma/web/admin_api/controllers/status_controller_test.exs similarity index 100% rename from test/web/admin_api/controllers/status_controller_test.exs rename to test/pleroma/web/admin_api/controllers/status_controller_test.exs diff --git a/test/web/admin_api/search_test.exs b/test/pleroma/web/admin_api/search_test.exs similarity index 100% rename from test/web/admin_api/search_test.exs rename to test/pleroma/web/admin_api/search_test.exs diff --git a/test/web/admin_api/views/report_view_test.exs b/test/pleroma/web/admin_api/views/report_view_test.exs similarity index 100% rename from test/web/admin_api/views/report_view_test.exs rename to test/pleroma/web/admin_api/views/report_view_test.exs diff --git a/test/web/api_spec/schema_examples_test.exs b/test/pleroma/web/api_spec/schema_examples_test.exs similarity index 100% rename from test/web/api_spec/schema_examples_test.exs rename to test/pleroma/web/api_spec/schema_examples_test.exs diff --git a/test/web/auth/auth_test_controller_test.exs b/test/pleroma/web/auth/auth_controller_test.exs similarity index 99% rename from test/web/auth/auth_test_controller_test.exs rename to test/pleroma/web/auth/auth_controller_test.exs index fed52b7f3..498554060 100644 --- a/test/web/auth/auth_test_controller_test.exs +++ b/test/pleroma/web/auth/auth_controller_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Tests.AuthTestControllerTest do +defmodule Pleroma.Web.Auth.AuthControllerTest do use Pleroma.Web.ConnCase import Pleroma.Factory diff --git a/test/web/auth/authenticator_test.exs b/test/pleroma/web/auth/authenticator_test.exs similarity index 100% rename from test/web/auth/authenticator_test.exs rename to test/pleroma/web/auth/authenticator_test.exs diff --git a/test/web/auth/basic_auth_test.exs b/test/pleroma/web/auth/basic_auth_test.exs similarity index 100% rename from test/web/auth/basic_auth_test.exs rename to test/pleroma/web/auth/basic_auth_test.exs diff --git a/test/web/auth/pleroma_authenticator_test.exs b/test/pleroma/web/auth/pleroma_authenticator_test.exs similarity index 100% rename from test/web/auth/pleroma_authenticator_test.exs rename to test/pleroma/web/auth/pleroma_authenticator_test.exs diff --git a/test/web/auth/totp_authenticator_test.exs b/test/pleroma/web/auth/totp_authenticator_test.exs similarity index 100% rename from test/web/auth/totp_authenticator_test.exs rename to test/pleroma/web/auth/totp_authenticator_test.exs diff --git a/test/web/chat_channel_test.exs b/test/pleroma/web/chat_channel_test.exs similarity index 100% rename from test/web/chat_channel_test.exs rename to test/pleroma/web/chat_channel_test.exs diff --git a/test/web/common_api/common_api_utils_test.exs b/test/pleroma/web/common_api/utils_test.exs similarity index 100% rename from test/web/common_api/common_api_utils_test.exs rename to test/pleroma/web/common_api/utils_test.exs diff --git a/test/web/common_api/common_api_test.exs b/test/pleroma/web/common_api_test.exs similarity index 100% rename from test/web/common_api/common_api_test.exs rename to test/pleroma/web/common_api_test.exs diff --git a/test/web/fallback_test.exs b/test/pleroma/web/fallback_test.exs similarity index 100% rename from test/web/fallback_test.exs rename to test/pleroma/web/fallback_test.exs diff --git a/test/web/federator_test.exs b/test/pleroma/web/federator_test.exs similarity index 100% rename from test/web/federator_test.exs rename to test/pleroma/web/federator_test.exs diff --git a/test/web/feed/tag_controller_test.exs b/test/pleroma/web/feed/tag_controller_test.exs similarity index 100% rename from test/web/feed/tag_controller_test.exs rename to test/pleroma/web/feed/tag_controller_test.exs diff --git a/test/web/feed/user_controller_test.exs b/test/pleroma/web/feed/user_controller_test.exs similarity index 100% rename from test/web/feed/user_controller_test.exs rename to test/pleroma/web/feed/user_controller_test.exs diff --git a/test/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/account_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/account_controller_test.exs diff --git a/test/web/mastodon_api/controllers/app_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/app_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/app_controller_test.exs diff --git a/test/web/mastodon_api/controllers/auth_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/auth_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs diff --git a/test/web/mastodon_api/controllers/conversation_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/conversation_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs diff --git a/test/web/mastodon_api/controllers/custom_emoji_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/custom_emoji_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/custom_emoji_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/custom_emoji_controller_test.exs diff --git a/test/web/mastodon_api/controllers/domain_block_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/domain_block_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/domain_block_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/domain_block_controller_test.exs diff --git a/test/web/mastodon_api/controllers/filter_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/filter_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs diff --git a/test/web/mastodon_api/controllers/follow_request_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/follow_request_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs diff --git a/test/web/mastodon_api/controllers/instance_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/instance_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs diff --git a/test/web/mastodon_api/controllers/list_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/list_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/list_controller_test.exs diff --git a/test/web/mastodon_api/controllers/marker_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/marker_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs diff --git a/test/web/mastodon_api/controllers/media_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/media_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/media_controller_test.exs diff --git a/test/web/mastodon_api/controllers/notification_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/notification_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs diff --git a/test/web/mastodon_api/controllers/poll_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/poll_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs diff --git a/test/web/mastodon_api/controllers/report_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/report_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/report_controller_test.exs diff --git a/test/web/mastodon_api/controllers/scheduled_activity_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/scheduled_activity_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs diff --git a/test/web/mastodon_api/controllers/search_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/search_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/search_controller_test.exs diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/status_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/status_controller_test.exs diff --git a/test/web/mastodon_api/controllers/subscription_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/subscription_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs diff --git a/test/web/mastodon_api/controllers/suggestion_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/suggestion_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs diff --git a/test/web/mastodon_api/controllers/timeline_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs similarity index 100% rename from test/web/mastodon_api/controllers/timeline_controller_test.exs rename to test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs diff --git a/test/web/masto_fe_controller_test.exs b/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs similarity index 97% rename from test/web/masto_fe_controller_test.exs rename to test/pleroma/web/mastodon_api/masto_fe_controller_test.exs index f3b54b5f2..ed8add8d2 100644 --- a/test/web/masto_fe_controller_test.exs +++ b/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.MastodonAPI.MastoFEController do +defmodule Pleroma.Web.MastodonAPI.MastoFEControllerTest do use Pleroma.Web.ConnCase alias Pleroma.Config diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs similarity index 100% rename from test/web/mastodon_api/mastodon_api_controller_test.exs rename to test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs diff --git a/test/web/mastodon_api/mastodon_api_test.exs b/test/pleroma/web/mastodon_api/mastodon_api_test.exs similarity index 100% rename from test/web/mastodon_api/mastodon_api_test.exs rename to test/pleroma/web/mastodon_api/mastodon_api_test.exs diff --git a/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs b/test/pleroma/web/mastodon_api/update_credentials_test.exs similarity index 99% rename from test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs rename to test/pleroma/web/mastodon_api/update_credentials_test.exs index 2e6704726..fe462caa3 100644 --- a/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs +++ b/test/pleroma/web/mastodon_api/update_credentials_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do +defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do alias Pleroma.Repo alias Pleroma.User diff --git a/test/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs similarity index 100% rename from test/web/mastodon_api/views/account_view_test.exs rename to test/pleroma/web/mastodon_api/views/account_view_test.exs diff --git a/test/web/mastodon_api/views/conversation_view_test.exs b/test/pleroma/web/mastodon_api/views/conversation_view_test.exs similarity index 100% rename from test/web/mastodon_api/views/conversation_view_test.exs rename to test/pleroma/web/mastodon_api/views/conversation_view_test.exs diff --git a/test/web/mastodon_api/views/list_view_test.exs b/test/pleroma/web/mastodon_api/views/list_view_test.exs similarity index 100% rename from test/web/mastodon_api/views/list_view_test.exs rename to test/pleroma/web/mastodon_api/views/list_view_test.exs diff --git a/test/web/mastodon_api/views/marker_view_test.exs b/test/pleroma/web/mastodon_api/views/marker_view_test.exs similarity index 100% rename from test/web/mastodon_api/views/marker_view_test.exs rename to test/pleroma/web/mastodon_api/views/marker_view_test.exs diff --git a/test/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs similarity index 100% rename from test/web/mastodon_api/views/notification_view_test.exs rename to test/pleroma/web/mastodon_api/views/notification_view_test.exs diff --git a/test/web/mastodon_api/views/poll_view_test.exs b/test/pleroma/web/mastodon_api/views/poll_view_test.exs similarity index 100% rename from test/web/mastodon_api/views/poll_view_test.exs rename to test/pleroma/web/mastodon_api/views/poll_view_test.exs diff --git a/test/web/mastodon_api/views/scheduled_activity_view_test.exs b/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs similarity index 100% rename from test/web/mastodon_api/views/scheduled_activity_view_test.exs rename to test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs diff --git a/test/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs similarity index 100% rename from test/web/mastodon_api/views/status_view_test.exs rename to test/pleroma/web/mastodon_api/views/status_view_test.exs diff --git a/test/web/mastodon_api/views/subscription_view_test.exs b/test/pleroma/web/mastodon_api/views/subscription_view_test.exs similarity index 100% rename from test/web/mastodon_api/views/subscription_view_test.exs rename to test/pleroma/web/mastodon_api/views/subscription_view_test.exs diff --git a/test/web/media_proxy/invalidations/http_test.exs b/test/pleroma/web/media_proxy/invalidation/http_test.exs similarity index 100% rename from test/web/media_proxy/invalidations/http_test.exs rename to test/pleroma/web/media_proxy/invalidation/http_test.exs diff --git a/test/web/media_proxy/invalidations/script_test.exs b/test/pleroma/web/media_proxy/invalidation/script_test.exs similarity index 100% rename from test/web/media_proxy/invalidations/script_test.exs rename to test/pleroma/web/media_proxy/invalidation/script_test.exs diff --git a/test/web/media_proxy/invalidation_test.exs b/test/pleroma/web/media_proxy/invalidation_test.exs similarity index 100% rename from test/web/media_proxy/invalidation_test.exs rename to test/pleroma/web/media_proxy/invalidation_test.exs diff --git a/test/web/media_proxy/media_proxy_controller_test.exs b/test/pleroma/web/media_proxy/media_proxy_controller_test.exs similarity index 100% rename from test/web/media_proxy/media_proxy_controller_test.exs rename to test/pleroma/web/media_proxy/media_proxy_controller_test.exs diff --git a/test/web/media_proxy/media_proxy_test.exs b/test/pleroma/web/media_proxy_test.exs similarity index 100% rename from test/web/media_proxy/media_proxy_test.exs rename to test/pleroma/web/media_proxy_test.exs diff --git a/test/web/metadata/player_view_test.exs b/test/pleroma/web/metadata/player_view_test.exs similarity index 100% rename from test/web/metadata/player_view_test.exs rename to test/pleroma/web/metadata/player_view_test.exs diff --git a/test/web/metadata/feed_test.exs b/test/pleroma/web/metadata/providers/feed_test.exs similarity index 100% rename from test/web/metadata/feed_test.exs rename to test/pleroma/web/metadata/providers/feed_test.exs diff --git a/test/web/metadata/opengraph_test.exs b/test/pleroma/web/metadata/providers/open_graph_test.exs similarity index 100% rename from test/web/metadata/opengraph_test.exs rename to test/pleroma/web/metadata/providers/open_graph_test.exs diff --git a/test/web/metadata/rel_me_test.exs b/test/pleroma/web/metadata/providers/rel_me_test.exs similarity index 100% rename from test/web/metadata/rel_me_test.exs rename to test/pleroma/web/metadata/providers/rel_me_test.exs diff --git a/test/web/metadata/restrict_indexing_test.exs b/test/pleroma/web/metadata/providers/restrict_indexing_test.exs similarity index 100% rename from test/web/metadata/restrict_indexing_test.exs rename to test/pleroma/web/metadata/providers/restrict_indexing_test.exs diff --git a/test/web/metadata/twitter_card_test.exs b/test/pleroma/web/metadata/providers/twitter_card_test.exs similarity index 100% rename from test/web/metadata/twitter_card_test.exs rename to test/pleroma/web/metadata/providers/twitter_card_test.exs diff --git a/test/web/metadata/utils_test.exs b/test/pleroma/web/metadata/utils_test.exs similarity index 100% rename from test/web/metadata/utils_test.exs rename to test/pleroma/web/metadata/utils_test.exs diff --git a/test/web/metadata/metadata_test.exs b/test/pleroma/web/metadata_test.exs similarity index 100% rename from test/web/metadata/metadata_test.exs rename to test/pleroma/web/metadata_test.exs diff --git a/test/web/mongooseim/mongoose_im_controller_test.exs b/test/pleroma/web/mongoose_im_controller_test.exs similarity index 97% rename from test/web/mongooseim/mongoose_im_controller_test.exs rename to test/pleroma/web/mongoose_im_controller_test.exs index 5176cde84..e3a8aa3d8 100644 --- a/test/web/mongooseim/mongoose_im_controller_test.exs +++ b/test/pleroma/web/mongoose_im_controller_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.MongooseIMController do +defmodule Pleroma.Web.MongooseIMControllerTest do use Pleroma.Web.ConnCase import Pleroma.Factory diff --git a/test/web/node_info_test.exs b/test/pleroma/web/node_info_test.exs similarity index 100% rename from test/web/node_info_test.exs rename to test/pleroma/web/node_info_test.exs diff --git a/test/web/oauth/app_test.exs b/test/pleroma/web/o_auth/app_test.exs similarity index 100% rename from test/web/oauth/app_test.exs rename to test/pleroma/web/o_auth/app_test.exs diff --git a/test/web/oauth/authorization_test.exs b/test/pleroma/web/o_auth/authorization_test.exs similarity index 100% rename from test/web/oauth/authorization_test.exs rename to test/pleroma/web/o_auth/authorization_test.exs diff --git a/test/web/oauth/ldap_authorization_test.exs b/test/pleroma/web/o_auth/ldap_authorization_test.exs similarity index 100% rename from test/web/oauth/ldap_authorization_test.exs rename to test/pleroma/web/o_auth/ldap_authorization_test.exs diff --git a/test/web/oauth/mfa_controller_test.exs b/test/pleroma/web/o_auth/mfa_controller_test.exs similarity index 100% rename from test/web/oauth/mfa_controller_test.exs rename to test/pleroma/web/o_auth/mfa_controller_test.exs diff --git a/test/web/oauth/oauth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs similarity index 100% rename from test/web/oauth/oauth_controller_test.exs rename to test/pleroma/web/o_auth/o_auth_controller_test.exs diff --git a/test/web/oauth/token/utils_test.exs b/test/pleroma/web/o_auth/token/utils_test.exs similarity index 100% rename from test/web/oauth/token/utils_test.exs rename to test/pleroma/web/o_auth/token/utils_test.exs diff --git a/test/web/oauth/token_test.exs b/test/pleroma/web/o_auth/token_test.exs similarity index 100% rename from test/web/oauth/token_test.exs rename to test/pleroma/web/o_auth/token_test.exs diff --git a/test/web/ostatus/ostatus_controller_test.exs b/test/pleroma/web/o_status/o_status_controller_test.exs similarity index 100% rename from test/web/ostatus/ostatus_controller_test.exs rename to test/pleroma/web/o_status/o_status_controller_test.exs diff --git a/test/web/pleroma_api/controllers/account_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs similarity index 100% rename from test/web/pleroma_api/controllers/account_controller_test.exs rename to test/pleroma/web/pleroma_api/controllers/account_controller_test.exs diff --git a/test/web/pleroma_api/controllers/chat_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs similarity index 100% rename from test/web/pleroma_api/controllers/chat_controller_test.exs rename to test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs diff --git a/test/web/pleroma_api/controllers/conversation_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs similarity index 100% rename from test/web/pleroma_api/controllers/conversation_controller_test.exs rename to test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs diff --git a/test/web/pleroma_api/controllers/emoji_pack_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs similarity index 100% rename from test/web/pleroma_api/controllers/emoji_pack_controller_test.exs rename to test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs diff --git a/test/web/pleroma_api/controllers/emoji_reaction_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs similarity index 100% rename from test/web/pleroma_api/controllers/emoji_reaction_controller_test.exs rename to test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs diff --git a/test/web/pleroma_api/controllers/mascot_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs similarity index 100% rename from test/web/pleroma_api/controllers/mascot_controller_test.exs rename to test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs diff --git a/test/web/pleroma_api/controllers/notification_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs similarity index 100% rename from test/web/pleroma_api/controllers/notification_controller_test.exs rename to test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs diff --git a/test/web/pleroma_api/controllers/scrobble_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs similarity index 100% rename from test/web/pleroma_api/controllers/scrobble_controller_test.exs rename to test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs diff --git a/test/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs similarity index 100% rename from test/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs rename to test/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs diff --git a/test/web/pleroma_api/views/chat/message_reference_view_test.exs b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs similarity index 97% rename from test/web/pleroma_api/views/chat/message_reference_view_test.exs rename to test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs index 40dbae3cd..26272c125 100644 --- a/test/web/pleroma_api/views/chat/message_reference_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.PleromaAPI.Chat.MessageReferenceViewTest do +defmodule Pleroma.Web.PleromaAPI.ChatMessageReferenceViewTest do use Pleroma.DataCase alias Pleroma.Chat diff --git a/test/web/pleroma_api/views/chat_view_test.exs b/test/pleroma/web/pleroma_api/views/chat_view_test.exs similarity index 100% rename from test/web/pleroma_api/views/chat_view_test.exs rename to test/pleroma/web/pleroma_api/views/chat_view_test.exs diff --git a/test/web/pleroma_api/views/scrobble_view_test.exs b/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs similarity index 100% rename from test/web/pleroma_api/views/scrobble_view_test.exs rename to test/pleroma/web/pleroma_api/views/scrobble_view_test.exs diff --git a/test/plugs/admin_secret_authentication_plug_test.exs b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs similarity index 96% rename from test/plugs/admin_secret_authentication_plug_test.exs rename to test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs index 14094eda8..4d35dc99c 100644 --- a/test/plugs/admin_secret_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.AdminSecretAuthenticationPlugTest do +defmodule Pleroma.Web.Plugs.AdminSecretAuthenticationPlugTest do use Pleroma.Web.ConnCase import Mock diff --git a/test/plugs/authentication_plug_test.exs b/test/pleroma/web/plugs/authentication_plug_test.exs similarity index 98% rename from test/plugs/authentication_plug_test.exs rename to test/pleroma/web/plugs/authentication_plug_test.exs index 777ae15ae..550543ff2 100644 --- a/test/plugs/authentication_plug_test.exs +++ b/test/pleroma/web/plugs/authentication_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.AuthenticationPlugTest do +defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Plugs.AuthenticationPlug diff --git a/test/plugs/basic_auth_decoder_plug_test.exs b/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs similarity index 94% rename from test/plugs/basic_auth_decoder_plug_test.exs rename to test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs index a6063d4f6..49f5ea238 100644 --- a/test/plugs/basic_auth_decoder_plug_test.exs +++ b/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.BasicAuthDecoderPlugTest do +defmodule Pleroma.Web.Plugs.BasicAuthDecoderPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Plugs.BasicAuthDecoderPlug diff --git a/test/plugs/cache_control_test.exs b/test/pleroma/web/plugs/cache_control_test.exs similarity index 92% rename from test/plugs/cache_control_test.exs rename to test/pleroma/web/plugs/cache_control_test.exs index 6b567e81d..fcf3d2be8 100644 --- a/test/plugs/cache_control_test.exs +++ b/test/pleroma/web/plugs/cache_control_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.CacheControlTest do +defmodule Pleroma.Web.Plugs.CacheControlTest do use Pleroma.Web.ConnCase alias Plug.Conn diff --git a/test/plugs/cache_test.exs b/test/pleroma/web/plugs/cache_test.exs similarity index 99% rename from test/plugs/cache_test.exs rename to test/pleroma/web/plugs/cache_test.exs index 8b231c881..105b170f0 100644 --- a/test/plugs/cache_test.exs +++ b/test/pleroma/web/plugs/cache_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.CacheTest do +defmodule Pleroma.Web.Plugs.CacheTest do use ExUnit.Case, async: true use Plug.Test diff --git a/test/plugs/ensure_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs similarity index 98% rename from test/plugs/ensure_authenticated_plug_test.exs rename to test/pleroma/web/plugs/ensure_authenticated_plug_test.exs index a0667c5e0..b87f4e103 100644 --- a/test/plugs/ensure_authenticated_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.EnsureAuthenticatedPlugTest do +defmodule Pleroma.Web.Plugs.EnsureAuthenticatedPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Plugs.EnsureAuthenticatedPlug diff --git a/test/plugs/ensure_public_or_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs similarity index 94% rename from test/plugs/ensure_public_or_authenticated_plug_test.exs rename to test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs index fc2934369..9cd5bc715 100644 --- a/test/plugs/ensure_public_or_authenticated_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.EnsurePublicOrAuthenticatedPlugTest do +defmodule Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Config diff --git a/test/plugs/ensure_user_key_plug_test.exs b/test/pleroma/web/plugs/ensure_user_key_plug_test.exs similarity index 92% rename from test/plugs/ensure_user_key_plug_test.exs rename to test/pleroma/web/plugs/ensure_user_key_plug_test.exs index 633c05447..474510101 100644 --- a/test/plugs/ensure_user_key_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_user_key_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.EnsureUserKeyPlugTest do +defmodule Pleroma.Web.Plugs.EnsureUserKeyPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Plugs.EnsureUserKeyPlug diff --git a/test/web/plugs/federating_plug_test.exs b/test/pleroma/web/plugs/federating_plug_test.exs similarity index 93% rename from test/web/plugs/federating_plug_test.exs rename to test/pleroma/web/plugs/federating_plug_test.exs index 2f8aadadc..a39fe8adb 100644 --- a/test/web/plugs/federating_plug_test.exs +++ b/test/pleroma/web/plugs/federating_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.FederatingPlugTest do +defmodule Pleroma.Web.Plugs.FederatingPlugTest do use Pleroma.Web.ConnCase setup do: clear_config([:instance, :federating]) diff --git a/test/plugs/http_security_plug_test.exs b/test/pleroma/web/plugs/http_security_plug_test.exs similarity index 100% rename from test/plugs/http_security_plug_test.exs rename to test/pleroma/web/plugs/http_security_plug_test.exs diff --git a/test/plugs/http_signature_plug_test.exs b/test/pleroma/web/plugs/http_signature_plug_test.exs similarity index 100% rename from test/plugs/http_signature_plug_test.exs rename to test/pleroma/web/plugs/http_signature_plug_test.exs diff --git a/test/plugs/idempotency_plug_test.exs b/test/pleroma/web/plugs/idempotency_plug_test.exs similarity index 98% rename from test/plugs/idempotency_plug_test.exs rename to test/pleroma/web/plugs/idempotency_plug_test.exs index 21fa0fbcf..c7b8abcaf 100644 --- a/test/plugs/idempotency_plug_test.exs +++ b/test/pleroma/web/plugs/idempotency_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.IdempotencyPlugTest do +defmodule Pleroma.Web.Plugs.IdempotencyPlugTest do use ExUnit.Case, async: true use Plug.Test diff --git a/test/plugs/instance_static_test.exs b/test/pleroma/web/plugs/instance_static_test.exs similarity index 97% rename from test/plugs/instance_static_test.exs rename to test/pleroma/web/plugs/instance_static_test.exs index d42ba817e..5b30011d3 100644 --- a/test/plugs/instance_static_test.exs +++ b/test/pleroma/web/plugs/instance_static_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.InstanceStaticPlugTest do +defmodule Pleroma.Web.Plugs.InstanceStaticTest do use Pleroma.Web.ConnCase @dir "test/tmp/instance_static" diff --git a/test/plugs/legacy_authentication_plug_test.exs b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs similarity index 97% rename from test/plugs/legacy_authentication_plug_test.exs rename to test/pleroma/web/plugs/legacy_authentication_plug_test.exs index 3b8c07627..fbb25ee7b 100644 --- a/test/plugs/legacy_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.LegacyAuthenticationPlugTest do +defmodule Pleroma.Web.Plugs.LegacyAuthenticationPlugTest do use Pleroma.Web.ConnCase import Pleroma.Factory diff --git a/test/plugs/mapped_identity_to_signature_plug_test.exs b/test/pleroma/web/plugs/mapped_signature_to_identity_plug_test.exs similarity index 100% rename from test/plugs/mapped_identity_to_signature_plug_test.exs rename to test/pleroma/web/plugs/mapped_signature_to_identity_plug_test.exs diff --git a/test/plugs/oauth_plug_test.exs b/test/pleroma/web/plugs/o_auth_plug_test.exs similarity index 98% rename from test/plugs/oauth_plug_test.exs rename to test/pleroma/web/plugs/o_auth_plug_test.exs index 9d39d3153..f4df8f4cb 100644 --- a/test/plugs/oauth_plug_test.exs +++ b/test/pleroma/web/plugs/o_auth_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.OAuthPlugTest do +defmodule Pleroma.Web.Plugs.OAuthPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Plugs.OAuthPlug diff --git a/test/plugs/oauth_scopes_plug_test.exs b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs similarity index 99% rename from test/plugs/oauth_scopes_plug_test.exs rename to test/pleroma/web/plugs/o_auth_scopes_plug_test.exs index 334316043..6a7676c8a 100644 --- a/test/plugs/oauth_scopes_plug_test.exs +++ b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.OAuthScopesPlugTest do +defmodule Pleroma.Web.Plugs.OAuthScopesPlugTest do use Pleroma.Web.ConnCase alias Pleroma.Plugs.OAuthScopesPlug diff --git a/test/web/plugs/plug_test.exs b/test/pleroma/web/plugs/plug_helper_test.exs similarity index 98% rename from test/web/plugs/plug_test.exs rename to test/pleroma/web/plugs/plug_helper_test.exs index 943e484e7..0d32031e8 100644 --- a/test/web/plugs/plug_test.exs +++ b/test/pleroma/web/plugs/plug_helper_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.PlugTest do +defmodule Pleroma.Web.Plugs.PlugHelperTest do @moduledoc "Tests for the functionality added via `use Pleroma.Web, :plug`" alias Pleroma.Plugs.ExpectAuthenticatedCheckPlug diff --git a/test/plugs/rate_limiter_test.exs b/test/pleroma/web/plugs/rate_limiter_test.exs similarity index 99% rename from test/plugs/rate_limiter_test.exs rename to test/pleroma/web/plugs/rate_limiter_test.exs index 4d3d694f4..dfc1abcbd 100644 --- a/test/plugs/rate_limiter_test.exs +++ b/test/pleroma/web/plugs/rate_limiter_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.RateLimiterTest do +defmodule Pleroma.Web.Plugs.RateLimiterTest do use Pleroma.Web.ConnCase alias Phoenix.ConnTest diff --git a/test/plugs/remote_ip_test.exs b/test/pleroma/web/plugs/remote_ip_test.exs similarity index 98% rename from test/plugs/remote_ip_test.exs rename to test/pleroma/web/plugs/remote_ip_test.exs index 6d01c812d..14c557694 100644 --- a/test/plugs/remote_ip_test.exs +++ b/test/pleroma/web/plugs/remote_ip_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.RemoteIpTest do +defmodule Pleroma.Web.Plugs.RemoteIpTest do use ExUnit.Case use Plug.Test diff --git a/test/plugs/session_authentication_plug_test.exs b/test/pleroma/web/plugs/session_authentication_plug_test.exs similarity index 95% rename from test/plugs/session_authentication_plug_test.exs rename to test/pleroma/web/plugs/session_authentication_plug_test.exs index 0949ecfed..34518414f 100644 --- a/test/plugs/session_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/session_authentication_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.SessionAuthenticationPlugTest do +defmodule Pleroma.Web.Plugs.SessionAuthenticationPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Plugs.SessionAuthenticationPlug diff --git a/test/plugs/set_format_plug_test.exs b/test/pleroma/web/plugs/set_format_plug_test.exs similarity index 94% rename from test/plugs/set_format_plug_test.exs rename to test/pleroma/web/plugs/set_format_plug_test.exs index 7a1dfe9bf..1b9ba16b1 100644 --- a/test/plugs/set_format_plug_test.exs +++ b/test/pleroma/web/plugs/set_format_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.SetFormatPlugTest do +defmodule Pleroma.Web.Plugs.SetFormatPlugTest do use ExUnit.Case, async: true use Plug.Test diff --git a/test/plugs/set_locale_plug_test.exs b/test/pleroma/web/plugs/set_locale_plug_test.exs similarity index 95% rename from test/plugs/set_locale_plug_test.exs rename to test/pleroma/web/plugs/set_locale_plug_test.exs index 7114b1557..3dc73202e 100644 --- a/test/plugs/set_locale_plug_test.exs +++ b/test/pleroma/web/plugs/set_locale_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.SetLocalePlugTest do +defmodule Pleroma.Web.Plugs.SetLocalePlugTest do use ExUnit.Case, async: true use Plug.Test diff --git a/test/plugs/set_user_session_id_plug_test.exs b/test/pleroma/web/plugs/set_user_session_id_plug_test.exs similarity index 94% rename from test/plugs/set_user_session_id_plug_test.exs rename to test/pleroma/web/plugs/set_user_session_id_plug_test.exs index 7f1a1e98b..11404c7f7 100644 --- a/test/plugs/set_user_session_id_plug_test.exs +++ b/test/pleroma/web/plugs/set_user_session_id_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.SetUserSessionIdPlugTest do +defmodule Pleroma.Web.Plugs.SetUserSessionIdPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Plugs.SetUserSessionIdPlug diff --git a/test/plugs/uploaded_media_plug_test.exs b/test/pleroma/web/plugs/uploaded_media_plug_test.exs similarity index 95% rename from test/plugs/uploaded_media_plug_test.exs rename to test/pleroma/web/plugs/uploaded_media_plug_test.exs index 20b13dfac..07f52c8cd 100644 --- a/test/plugs/uploaded_media_plug_test.exs +++ b/test/pleroma/web/plugs/uploaded_media_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.UploadedMediaPlugTest do +defmodule Pleroma.Web.Plugs.UploadedMediaPlugTest do use Pleroma.Web.ConnCase alias Pleroma.Upload diff --git a/test/plugs/user_enabled_plug_test.exs b/test/pleroma/web/plugs/user_enabled_plug_test.exs similarity index 96% rename from test/plugs/user_enabled_plug_test.exs rename to test/pleroma/web/plugs/user_enabled_plug_test.exs index b219d8abf..0a314562a 100644 --- a/test/plugs/user_enabled_plug_test.exs +++ b/test/pleroma/web/plugs/user_enabled_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.UserEnabledPlugTest do +defmodule Pleroma.Web.Plugs.UserEnabledPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Plugs.UserEnabledPlug diff --git a/test/plugs/user_fetcher_plug_test.exs b/test/pleroma/web/plugs/user_fetcher_plug_test.exs similarity index 94% rename from test/plugs/user_fetcher_plug_test.exs rename to test/pleroma/web/plugs/user_fetcher_plug_test.exs index 0496f14dd..f873d7dc8 100644 --- a/test/plugs/user_fetcher_plug_test.exs +++ b/test/pleroma/web/plugs/user_fetcher_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.UserFetcherPlugTest do +defmodule Pleroma.Web.Plugs.UserFetcherPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Plugs.UserFetcherPlug diff --git a/test/plugs/user_is_admin_plug_test.exs b/test/pleroma/web/plugs/user_is_admin_plug_test.exs similarity index 94% rename from test/plugs/user_is_admin_plug_test.exs rename to test/pleroma/web/plugs/user_is_admin_plug_test.exs index 8bc00e444..4a05675bd 100644 --- a/test/plugs/user_is_admin_plug_test.exs +++ b/test/pleroma/web/plugs/user_is_admin_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.UserIsAdminPlugTest do +defmodule Pleroma.Web.Plugs.UserIsAdminPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Plugs.UserIsAdminPlug diff --git a/test/web/push/impl_test.exs b/test/pleroma/web/push/impl_test.exs similarity index 100% rename from test/web/push/impl_test.exs rename to test/pleroma/web/push/impl_test.exs diff --git a/test/web/rel_me_test.exs b/test/pleroma/web/rel_me_test.exs similarity index 100% rename from test/web/rel_me_test.exs rename to test/pleroma/web/rel_me_test.exs diff --git a/test/web/rich_media/helpers_test.exs b/test/pleroma/web/rich_media/helpers_test.exs similarity index 100% rename from test/web/rich_media/helpers_test.exs rename to test/pleroma/web/rich_media/helpers_test.exs diff --git a/test/web/rich_media/parser_test.exs b/test/pleroma/web/rich_media/parser_test.exs similarity index 100% rename from test/web/rich_media/parser_test.exs rename to test/pleroma/web/rich_media/parser_test.exs diff --git a/test/web/rich_media/aws_signed_url_test.exs b/test/pleroma/web/rich_media/parsers/ttl/aws_signed_url_test.exs similarity index 97% rename from test/web/rich_media/aws_signed_url_test.exs rename to test/pleroma/web/rich_media/parsers/ttl/aws_signed_url_test.exs index 1ceae1a31..4a3122638 100644 --- a/test/web/rich_media/aws_signed_url_test.exs +++ b/test/pleroma/web/rich_media/parsers/ttl/aws_signed_url_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.RichMedia.TTL.AwsSignedUrlTest do +defmodule Pleroma.Web.RichMedia.Parsers.TTL.AwsSignedUrlTest do use ExUnit.Case, async: true test "s3 signed url is parsed correct for expiration time" do diff --git a/test/web/rich_media/parsers/twitter_card_test.exs b/test/pleroma/web/rich_media/parsers/twitter_card_test.exs similarity index 100% rename from test/web/rich_media/parsers/twitter_card_test.exs rename to test/pleroma/web/rich_media/parsers/twitter_card_test.exs diff --git a/test/web/static_fe/static_fe_controller_test.exs b/test/pleroma/web/static_fe/static_fe_controller_test.exs similarity index 100% rename from test/web/static_fe/static_fe_controller_test.exs rename to test/pleroma/web/static_fe/static_fe_controller_test.exs diff --git a/test/web/streamer/streamer_test.exs b/test/pleroma/web/streamer_test.exs similarity index 100% rename from test/web/streamer/streamer_test.exs rename to test/pleroma/web/streamer_test.exs diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/pleroma/web/twitter_api/controller_test.exs similarity index 100% rename from test/web/twitter_api/twitter_api_controller_test.exs rename to test/pleroma/web/twitter_api/controller_test.exs diff --git a/test/web/twitter_api/password_controller_test.exs b/test/pleroma/web/twitter_api/password_controller_test.exs similarity index 100% rename from test/web/twitter_api/password_controller_test.exs rename to test/pleroma/web/twitter_api/password_controller_test.exs diff --git a/test/web/twitter_api/remote_follow_controller_test.exs b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs similarity index 100% rename from test/web/twitter_api/remote_follow_controller_test.exs rename to test/pleroma/web/twitter_api/remote_follow_controller_test.exs diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/pleroma/web/twitter_api/twitter_api_test.exs similarity index 100% rename from test/web/twitter_api/twitter_api_test.exs rename to test/pleroma/web/twitter_api/twitter_api_test.exs diff --git a/test/web/twitter_api/util_controller_test.exs b/test/pleroma/web/twitter_api/util_controller_test.exs similarity index 100% rename from test/web/twitter_api/util_controller_test.exs rename to test/pleroma/web/twitter_api/util_controller_test.exs diff --git a/test/web/uploader_controller_test.exs b/test/pleroma/web/uploader_controller_test.exs similarity index 100% rename from test/web/uploader_controller_test.exs rename to test/pleroma/web/uploader_controller_test.exs diff --git a/test/web/views/error_view_test.exs b/test/pleroma/web/views/error_view_test.exs similarity index 100% rename from test/web/views/error_view_test.exs rename to test/pleroma/web/views/error_view_test.exs diff --git a/test/web/web_finger/web_finger_controller_test.exs b/test/pleroma/web/web_finger/web_finger_controller_test.exs similarity index 100% rename from test/web/web_finger/web_finger_controller_test.exs rename to test/pleroma/web/web_finger/web_finger_controller_test.exs diff --git a/test/web/web_finger/web_finger_test.exs b/test/pleroma/web/web_finger_test.exs similarity index 100% rename from test/web/web_finger/web_finger_test.exs rename to test/pleroma/web/web_finger_test.exs diff --git a/test/workers/cron/digest_emails_worker_test.exs b/test/pleroma/workers/cron/digest_emails_worker_test.exs similarity index 100% rename from test/workers/cron/digest_emails_worker_test.exs rename to test/pleroma/workers/cron/digest_emails_worker_test.exs diff --git a/test/workers/cron/new_users_digest_worker_test.exs b/test/pleroma/workers/cron/new_users_digest_worker_test.exs similarity index 100% rename from test/workers/cron/new_users_digest_worker_test.exs rename to test/pleroma/workers/cron/new_users_digest_worker_test.exs diff --git a/test/workers/scheduled_activity_worker_test.exs b/test/pleroma/workers/scheduled_activity_worker_test.exs similarity index 100% rename from test/workers/scheduled_activity_worker_test.exs rename to test/pleroma/workers/scheduled_activity_worker_test.exs diff --git a/test/xml_builder_test.exs b/test/pleroma/xml_builder_test.exs similarity index 100% rename from test/xml_builder_test.exs rename to test/pleroma/xml_builder_test.exs diff --git a/test/support/captcha_mock.ex b/test/support/captcha/mock.ex similarity index 100% rename from test/support/captcha_mock.ex rename to test/support/captcha/mock.ex From 103f3dcb9ed0a12a11e9cc5c574449439fc2cb0e Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 23 Jun 2020 18:33:03 +0300 Subject: [PATCH 04/62] rich media parser ttl files consistency --- lib/pleroma/web/rich_media/{parsers/ttl => parser}/ttl.ex | 2 +- .../web/rich_media/{parsers => parser}/ttl/aws_signed_url.ex | 2 +- .../rich_media/{parsers => parser}/ttl/aws_signed_url_test.exs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename lib/pleroma/web/rich_media/{parsers/ttl => parser}/ttl.ex (71%) rename lib/pleroma/web/rich_media/{parsers => parser}/ttl/aws_signed_url.ex (96%) rename test/pleroma/web/rich_media/{parsers => parser}/ttl/aws_signed_url_test.exs (97%) diff --git a/lib/pleroma/web/rich_media/parsers/ttl/ttl.ex b/lib/pleroma/web/rich_media/parser/ttl.ex similarity index 71% rename from lib/pleroma/web/rich_media/parsers/ttl/ttl.ex rename to lib/pleroma/web/rich_media/parser/ttl.ex index 13511888c..8353f0fff 100644 --- a/lib/pleroma/web/rich_media/parsers/ttl/ttl.ex +++ b/lib/pleroma/web/rich_media/parser/ttl.ex @@ -3,5 +3,5 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RichMedia.Parser.TTL do - @callback ttl(Map.t(), String.t()) :: {:ok, Integer.t()} | {:error, String.t()} + @callback ttl(Map.t(), String.t()) :: Integer.t() | nil end diff --git a/lib/pleroma/web/rich_media/parsers/ttl/aws_signed_url.ex b/lib/pleroma/web/rich_media/parser/ttl/aws_signed_url.ex similarity index 96% rename from lib/pleroma/web/rich_media/parsers/ttl/aws_signed_url.ex rename to lib/pleroma/web/rich_media/parser/ttl/aws_signed_url.ex index 15109d28d..fc4ef79c0 100644 --- a/lib/pleroma/web/rich_media/parsers/ttl/aws_signed_url.ex +++ b/lib/pleroma/web/rich_media/parser/ttl/aws_signed_url.ex @@ -5,7 +5,7 @@ defmodule Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrl do @behaviour Pleroma.Web.RichMedia.Parser.TTL - @impl Pleroma.Web.RichMedia.Parser.TTL + @impl true def ttl(data, _url) do image = Map.get(data, :image) diff --git a/test/pleroma/web/rich_media/parsers/ttl/aws_signed_url_test.exs b/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs similarity index 97% rename from test/pleroma/web/rich_media/parsers/ttl/aws_signed_url_test.exs rename to test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs index 4a3122638..2f17bebd7 100644 --- a/test/pleroma/web/rich_media/parsers/ttl/aws_signed_url_test.exs +++ b/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.RichMedia.Parsers.TTL.AwsSignedUrlTest do +defmodule Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrlTest do use ExUnit.Case, async: true test "s3 signed url is parsed correct for expiration time" do From 7acf09beb8f19ec75bd291f8e4619339c26f7109 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 23 Jun 2020 18:48:12 +0300 Subject: [PATCH 05/62] more tests --- ...h_app_controller_test.exs => o_auth_app_controller_test.exs} | 0 test/pleroma/web/pleroma_api/views/scrobble_view_test.exs | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename test/pleroma/web/admin_api/controllers/{oauth_app_controller_test.exs => o_auth_app_controller_test.exs} (100%) diff --git a/test/pleroma/web/admin_api/controllers/oauth_app_controller_test.exs b/test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs similarity index 100% rename from test/pleroma/web/admin_api/controllers/oauth_app_controller_test.exs rename to test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs diff --git a/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs b/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs index 6bdb56509..0f43cbdc3 100644 --- a/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.PleromaAPI.StatusViewTest do +defmodule Pleroma.Web.PleromaAPI.ScrobbleViewTest do use Pleroma.DataCase alias Pleroma.Web.PleromaAPI.ScrobbleView From b5b4395e4a7c63e31579475888fa892dcdaeecff Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 23 Jun 2020 19:08:19 +0300 Subject: [PATCH 06/62] oauth consistency --- lib/pleroma/plugs/{oauth_plug.ex => o_auth_plug.ex} | 0 lib/pleroma/plugs/{oauth_scopes_plug.ex => o_auth_scopes_plug.ex} | 0 .../{oauth_app_controller.ex => o_auth_app_controller.ex} | 0 .../admin/{oauth_app_operation.ex => o_auth_app_operation.ex} | 0 lib/pleroma/web/{oauth.ex => o_auth.ex} | 0 lib/pleroma/web/{oauth => o_auth}/app.ex | 0 lib/pleroma/web/{oauth => o_auth}/authorization.ex | 0 lib/pleroma/web/{oauth => o_auth}/fallback_controller.ex | 0 lib/pleroma/web/{oauth => o_auth}/mfa_controller.ex | 0 lib/pleroma/web/{oauth => o_auth}/mfa_view.ex | 0 .../{oauth/oauth_controller.ex => o_auth/o_auth_controller.ex} | 0 lib/pleroma/web/{oauth/oauth_view.ex => o_auth/o_auth_view.ex} | 0 lib/pleroma/web/{oauth => o_auth}/scopes.ex | 0 lib/pleroma/web/{oauth => o_auth}/token.ex | 0 lib/pleroma/web/{oauth => o_auth}/token/query.ex | 0 lib/pleroma/web/{oauth => o_auth}/token/strategy/refresh_token.ex | 0 lib/pleroma/web/{oauth => o_auth}/token/strategy/revoke.ex | 0 lib/pleroma/web/{oauth => o_auth}/token/utils.ex | 0 18 files changed, 0 insertions(+), 0 deletions(-) rename lib/pleroma/plugs/{oauth_plug.ex => o_auth_plug.ex} (100%) rename lib/pleroma/plugs/{oauth_scopes_plug.ex => o_auth_scopes_plug.ex} (100%) rename lib/pleroma/web/admin_api/controllers/{oauth_app_controller.ex => o_auth_app_controller.ex} (100%) rename lib/pleroma/web/api_spec/operations/admin/{oauth_app_operation.ex => o_auth_app_operation.ex} (100%) rename lib/pleroma/web/{oauth.ex => o_auth.ex} (100%) rename lib/pleroma/web/{oauth => o_auth}/app.ex (100%) rename lib/pleroma/web/{oauth => o_auth}/authorization.ex (100%) rename lib/pleroma/web/{oauth => o_auth}/fallback_controller.ex (100%) rename lib/pleroma/web/{oauth => o_auth}/mfa_controller.ex (100%) rename lib/pleroma/web/{oauth => o_auth}/mfa_view.ex (100%) rename lib/pleroma/web/{oauth/oauth_controller.ex => o_auth/o_auth_controller.ex} (100%) rename lib/pleroma/web/{oauth/oauth_view.ex => o_auth/o_auth_view.ex} (100%) rename lib/pleroma/web/{oauth => o_auth}/scopes.ex (100%) rename lib/pleroma/web/{oauth => o_auth}/token.ex (100%) rename lib/pleroma/web/{oauth => o_auth}/token/query.ex (100%) rename lib/pleroma/web/{oauth => o_auth}/token/strategy/refresh_token.ex (100%) rename lib/pleroma/web/{oauth => o_auth}/token/strategy/revoke.ex (100%) rename lib/pleroma/web/{oauth => o_auth}/token/utils.ex (100%) diff --git a/lib/pleroma/plugs/oauth_plug.ex b/lib/pleroma/plugs/o_auth_plug.ex similarity index 100% rename from lib/pleroma/plugs/oauth_plug.ex rename to lib/pleroma/plugs/o_auth_plug.ex diff --git a/lib/pleroma/plugs/oauth_scopes_plug.ex b/lib/pleroma/plugs/o_auth_scopes_plug.ex similarity index 100% rename from lib/pleroma/plugs/oauth_scopes_plug.ex rename to lib/pleroma/plugs/o_auth_scopes_plug.ex diff --git a/lib/pleroma/web/admin_api/controllers/oauth_app_controller.ex b/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex similarity index 100% rename from lib/pleroma/web/admin_api/controllers/oauth_app_controller.ex rename to lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex diff --git a/lib/pleroma/web/api_spec/operations/admin/oauth_app_operation.ex b/lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex similarity index 100% rename from lib/pleroma/web/api_spec/operations/admin/oauth_app_operation.ex rename to lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex diff --git a/lib/pleroma/web/oauth.ex b/lib/pleroma/web/o_auth.ex similarity index 100% rename from lib/pleroma/web/oauth.ex rename to lib/pleroma/web/o_auth.ex diff --git a/lib/pleroma/web/oauth/app.ex b/lib/pleroma/web/o_auth/app.ex similarity index 100% rename from lib/pleroma/web/oauth/app.ex rename to lib/pleroma/web/o_auth/app.ex diff --git a/lib/pleroma/web/oauth/authorization.ex b/lib/pleroma/web/o_auth/authorization.ex similarity index 100% rename from lib/pleroma/web/oauth/authorization.ex rename to lib/pleroma/web/o_auth/authorization.ex diff --git a/lib/pleroma/web/oauth/fallback_controller.ex b/lib/pleroma/web/o_auth/fallback_controller.ex similarity index 100% rename from lib/pleroma/web/oauth/fallback_controller.ex rename to lib/pleroma/web/o_auth/fallback_controller.ex diff --git a/lib/pleroma/web/oauth/mfa_controller.ex b/lib/pleroma/web/o_auth/mfa_controller.ex similarity index 100% rename from lib/pleroma/web/oauth/mfa_controller.ex rename to lib/pleroma/web/o_auth/mfa_controller.ex diff --git a/lib/pleroma/web/oauth/mfa_view.ex b/lib/pleroma/web/o_auth/mfa_view.ex similarity index 100% rename from lib/pleroma/web/oauth/mfa_view.ex rename to lib/pleroma/web/o_auth/mfa_view.ex diff --git a/lib/pleroma/web/oauth/oauth_controller.ex b/lib/pleroma/web/o_auth/o_auth_controller.ex similarity index 100% rename from lib/pleroma/web/oauth/oauth_controller.ex rename to lib/pleroma/web/o_auth/o_auth_controller.ex diff --git a/lib/pleroma/web/oauth/oauth_view.ex b/lib/pleroma/web/o_auth/o_auth_view.ex similarity index 100% rename from lib/pleroma/web/oauth/oauth_view.ex rename to lib/pleroma/web/o_auth/o_auth_view.ex diff --git a/lib/pleroma/web/oauth/scopes.ex b/lib/pleroma/web/o_auth/scopes.ex similarity index 100% rename from lib/pleroma/web/oauth/scopes.ex rename to lib/pleroma/web/o_auth/scopes.ex diff --git a/lib/pleroma/web/oauth/token.ex b/lib/pleroma/web/o_auth/token.ex similarity index 100% rename from lib/pleroma/web/oauth/token.ex rename to lib/pleroma/web/o_auth/token.ex diff --git a/lib/pleroma/web/oauth/token/query.ex b/lib/pleroma/web/o_auth/token/query.ex similarity index 100% rename from lib/pleroma/web/oauth/token/query.ex rename to lib/pleroma/web/o_auth/token/query.ex diff --git a/lib/pleroma/web/oauth/token/strategy/refresh_token.ex b/lib/pleroma/web/o_auth/token/strategy/refresh_token.ex similarity index 100% rename from lib/pleroma/web/oauth/token/strategy/refresh_token.ex rename to lib/pleroma/web/o_auth/token/strategy/refresh_token.ex diff --git a/lib/pleroma/web/oauth/token/strategy/revoke.ex b/lib/pleroma/web/o_auth/token/strategy/revoke.ex similarity index 100% rename from lib/pleroma/web/oauth/token/strategy/revoke.ex rename to lib/pleroma/web/o_auth/token/strategy/revoke.ex diff --git a/lib/pleroma/web/oauth/token/utils.ex b/lib/pleroma/web/o_auth/token/utils.ex similarity index 100% rename from lib/pleroma/web/oauth/token/utils.ex rename to lib/pleroma/web/o_auth/token/utils.ex From e8e4034c4879ebf0bb7fcc7606c97a3957a0ba06 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 23 Jun 2020 19:55:55 +0300 Subject: [PATCH 07/62] metadata providers consistency --- lib/pleroma/web/metadata/{ => providers}/feed.ex | 0 lib/pleroma/web/metadata/{ => providers}/opengraph.ex | 0 lib/pleroma/web/metadata/{ => providers}/provider.ex | 0 lib/pleroma/web/metadata/{ => providers}/rel_me.ex | 0 lib/pleroma/web/metadata/{ => providers}/restrict_indexing.ex | 0 lib/pleroma/web/metadata/{ => providers}/twitter_card.ex | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename lib/pleroma/web/metadata/{ => providers}/feed.ex (100%) rename lib/pleroma/web/metadata/{ => providers}/opengraph.ex (100%) rename lib/pleroma/web/metadata/{ => providers}/provider.ex (100%) rename lib/pleroma/web/metadata/{ => providers}/rel_me.ex (100%) rename lib/pleroma/web/metadata/{ => providers}/restrict_indexing.ex (100%) rename lib/pleroma/web/metadata/{ => providers}/twitter_card.ex (100%) diff --git a/lib/pleroma/web/metadata/feed.ex b/lib/pleroma/web/metadata/providers/feed.ex similarity index 100% rename from lib/pleroma/web/metadata/feed.ex rename to lib/pleroma/web/metadata/providers/feed.ex diff --git a/lib/pleroma/web/metadata/opengraph.ex b/lib/pleroma/web/metadata/providers/opengraph.ex similarity index 100% rename from lib/pleroma/web/metadata/opengraph.ex rename to lib/pleroma/web/metadata/providers/opengraph.ex diff --git a/lib/pleroma/web/metadata/provider.ex b/lib/pleroma/web/metadata/providers/provider.ex similarity index 100% rename from lib/pleroma/web/metadata/provider.ex rename to lib/pleroma/web/metadata/providers/provider.ex diff --git a/lib/pleroma/web/metadata/rel_me.ex b/lib/pleroma/web/metadata/providers/rel_me.ex similarity index 100% rename from lib/pleroma/web/metadata/rel_me.ex rename to lib/pleroma/web/metadata/providers/rel_me.ex diff --git a/lib/pleroma/web/metadata/restrict_indexing.ex b/lib/pleroma/web/metadata/providers/restrict_indexing.ex similarity index 100% rename from lib/pleroma/web/metadata/restrict_indexing.ex rename to lib/pleroma/web/metadata/providers/restrict_indexing.ex diff --git a/lib/pleroma/web/metadata/twitter_card.ex b/lib/pleroma/web/metadata/providers/twitter_card.ex similarity index 100% rename from lib/pleroma/web/metadata/twitter_card.ex rename to lib/pleroma/web/metadata/providers/twitter_card.ex From fc7151a9c4cbd2fb122d717f54de4b30acffea36 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 23 Jun 2020 20:02:53 +0300 Subject: [PATCH 08/62] more files renamings --- .../transports/web_socket/raw.ex} | 0 lib/pleroma/{web => }/web.ex | 5 ----- .../{mongooseim => mongoose_im}/mongoose_im_controller.ex | 0 .../o_status_controller.ex} | 0 lib/pleroma/web/plug.ex | 8 ++++++++ lib/pleroma/web/{push => }/push.ex | 0 .../rich_media/parsers/{oembed_parser.ex => o_embed.ex} | 0 lib/pleroma/web/{streamer => }/streamer.ex | 0 .../{twitter_api_controller.ex => controller.ex} | 0 lib/pleroma/web/{web_finger => }/web_finger.ex | 0 lib/pleroma/web/{xml => }/xml.ex | 0 lib/{ => pleroma}/xml_builder.ex | 0 12 files changed, 8 insertions(+), 5 deletions(-) rename lib/{transports.ex => phoenix/transports/web_socket/raw.ex} (100%) rename lib/pleroma/{web => }/web.ex (97%) rename lib/pleroma/web/{mongooseim => mongoose_im}/mongoose_im_controller.ex (100%) rename lib/pleroma/web/{ostatus/ostatus_controller.ex => o_status/o_status_controller.ex} (100%) create mode 100644 lib/pleroma/web/plug.ex rename lib/pleroma/web/{push => }/push.ex (100%) rename lib/pleroma/web/rich_media/parsers/{oembed_parser.ex => o_embed.ex} (100%) rename lib/pleroma/web/{streamer => }/streamer.ex (100%) rename lib/pleroma/web/twitter_api/{twitter_api_controller.ex => controller.ex} (100%) rename lib/pleroma/web/{web_finger => }/web_finger.ex (100%) rename lib/pleroma/web/{xml => }/xml.ex (100%) rename lib/{ => pleroma}/xml_builder.ex (100%) diff --git a/lib/transports.ex b/lib/phoenix/transports/web_socket/raw.ex similarity index 100% rename from lib/transports.ex rename to lib/phoenix/transports/web_socket/raw.ex diff --git a/lib/pleroma/web/web.ex b/lib/pleroma/web.ex similarity index 97% rename from lib/pleroma/web/web.ex rename to lib/pleroma/web.ex index 4f9281851..9ca52733d 100644 --- a/lib/pleroma/web/web.ex +++ b/lib/pleroma/web.ex @@ -2,11 +2,6 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.Plug do - # Substitute for `call/2` which is defined with `use Pleroma.Web, :plug` - @callback perform(Plug.Conn.t(), Plug.opts()) :: Plug.Conn.t() -end - defmodule Pleroma.Web do @moduledoc """ A module that keeps using definitions for controllers, diff --git a/lib/pleroma/web/mongooseim/mongoose_im_controller.ex b/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex similarity index 100% rename from lib/pleroma/web/mongooseim/mongoose_im_controller.ex rename to lib/pleroma/web/mongoose_im/mongoose_im_controller.ex diff --git a/lib/pleroma/web/ostatus/ostatus_controller.ex b/lib/pleroma/web/o_status/o_status_controller.ex similarity index 100% rename from lib/pleroma/web/ostatus/ostatus_controller.ex rename to lib/pleroma/web/o_status/o_status_controller.ex diff --git a/lib/pleroma/web/plug.ex b/lib/pleroma/web/plug.ex new file mode 100644 index 000000000..840b35072 --- /dev/null +++ b/lib/pleroma/web/plug.ex @@ -0,0 +1,8 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.Plug do + # Substitute for `call/2` which is defined with `use Pleroma.Web, :plug` + @callback perform(Plug.Conn.t(), Plug.opts()) :: Plug.Conn.t() +end diff --git a/lib/pleroma/web/push/push.ex b/lib/pleroma/web/push.ex similarity index 100% rename from lib/pleroma/web/push/push.ex rename to lib/pleroma/web/push.ex diff --git a/lib/pleroma/web/rich_media/parsers/oembed_parser.ex b/lib/pleroma/web/rich_media/parsers/o_embed.ex similarity index 100% rename from lib/pleroma/web/rich_media/parsers/oembed_parser.ex rename to lib/pleroma/web/rich_media/parsers/o_embed.ex diff --git a/lib/pleroma/web/streamer/streamer.ex b/lib/pleroma/web/streamer.ex similarity index 100% rename from lib/pleroma/web/streamer/streamer.ex rename to lib/pleroma/web/streamer.ex diff --git a/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/controller.ex similarity index 100% rename from lib/pleroma/web/twitter_api/twitter_api_controller.ex rename to lib/pleroma/web/twitter_api/controller.ex diff --git a/lib/pleroma/web/web_finger/web_finger.ex b/lib/pleroma/web/web_finger.ex similarity index 100% rename from lib/pleroma/web/web_finger/web_finger.ex rename to lib/pleroma/web/web_finger.ex diff --git a/lib/pleroma/web/xml/xml.ex b/lib/pleroma/web/xml.ex similarity index 100% rename from lib/pleroma/web/xml/xml.ex rename to lib/pleroma/web/xml.ex diff --git a/lib/xml_builder.ex b/lib/pleroma/xml_builder.ex similarity index 100% rename from lib/xml_builder.ex rename to lib/pleroma/xml_builder.ex From 0374df1d12a4c28fac72be9b9c0545d318c10385 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 23 Jun 2020 21:10:32 +0300 Subject: [PATCH 09/62] other files consistency --- lib/pleroma/{captcha => }/captcha.ex | 0 lib/pleroma/captcha/{captcha_service.ex => service.ex} | 0 lib/pleroma/{config => }/config_db.ex | 0 .../recipient_ship.ex} | 0 lib/pleroma/{gun => }/gun.ex | 0 lib/pleroma/{http => }/http.ex | 0 lib/pleroma/{reverse_proxy => }/reverse_proxy.ex | 0 lib/pleroma/web/{common_api => }/common_api.ex | 0 .../redirect_controller.ex} | 2 +- lib/pleroma/web/{federator => }/federator.ex | 0 lib/pleroma/web/feed/user_controller.ex | 3 +-- lib/pleroma/web/{media_proxy => }/media_proxy.ex | 0 .../web/media_proxy/{invalidations => invalidation}/http.ex | 0 .../web/media_proxy/{invalidations => invalidation}/script.ex | 0 .../web/metadata/providers/{opengraph.ex => open_graph.ex} | 0 lib/pleroma/web/o_status/o_status_controller.ex | 2 +- lib/pleroma/web/router.ex | 2 +- test/pleroma/web/feed/user_controller_test.exs | 2 +- 18 files changed, 5 insertions(+), 6 deletions(-) rename lib/pleroma/{captcha => }/captcha.ex (100%) rename lib/pleroma/captcha/{captcha_service.ex => service.ex} (100%) rename lib/pleroma/{config => }/config_db.ex (100%) rename lib/pleroma/conversation/{participation_recipient_ship.ex => participation/recipient_ship.ex} (100%) rename lib/pleroma/{gun => }/gun.ex (100%) rename lib/pleroma/{http => }/http.ex (100%) rename lib/pleroma/{reverse_proxy => }/reverse_proxy.ex (100%) rename lib/pleroma/web/{common_api => }/common_api.ex (100%) rename lib/pleroma/web/{fallback_redirect_controller.ex => fallback/redirect_controller.ex} (97%) rename lib/pleroma/web/{federator => }/federator.ex (100%) rename lib/pleroma/web/{media_proxy => }/media_proxy.ex (100%) rename lib/pleroma/web/media_proxy/{invalidations => invalidation}/http.ex (100%) rename lib/pleroma/web/media_proxy/{invalidations => invalidation}/script.ex (100%) rename lib/pleroma/web/metadata/providers/{opengraph.ex => open_graph.ex} (100%) diff --git a/lib/pleroma/captcha/captcha.ex b/lib/pleroma/captcha.ex similarity index 100% rename from lib/pleroma/captcha/captcha.ex rename to lib/pleroma/captcha.ex diff --git a/lib/pleroma/captcha/captcha_service.ex b/lib/pleroma/captcha/service.ex similarity index 100% rename from lib/pleroma/captcha/captcha_service.ex rename to lib/pleroma/captcha/service.ex diff --git a/lib/pleroma/config/config_db.ex b/lib/pleroma/config_db.ex similarity index 100% rename from lib/pleroma/config/config_db.ex rename to lib/pleroma/config_db.ex diff --git a/lib/pleroma/conversation/participation_recipient_ship.ex b/lib/pleroma/conversation/participation/recipient_ship.ex similarity index 100% rename from lib/pleroma/conversation/participation_recipient_ship.ex rename to lib/pleroma/conversation/participation/recipient_ship.ex diff --git a/lib/pleroma/gun/gun.ex b/lib/pleroma/gun.ex similarity index 100% rename from lib/pleroma/gun/gun.ex rename to lib/pleroma/gun.ex diff --git a/lib/pleroma/http/http.ex b/lib/pleroma/http.ex similarity index 100% rename from lib/pleroma/http/http.ex rename to lib/pleroma/http.ex diff --git a/lib/pleroma/reverse_proxy/reverse_proxy.ex b/lib/pleroma/reverse_proxy.ex similarity index 100% rename from lib/pleroma/reverse_proxy/reverse_proxy.ex rename to lib/pleroma/reverse_proxy.ex diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api.ex similarity index 100% rename from lib/pleroma/web/common_api/common_api.ex rename to lib/pleroma/web/common_api.ex diff --git a/lib/pleroma/web/fallback_redirect_controller.ex b/lib/pleroma/web/fallback/redirect_controller.ex similarity index 97% rename from lib/pleroma/web/fallback_redirect_controller.ex rename to lib/pleroma/web/fallback/redirect_controller.ex index 431ad5485..a7b36a34b 100644 --- a/lib/pleroma/web/fallback_redirect_controller.ex +++ b/lib/pleroma/web/fallback/redirect_controller.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Fallback.RedirectController do +defmodule Pleroma.Web.Fallback.RedirectController do use Pleroma.Web, :controller require Logger diff --git a/lib/pleroma/web/federator/federator.ex b/lib/pleroma/web/federator.ex similarity index 100% rename from lib/pleroma/web/federator/federator.ex rename to lib/pleroma/web/federator.ex diff --git a/lib/pleroma/web/feed/user_controller.ex b/lib/pleroma/web/feed/user_controller.ex index 71eb1ea7e..bea07649b 100644 --- a/lib/pleroma/web/feed/user_controller.ex +++ b/lib/pleroma/web/feed/user_controller.ex @@ -5,7 +5,6 @@ defmodule Pleroma.Web.Feed.UserController do use Pleroma.Web, :controller - alias Fallback.RedirectController alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.ActivityPub.ActivityPubController @@ -17,7 +16,7 @@ defmodule Pleroma.Web.Feed.UserController do def feed_redirect(%{assigns: %{format: "html"}} = conn, %{"nickname" => nickname}) do with {_, %User{} = user} <- {:fetch_user, User.get_cached_by_nickname_or_id(nickname)} do - RedirectController.redirector_with_meta(conn, %{user: user}) + Pleroma.Web.Fallback.RedirectController.redirector_with_meta(conn, %{user: user}) end end diff --git a/lib/pleroma/web/media_proxy/media_proxy.ex b/lib/pleroma/web/media_proxy.ex similarity index 100% rename from lib/pleroma/web/media_proxy/media_proxy.ex rename to lib/pleroma/web/media_proxy.ex diff --git a/lib/pleroma/web/media_proxy/invalidations/http.ex b/lib/pleroma/web/media_proxy/invalidation/http.ex similarity index 100% rename from lib/pleroma/web/media_proxy/invalidations/http.ex rename to lib/pleroma/web/media_proxy/invalidation/http.ex diff --git a/lib/pleroma/web/media_proxy/invalidations/script.ex b/lib/pleroma/web/media_proxy/invalidation/script.ex similarity index 100% rename from lib/pleroma/web/media_proxy/invalidations/script.ex rename to lib/pleroma/web/media_proxy/invalidation/script.ex diff --git a/lib/pleroma/web/metadata/providers/opengraph.ex b/lib/pleroma/web/metadata/providers/open_graph.ex similarity index 100% rename from lib/pleroma/web/metadata/providers/opengraph.ex rename to lib/pleroma/web/metadata/providers/open_graph.ex diff --git a/lib/pleroma/web/o_status/o_status_controller.ex b/lib/pleroma/web/o_status/o_status_controller.ex index de1b0b3f0..9a4a350ae 100644 --- a/lib/pleroma/web/o_status/o_status_controller.ex +++ b/lib/pleroma/web/o_status/o_status_controller.ex @@ -5,7 +5,6 @@ defmodule Pleroma.Web.OStatus.OStatusController do use Pleroma.Web, :controller - alias Fallback.RedirectController alias Pleroma.Activity alias Pleroma.Object alias Pleroma.Plugs.RateLimiter @@ -13,6 +12,7 @@ defmodule Pleroma.Web.OStatus.OStatusController do alias Pleroma.Web.ActivityPub.ActivityPubController alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.Endpoint + alias Pleroma.Web.Fallback.Fallback.RedirectController alias Pleroma.Web.Metadata.PlayerView alias Pleroma.Web.Router diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index e22b31b4c..48bb834b9 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -737,7 +737,7 @@ defmodule Pleroma.Web.Router do get("/check_password", MongooseIMController, :check_password) end - scope "/", Fallback do + scope "/", Pleroma.Web.Fallback do get("/registration/:token", RedirectController, :registration_page) get("/:maybe_nickname_or_id", RedirectController, :redirector_with_meta) get("/api*path", RedirectController, :api_not_implemented) diff --git a/test/pleroma/web/feed/user_controller_test.exs b/test/pleroma/web/feed/user_controller_test.exs index 9a5610baa..a5dc0894b 100644 --- a/test/pleroma/web/feed/user_controller_test.exs +++ b/test/pleroma/web/feed/user_controller_test.exs @@ -206,7 +206,7 @@ test "with html format, it redirects to user feed", %{conn: conn} do |> response(200) assert response == - Fallback.RedirectController.redirector_with_meta( + Pleroma.Web.Fallback.RedirectController.redirector_with_meta( conn, %{user: user} ).resp_body From 2501793f819813d792fdae493fb0f1e65c6cc7b3 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 08:35:22 +0300 Subject: [PATCH 10/62] moving plugs into web dir --- lib/pleroma/{ => web}/plugs/admin_secret_authentication_plug.ex | 0 lib/pleroma/{ => web}/plugs/authentication_plug.ex | 0 lib/pleroma/{ => web}/plugs/basic_auth_decoder_plug.ex | 0 lib/pleroma/{ => web}/plugs/cache.ex | 0 lib/pleroma/{ => web}/plugs/digest.ex | 0 lib/pleroma/{ => web}/plugs/ensure_authenticated_plug.ex | 0 .../{ => web}/plugs/ensure_public_or_authenticated_plug.ex | 0 lib/pleroma/{ => web}/plugs/ensure_user_key_plug.ex | 0 lib/pleroma/{ => web}/plugs/expect_authenticated_check_plug.ex | 0 .../{ => web}/plugs/expect_public_or_authenticated_check_plug.ex | 0 lib/pleroma/{ => web}/plugs/federating_plug.ex | 0 lib/pleroma/{ => web}/plugs/http_security_plug.ex | 0 lib/pleroma/{ => web}/plugs/http_signature.ex | 0 lib/pleroma/{ => web}/plugs/idempotency_plug.ex | 0 lib/pleroma/{ => web}/plugs/instance_static.ex | 0 lib/pleroma/{ => web}/plugs/legacy_authentication_plug.ex | 0 lib/pleroma/{ => web}/plugs/mapped_signature_to_identity_plug.ex | 0 lib/pleroma/{ => web}/plugs/o_auth_plug.ex | 0 lib/pleroma/{ => web}/plugs/o_auth_scopes_plug.ex | 0 lib/pleroma/{ => web}/plugs/plug_helper.ex | 0 lib/pleroma/{plugs/rate_limiter => web/plugs}/rate_limiter.ex | 0 lib/pleroma/{ => web}/plugs/rate_limiter/limiter_supervisor.ex | 0 lib/pleroma/{ => web}/plugs/rate_limiter/supervisor.ex | 0 lib/pleroma/{ => web}/plugs/remote_ip.ex | 0 lib/pleroma/{ => web}/plugs/session_authentication_plug.ex | 0 lib/pleroma/{ => web}/plugs/set_format_plug.ex | 0 lib/pleroma/{ => web}/plugs/set_locale_plug.ex | 0 lib/pleroma/{ => web}/plugs/set_user_session_id_plug.ex | 0 lib/pleroma/{ => web}/plugs/static_fe_plug.ex | 0 lib/pleroma/{ => web}/plugs/trailing_format_plug.ex | 0 lib/pleroma/{ => web}/plugs/uploaded_media.ex | 0 lib/pleroma/{ => web}/plugs/user_enabled_plug.ex | 0 lib/pleroma/{ => web}/plugs/user_fetcher_plug.ex | 0 lib/pleroma/{ => web}/plugs/user_is_admin_plug.ex | 0 34 files changed, 0 insertions(+), 0 deletions(-) rename lib/pleroma/{ => web}/plugs/admin_secret_authentication_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/authentication_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/basic_auth_decoder_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/cache.ex (100%) rename lib/pleroma/{ => web}/plugs/digest.ex (100%) rename lib/pleroma/{ => web}/plugs/ensure_authenticated_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/ensure_public_or_authenticated_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/ensure_user_key_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/expect_authenticated_check_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/expect_public_or_authenticated_check_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/federating_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/http_security_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/http_signature.ex (100%) rename lib/pleroma/{ => web}/plugs/idempotency_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/instance_static.ex (100%) rename lib/pleroma/{ => web}/plugs/legacy_authentication_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/mapped_signature_to_identity_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/o_auth_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/o_auth_scopes_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/plug_helper.ex (100%) rename lib/pleroma/{plugs/rate_limiter => web/plugs}/rate_limiter.ex (100%) rename lib/pleroma/{ => web}/plugs/rate_limiter/limiter_supervisor.ex (100%) rename lib/pleroma/{ => web}/plugs/rate_limiter/supervisor.ex (100%) rename lib/pleroma/{ => web}/plugs/remote_ip.ex (100%) rename lib/pleroma/{ => web}/plugs/session_authentication_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/set_format_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/set_locale_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/set_user_session_id_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/static_fe_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/trailing_format_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/uploaded_media.ex (100%) rename lib/pleroma/{ => web}/plugs/user_enabled_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/user_fetcher_plug.ex (100%) rename lib/pleroma/{ => web}/plugs/user_is_admin_plug.ex (100%) diff --git a/lib/pleroma/plugs/admin_secret_authentication_plug.ex b/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex similarity index 100% rename from lib/pleroma/plugs/admin_secret_authentication_plug.ex rename to lib/pleroma/web/plugs/admin_secret_authentication_plug.ex diff --git a/lib/pleroma/plugs/authentication_plug.ex b/lib/pleroma/web/plugs/authentication_plug.ex similarity index 100% rename from lib/pleroma/plugs/authentication_plug.ex rename to lib/pleroma/web/plugs/authentication_plug.ex diff --git a/lib/pleroma/plugs/basic_auth_decoder_plug.ex b/lib/pleroma/web/plugs/basic_auth_decoder_plug.ex similarity index 100% rename from lib/pleroma/plugs/basic_auth_decoder_plug.ex rename to lib/pleroma/web/plugs/basic_auth_decoder_plug.ex diff --git a/lib/pleroma/plugs/cache.ex b/lib/pleroma/web/plugs/cache.ex similarity index 100% rename from lib/pleroma/plugs/cache.ex rename to lib/pleroma/web/plugs/cache.ex diff --git a/lib/pleroma/plugs/digest.ex b/lib/pleroma/web/plugs/digest.ex similarity index 100% rename from lib/pleroma/plugs/digest.ex rename to lib/pleroma/web/plugs/digest.ex diff --git a/lib/pleroma/plugs/ensure_authenticated_plug.ex b/lib/pleroma/web/plugs/ensure_authenticated_plug.ex similarity index 100% rename from lib/pleroma/plugs/ensure_authenticated_plug.ex rename to lib/pleroma/web/plugs/ensure_authenticated_plug.ex diff --git a/lib/pleroma/plugs/ensure_public_or_authenticated_plug.ex b/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex similarity index 100% rename from lib/pleroma/plugs/ensure_public_or_authenticated_plug.ex rename to lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex diff --git a/lib/pleroma/plugs/ensure_user_key_plug.ex b/lib/pleroma/web/plugs/ensure_user_key_plug.ex similarity index 100% rename from lib/pleroma/plugs/ensure_user_key_plug.ex rename to lib/pleroma/web/plugs/ensure_user_key_plug.ex diff --git a/lib/pleroma/plugs/expect_authenticated_check_plug.ex b/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex similarity index 100% rename from lib/pleroma/plugs/expect_authenticated_check_plug.ex rename to lib/pleroma/web/plugs/expect_authenticated_check_plug.ex diff --git a/lib/pleroma/plugs/expect_public_or_authenticated_check_plug.ex b/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex similarity index 100% rename from lib/pleroma/plugs/expect_public_or_authenticated_check_plug.ex rename to lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex diff --git a/lib/pleroma/plugs/federating_plug.ex b/lib/pleroma/web/plugs/federating_plug.ex similarity index 100% rename from lib/pleroma/plugs/federating_plug.ex rename to lib/pleroma/web/plugs/federating_plug.ex diff --git a/lib/pleroma/plugs/http_security_plug.ex b/lib/pleroma/web/plugs/http_security_plug.ex similarity index 100% rename from lib/pleroma/plugs/http_security_plug.ex rename to lib/pleroma/web/plugs/http_security_plug.ex diff --git a/lib/pleroma/plugs/http_signature.ex b/lib/pleroma/web/plugs/http_signature.ex similarity index 100% rename from lib/pleroma/plugs/http_signature.ex rename to lib/pleroma/web/plugs/http_signature.ex diff --git a/lib/pleroma/plugs/idempotency_plug.ex b/lib/pleroma/web/plugs/idempotency_plug.ex similarity index 100% rename from lib/pleroma/plugs/idempotency_plug.ex rename to lib/pleroma/web/plugs/idempotency_plug.ex diff --git a/lib/pleroma/plugs/instance_static.ex b/lib/pleroma/web/plugs/instance_static.ex similarity index 100% rename from lib/pleroma/plugs/instance_static.ex rename to lib/pleroma/web/plugs/instance_static.ex diff --git a/lib/pleroma/plugs/legacy_authentication_plug.ex b/lib/pleroma/web/plugs/legacy_authentication_plug.ex similarity index 100% rename from lib/pleroma/plugs/legacy_authentication_plug.ex rename to lib/pleroma/web/plugs/legacy_authentication_plug.ex diff --git a/lib/pleroma/plugs/mapped_signature_to_identity_plug.ex b/lib/pleroma/web/plugs/mapped_signature_to_identity_plug.ex similarity index 100% rename from lib/pleroma/plugs/mapped_signature_to_identity_plug.ex rename to lib/pleroma/web/plugs/mapped_signature_to_identity_plug.ex diff --git a/lib/pleroma/plugs/o_auth_plug.ex b/lib/pleroma/web/plugs/o_auth_plug.ex similarity index 100% rename from lib/pleroma/plugs/o_auth_plug.ex rename to lib/pleroma/web/plugs/o_auth_plug.ex diff --git a/lib/pleroma/plugs/o_auth_scopes_plug.ex b/lib/pleroma/web/plugs/o_auth_scopes_plug.ex similarity index 100% rename from lib/pleroma/plugs/o_auth_scopes_plug.ex rename to lib/pleroma/web/plugs/o_auth_scopes_plug.ex diff --git a/lib/pleroma/plugs/plug_helper.ex b/lib/pleroma/web/plugs/plug_helper.ex similarity index 100% rename from lib/pleroma/plugs/plug_helper.ex rename to lib/pleroma/web/plugs/plug_helper.ex diff --git a/lib/pleroma/plugs/rate_limiter/rate_limiter.ex b/lib/pleroma/web/plugs/rate_limiter.ex similarity index 100% rename from lib/pleroma/plugs/rate_limiter/rate_limiter.ex rename to lib/pleroma/web/plugs/rate_limiter.ex diff --git a/lib/pleroma/plugs/rate_limiter/limiter_supervisor.ex b/lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex similarity index 100% rename from lib/pleroma/plugs/rate_limiter/limiter_supervisor.ex rename to lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex diff --git a/lib/pleroma/plugs/rate_limiter/supervisor.ex b/lib/pleroma/web/plugs/rate_limiter/supervisor.ex similarity index 100% rename from lib/pleroma/plugs/rate_limiter/supervisor.ex rename to lib/pleroma/web/plugs/rate_limiter/supervisor.ex diff --git a/lib/pleroma/plugs/remote_ip.ex b/lib/pleroma/web/plugs/remote_ip.ex similarity index 100% rename from lib/pleroma/plugs/remote_ip.ex rename to lib/pleroma/web/plugs/remote_ip.ex diff --git a/lib/pleroma/plugs/session_authentication_plug.ex b/lib/pleroma/web/plugs/session_authentication_plug.ex similarity index 100% rename from lib/pleroma/plugs/session_authentication_plug.ex rename to lib/pleroma/web/plugs/session_authentication_plug.ex diff --git a/lib/pleroma/plugs/set_format_plug.ex b/lib/pleroma/web/plugs/set_format_plug.ex similarity index 100% rename from lib/pleroma/plugs/set_format_plug.ex rename to lib/pleroma/web/plugs/set_format_plug.ex diff --git a/lib/pleroma/plugs/set_locale_plug.ex b/lib/pleroma/web/plugs/set_locale_plug.ex similarity index 100% rename from lib/pleroma/plugs/set_locale_plug.ex rename to lib/pleroma/web/plugs/set_locale_plug.ex diff --git a/lib/pleroma/plugs/set_user_session_id_plug.ex b/lib/pleroma/web/plugs/set_user_session_id_plug.ex similarity index 100% rename from lib/pleroma/plugs/set_user_session_id_plug.ex rename to lib/pleroma/web/plugs/set_user_session_id_plug.ex diff --git a/lib/pleroma/plugs/static_fe_plug.ex b/lib/pleroma/web/plugs/static_fe_plug.ex similarity index 100% rename from lib/pleroma/plugs/static_fe_plug.ex rename to lib/pleroma/web/plugs/static_fe_plug.ex diff --git a/lib/pleroma/plugs/trailing_format_plug.ex b/lib/pleroma/web/plugs/trailing_format_plug.ex similarity index 100% rename from lib/pleroma/plugs/trailing_format_plug.ex rename to lib/pleroma/web/plugs/trailing_format_plug.ex diff --git a/lib/pleroma/plugs/uploaded_media.ex b/lib/pleroma/web/plugs/uploaded_media.ex similarity index 100% rename from lib/pleroma/plugs/uploaded_media.ex rename to lib/pleroma/web/plugs/uploaded_media.ex diff --git a/lib/pleroma/plugs/user_enabled_plug.ex b/lib/pleroma/web/plugs/user_enabled_plug.ex similarity index 100% rename from lib/pleroma/plugs/user_enabled_plug.ex rename to lib/pleroma/web/plugs/user_enabled_plug.ex diff --git a/lib/pleroma/plugs/user_fetcher_plug.ex b/lib/pleroma/web/plugs/user_fetcher_plug.ex similarity index 100% rename from lib/pleroma/plugs/user_fetcher_plug.ex rename to lib/pleroma/web/plugs/user_fetcher_plug.ex diff --git a/lib/pleroma/plugs/user_is_admin_plug.ex b/lib/pleroma/web/plugs/user_is_admin_plug.ex similarity index 100% rename from lib/pleroma/plugs/user_is_admin_plug.ex rename to lib/pleroma/web/plugs/user_is_admin_plug.ex From 6a87f94ee275c00c625e5778aca11c8e7324d07a Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 08:38:42 +0300 Subject: [PATCH 11/62] renaming ratelimiter supervisor --- lib/pleroma/application.ex | 2 +- lib/pleroma/web/plugs/rate_limiter/supervisor.ex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index e73d89350..0f39c7d92 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -88,7 +88,7 @@ def start(_type, _args) do Pleroma.Repo, Config.TransferTask, Pleroma.Emoji, - Pleroma.Plugs.RateLimiter.Supervisor + Pleroma.Web.Plugs.RateLimiter.Supervisor ] ++ cachex_children() ++ http_children(adapter, @env) ++ diff --git a/lib/pleroma/web/plugs/rate_limiter/supervisor.ex b/lib/pleroma/web/plugs/rate_limiter/supervisor.ex index ce196df52..1c4d0606f 100644 --- a/lib/pleroma/web/plugs/rate_limiter/supervisor.ex +++ b/lib/pleroma/web/plugs/rate_limiter/supervisor.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.RateLimiter.Supervisor do +defmodule Pleroma.Web.Plugs.RateLimiter.Supervisor do use Supervisor def start_link(opts) do From e267991a44e5f7670e34297d870a889bbacdb97a Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 08:39:56 +0300 Subject: [PATCH 12/62] renaming LimiterSupervisor --- lib/pleroma/web/plugs/rate_limiter.ex | 2 +- lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex | 2 +- lib/pleroma/web/plugs/rate_limiter/supervisor.ex | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/plugs/rate_limiter.ex b/lib/pleroma/web/plugs/rate_limiter.ex index c51e2c634..d4a707675 100644 --- a/lib/pleroma/web/plugs/rate_limiter.ex +++ b/lib/pleroma/web/plugs/rate_limiter.ex @@ -67,7 +67,7 @@ defmodule Pleroma.Plugs.RateLimiter do import Plug.Conn alias Pleroma.Config - alias Pleroma.Plugs.RateLimiter.LimiterSupervisor + alias Pleroma.Web.Plugs.RateLimiter.LimiterSupervisor alias Pleroma.User require Logger diff --git a/lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex b/lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex index 0bf5aadfb..5642bb205 100644 --- a/lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex +++ b/lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.RateLimiter.LimiterSupervisor do +defmodule Pleroma.Web.Plugs.RateLimiter.LimiterSupervisor do use DynamicSupervisor import Cachex.Spec diff --git a/lib/pleroma/web/plugs/rate_limiter/supervisor.ex b/lib/pleroma/web/plugs/rate_limiter/supervisor.ex index 1c4d0606f..a1c84063d 100644 --- a/lib/pleroma/web/plugs/rate_limiter/supervisor.ex +++ b/lib/pleroma/web/plugs/rate_limiter/supervisor.ex @@ -11,7 +11,7 @@ def start_link(opts) do def init(_args) do children = [ - Pleroma.Plugs.RateLimiter.LimiterSupervisor + Pleroma.Web.Plugs.RateLimiter.LimiterSupervisor ] opts = [strategy: :one_for_one, name: Pleroma.Web.Streamer.Supervisor] From 2125286e90d75ad3bbe62bd897412e6a5599ff46 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 08:43:20 +0300 Subject: [PATCH 13/62] fix for fallback controller --- lib/pleroma/web/o_status/o_status_controller.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/o_status/o_status_controller.ex b/lib/pleroma/web/o_status/o_status_controller.ex index 9a4a350ae..329ab64e0 100644 --- a/lib/pleroma/web/o_status/o_status_controller.ex +++ b/lib/pleroma/web/o_status/o_status_controller.ex @@ -12,7 +12,7 @@ defmodule Pleroma.Web.OStatus.OStatusController do alias Pleroma.Web.ActivityPub.ActivityPubController alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.Endpoint - alias Pleroma.Web.Fallback.Fallback.RedirectController + alias Pleroma.Web.Fallback.RedirectController alias Pleroma.Web.Metadata.PlayerView alias Pleroma.Web.Router From 1d16cd0c3dcebe3d0b1f372f81181de7d0ee9b63 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 08:59:35 +0300 Subject: [PATCH 14/62] UserIsAdminPlug module name --- lib/pleroma/web/plugs/user_is_admin_plug.ex | 2 +- lib/pleroma/web/router.ex | 2 +- test/pleroma/web/plugs/user_is_admin_plug_test.exs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/plugs/user_is_admin_plug.ex b/lib/pleroma/web/plugs/user_is_admin_plug.ex index 488a61d1d..531c965f0 100644 --- a/lib/pleroma/web/plugs/user_is_admin_plug.ex +++ b/lib/pleroma/web/plugs/user_is_admin_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.UserIsAdminPlug do +defmodule Pleroma.Web.Plugs.UserIsAdminPlug do import Pleroma.Web.TranslationHelpers import Plug.Conn diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 48bb834b9..a8a40b56a 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -67,7 +67,7 @@ defmodule Pleroma.Web.Router do plug(Pleroma.Plugs.AdminSecretAuthenticationPlug) plug(:after_auth) plug(Pleroma.Plugs.EnsureAuthenticatedPlug) - plug(Pleroma.Plugs.UserIsAdminPlug) + plug(Pleroma.Web.Plugs.UserIsAdminPlug) plug(Pleroma.Plugs.IdempotencyPlug) end diff --git a/test/pleroma/web/plugs/user_is_admin_plug_test.exs b/test/pleroma/web/plugs/user_is_admin_plug_test.exs index 4a05675bd..b550568c1 100644 --- a/test/pleroma/web/plugs/user_is_admin_plug_test.exs +++ b/test/pleroma/web/plugs/user_is_admin_plug_test.exs @@ -5,7 +5,7 @@ defmodule Pleroma.Web.Plugs.UserIsAdminPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.UserIsAdminPlug + alias Pleroma.Web.Plugs.UserIsAdminPlug import Pleroma.Factory test "accepts a user that is an admin" do From 61c609884cc9fb24049da24159d2e3d2025026a3 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:00:44 +0300 Subject: [PATCH 15/62] UserFetcherPlug module name --- lib/pleroma/web/plugs/user_fetcher_plug.ex | 2 +- lib/pleroma/web/router.ex | 2 +- test/pleroma/web/plugs/user_fetcher_plug_test.exs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/plugs/user_fetcher_plug.ex b/lib/pleroma/web/plugs/user_fetcher_plug.ex index 235c77d85..4039600da 100644 --- a/lib/pleroma/web/plugs/user_fetcher_plug.ex +++ b/lib/pleroma/web/plugs/user_fetcher_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.UserFetcherPlug do +defmodule Pleroma.Web.Plugs.UserFetcherPlug do alias Pleroma.User import Plug.Conn diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index a8a40b56a..bdf80216c 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -27,7 +27,7 @@ defmodule Pleroma.Web.Router do pipeline :authenticate do plug(Pleroma.Plugs.OAuthPlug) plug(Pleroma.Plugs.BasicAuthDecoderPlug) - plug(Pleroma.Plugs.UserFetcherPlug) + plug(Pleroma.Web.Plugs.UserFetcherPlug) plug(Pleroma.Plugs.SessionAuthenticationPlug) plug(Pleroma.Plugs.LegacyAuthenticationPlug) plug(Pleroma.Plugs.AuthenticationPlug) diff --git a/test/pleroma/web/plugs/user_fetcher_plug_test.exs b/test/pleroma/web/plugs/user_fetcher_plug_test.exs index f873d7dc8..b4f875d2d 100644 --- a/test/pleroma/web/plugs/user_fetcher_plug_test.exs +++ b/test/pleroma/web/plugs/user_fetcher_plug_test.exs @@ -5,7 +5,7 @@ defmodule Pleroma.Web.Plugs.UserFetcherPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.UserFetcherPlug + alias Pleroma.Web.Plugs.UserFetcherPlug import Pleroma.Factory setup do From ebd6dd7c53db0799c2a6fc0d5602eced9541033e Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:02:27 +0300 Subject: [PATCH 16/62] UserEnabledPlug module name --- lib/pleroma/web/plugs/user_enabled_plug.ex | 2 +- lib/pleroma/web/router.ex | 4 ++-- test/pleroma/web/plugs/user_enabled_plug_test.exs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/plugs/user_enabled_plug.ex b/lib/pleroma/web/plugs/user_enabled_plug.ex index 23e800a74..fa28ee48b 100644 --- a/lib/pleroma/web/plugs/user_enabled_plug.ex +++ b/lib/pleroma/web/plugs/user_enabled_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.UserEnabledPlug do +defmodule Pleroma.Web.Plugs.UserEnabledPlug do import Plug.Conn alias Pleroma.User diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index bdf80216c..938809819 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -13,7 +13,7 @@ defmodule Pleroma.Web.Router do pipeline :oauth do plug(:fetch_session) plug(Pleroma.Plugs.OAuthPlug) - plug(Pleroma.Plugs.UserEnabledPlug) + plug(Pleroma.Web.Plugs.UserEnabledPlug) end pipeline :expect_authentication do @@ -34,7 +34,7 @@ defmodule Pleroma.Web.Router do end pipeline :after_auth do - plug(Pleroma.Plugs.UserEnabledPlug) + plug(Pleroma.Web.Plugs.UserEnabledPlug) plug(Pleroma.Plugs.SetUserSessionIdPlug) plug(Pleroma.Plugs.EnsureUserKeyPlug) end diff --git a/test/pleroma/web/plugs/user_enabled_plug_test.exs b/test/pleroma/web/plugs/user_enabled_plug_test.exs index 0a314562a..71c56f03a 100644 --- a/test/pleroma/web/plugs/user_enabled_plug_test.exs +++ b/test/pleroma/web/plugs/user_enabled_plug_test.exs @@ -5,7 +5,7 @@ defmodule Pleroma.Web.Plugs.UserEnabledPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.UserEnabledPlug + alias Pleroma.Web.Plugs.UserEnabledPlug import Pleroma.Factory setup do: clear_config([:instance, :account_activation_required]) From a5987155f70352b76728aad49536c7d298bb30f2 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:03:48 +0300 Subject: [PATCH 17/62] UploadedMedia module name --- lib/pleroma/uploaders/uploader.ex | 2 +- lib/pleroma/web/endpoint.ex | 2 +- lib/pleroma/web/plugs/uploaded_media.ex | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/uploaders/uploader.ex b/lib/pleroma/uploaders/uploader.ex index 9a94534e9..6249eceb1 100644 --- a/lib/pleroma/uploaders/uploader.ex +++ b/lib/pleroma/uploaders/uploader.ex @@ -12,7 +12,7 @@ defmodule Pleroma.Uploaders.Uploader do @doc """ Instructs how to get the file from the backend. - Used by `Pleroma.Plugs.UploadedMedia`. + Used by `Pleroma.Web.Plugs.UploadedMedia`. """ @type get_method :: {:static_dir, directory :: String.t()} | {:url, url :: String.t()} @callback get_file(file :: String.t()) :: {:ok, get_method()} diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index 8b153763d..d147f7145 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -12,7 +12,7 @@ defmodule Pleroma.Web.Endpoint do plug(Pleroma.Plugs.SetLocalePlug) plug(CORSPlug) plug(Pleroma.Plugs.HTTPSecurityPlug) - plug(Pleroma.Plugs.UploadedMedia) + plug(Pleroma.Web.Plugs.UploadedMedia) @static_cache_control "public, no-cache" diff --git a/lib/pleroma/web/plugs/uploaded_media.ex b/lib/pleroma/web/plugs/uploaded_media.ex index 40984cfc0..402a8bb34 100644 --- a/lib/pleroma/web/plugs/uploaded_media.ex +++ b/lib/pleroma/web/plugs/uploaded_media.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.UploadedMedia do +defmodule Pleroma.Web.Plugs.UploadedMedia do @moduledoc """ """ From a07688deb10fa8fa544cc3db2fd0e0366608e372 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:05:23 +0300 Subject: [PATCH 18/62] TrailingFormatPlug module name --- lib/pleroma/web/endpoint.ex | 2 +- lib/pleroma/web/plugs/trailing_format_plug.ex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index d147f7145..3543d0b3b 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -79,7 +79,7 @@ defmodule Pleroma.Web.Endpoint do plug(Phoenix.CodeReloader) end - plug(Pleroma.Plugs.TrailingFormatPlug) + plug(Pleroma.Web.Plugs.TrailingFormatPlug) plug(Plug.RequestId) plug(Plug.Logger, log: :debug) diff --git a/lib/pleroma/web/plugs/trailing_format_plug.ex b/lib/pleroma/web/plugs/trailing_format_plug.ex index 8b4d5fc9f..e3f57c14a 100644 --- a/lib/pleroma/web/plugs/trailing_format_plug.ex +++ b/lib/pleroma/web/plugs/trailing_format_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.TrailingFormatPlug do +defmodule Pleroma.Web.Plugs.TrailingFormatPlug do @moduledoc "Calls TrailingFormatPlug for specific paths. Ideally we would just do this in the router, but TrailingFormatPlug needs to be called before Plug.Parsers." @behaviour Plug From d36c9e210a75805753b664d005a8056529af562e Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:06:10 +0300 Subject: [PATCH 19/62] StaticFEPlug module name --- lib/pleroma/web/plugs/static_fe_plug.ex | 2 +- lib/pleroma/web/router.ex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/plugs/static_fe_plug.ex b/lib/pleroma/web/plugs/static_fe_plug.ex index 143665c71..658a1052e 100644 --- a/lib/pleroma/web/plugs/static_fe_plug.ex +++ b/lib/pleroma/web/plugs/static_fe_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.StaticFEPlug do +defmodule Pleroma.Web.Plugs.StaticFEPlug do import Plug.Conn alias Pleroma.Web.StaticFE.StaticFEController diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 938809819..f7e6cc4f3 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -568,7 +568,7 @@ defmodule Pleroma.Web.Router do pipeline :ostatus do plug(:accepts, ["html", "xml", "rss", "atom", "activity+json", "json"]) - plug(Pleroma.Plugs.StaticFEPlug) + plug(Pleroma.Web.Plugs.StaticFEPlug) end pipeline :oembed do From f7614d4718b8928c92683493e517d7769744d8ef Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:07:39 +0300 Subject: [PATCH 20/62] SetUserSessionIdPlug module name --- lib/pleroma/web/plugs/set_user_session_id_plug.ex | 2 +- lib/pleroma/web/router.ex | 2 +- test/pleroma/web/plugs/set_user_session_id_plug_test.exs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/plugs/set_user_session_id_plug.ex b/lib/pleroma/web/plugs/set_user_session_id_plug.ex index 730c4ac74..e520159e4 100644 --- a/lib/pleroma/web/plugs/set_user_session_id_plug.ex +++ b/lib/pleroma/web/plugs/set_user_session_id_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.SetUserSessionIdPlug do +defmodule Pleroma.Web.Plugs.SetUserSessionIdPlug do import Plug.Conn alias Pleroma.User diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index f7e6cc4f3..379f16252 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -35,7 +35,7 @@ defmodule Pleroma.Web.Router do pipeline :after_auth do plug(Pleroma.Web.Plugs.UserEnabledPlug) - plug(Pleroma.Plugs.SetUserSessionIdPlug) + plug(Pleroma.Web.Plugs.SetUserSessionIdPlug) plug(Pleroma.Plugs.EnsureUserKeyPlug) end diff --git a/test/pleroma/web/plugs/set_user_session_id_plug_test.exs b/test/pleroma/web/plugs/set_user_session_id_plug_test.exs index 11404c7f7..8467d44e3 100644 --- a/test/pleroma/web/plugs/set_user_session_id_plug_test.exs +++ b/test/pleroma/web/plugs/set_user_session_id_plug_test.exs @@ -5,7 +5,7 @@ defmodule Pleroma.Web.Plugs.SetUserSessionIdPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.SetUserSessionIdPlug + alias Pleroma.Web.Plugs.SetUserSessionIdPlug alias Pleroma.User setup %{conn: conn} do From c97c7d982f44b00a75e67ef669f1892697571ca8 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:24:29 +0300 Subject: [PATCH 21/62] SetLocalePlug module name --- lib/pleroma/web/endpoint.ex | 2 +- lib/pleroma/web/plugs/set_locale_plug.ex | 2 +- test/pleroma/web/plugs/set_locale_plug_test.exs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index 3543d0b3b..0512b9c61 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -9,7 +9,7 @@ defmodule Pleroma.Web.Endpoint do socket("/socket", Pleroma.Web.UserSocket) - plug(Pleroma.Plugs.SetLocalePlug) + plug(Pleroma.Web.Plugs.SetLocalePlug) plug(CORSPlug) plug(Pleroma.Plugs.HTTPSecurityPlug) plug(Pleroma.Web.Plugs.UploadedMedia) diff --git a/lib/pleroma/web/plugs/set_locale_plug.ex b/lib/pleroma/web/plugs/set_locale_plug.ex index 9a21d0a9d..d9d24b93f 100644 --- a/lib/pleroma/web/plugs/set_locale_plug.ex +++ b/lib/pleroma/web/plugs/set_locale_plug.ex @@ -3,7 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-only # NOTE: this module is based on https://github.com/smeevil/set_locale -defmodule Pleroma.Plugs.SetLocalePlug do +defmodule Pleroma.Web.Plugs.SetLocalePlug do import Plug.Conn, only: [get_req_header: 2, assign: 3] def init(_), do: nil diff --git a/test/pleroma/web/plugs/set_locale_plug_test.exs b/test/pleroma/web/plugs/set_locale_plug_test.exs index 3dc73202e..773f48a5b 100644 --- a/test/pleroma/web/plugs/set_locale_plug_test.exs +++ b/test/pleroma/web/plugs/set_locale_plug_test.exs @@ -6,7 +6,7 @@ defmodule Pleroma.Web.Plugs.SetLocalePlugTest do use ExUnit.Case, async: true use Plug.Test - alias Pleroma.Plugs.SetLocalePlug + alias Pleroma.Web.Plugs.SetLocalePlug alias Plug.Conn test "default locale is `en`" do From 8249b757615e701871c7a6bb16e15788d90a1616 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:26:17 +0300 Subject: [PATCH 22/62] SetFormatPlug module name --- lib/pleroma/web/feed/user_controller.ex | 2 +- lib/pleroma/web/o_status/o_status_controller.ex | 2 +- lib/pleroma/web/plugs/set_format_plug.ex | 2 +- lib/pleroma/web/web_finger/web_finger_controller.ex | 2 +- test/pleroma/web/plugs/set_format_plug_test.exs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/feed/user_controller.ex b/lib/pleroma/web/feed/user_controller.ex index bea07649b..6aad6af44 100644 --- a/lib/pleroma/web/feed/user_controller.ex +++ b/lib/pleroma/web/feed/user_controller.ex @@ -10,7 +10,7 @@ defmodule Pleroma.Web.Feed.UserController do alias Pleroma.Web.ActivityPub.ActivityPubController alias Pleroma.Web.Feed.FeedView - plug(Pleroma.Plugs.SetFormatPlug when action in [:feed_redirect]) + plug(Pleroma.Web.Plugs.SetFormatPlug when action in [:feed_redirect]) action_fallback(:errors) diff --git a/lib/pleroma/web/o_status/o_status_controller.ex b/lib/pleroma/web/o_status/o_status_controller.ex index 329ab64e0..d4d095a75 100644 --- a/lib/pleroma/web/o_status/o_status_controller.ex +++ b/lib/pleroma/web/o_status/o_status_controller.ex @@ -26,7 +26,7 @@ defmodule Pleroma.Web.OStatus.OStatusController do ) plug( - Pleroma.Plugs.SetFormatPlug + Pleroma.Web.Plugs.SetFormatPlug when action in [:object, :activity, :notice] ) diff --git a/lib/pleroma/web/plugs/set_format_plug.ex b/lib/pleroma/web/plugs/set_format_plug.ex index c03fcb28d..c16d2f81d 100644 --- a/lib/pleroma/web/plugs/set_format_plug.ex +++ b/lib/pleroma/web/plugs/set_format_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.SetFormatPlug do +defmodule Pleroma.Web.Plugs.SetFormatPlug do import Plug.Conn, only: [assign: 3, fetch_query_params: 1] def init(_), do: nil diff --git a/lib/pleroma/web/web_finger/web_finger_controller.ex b/lib/pleroma/web/web_finger/web_finger_controller.ex index 7077b20d2..14cb87df8 100644 --- a/lib/pleroma/web/web_finger/web_finger_controller.ex +++ b/lib/pleroma/web/web_finger/web_finger_controller.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Web.WebFinger.WebFingerController do alias Pleroma.Web.WebFinger - plug(Pleroma.Plugs.SetFormatPlug) + plug(Pleroma.Web.Plugs.SetFormatPlug) plug(Pleroma.Web.FederatingPlug) def host_meta(conn, _params) do diff --git a/test/pleroma/web/plugs/set_format_plug_test.exs b/test/pleroma/web/plugs/set_format_plug_test.exs index 1b9ba16b1..e95d751fa 100644 --- a/test/pleroma/web/plugs/set_format_plug_test.exs +++ b/test/pleroma/web/plugs/set_format_plug_test.exs @@ -6,7 +6,7 @@ defmodule Pleroma.Web.Plugs.SetFormatPlugTest do use ExUnit.Case, async: true use Plug.Test - alias Pleroma.Plugs.SetFormatPlug + alias Pleroma.Web.Plugs.SetFormatPlug test "set format from params" do conn = From 4b4c0eef3681f2dd4f9248ee1383f307dcd83730 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:27:29 +0300 Subject: [PATCH 23/62] SessionAuthenticationPlug module name --- lib/pleroma/web/plugs/session_authentication_plug.ex | 2 +- lib/pleroma/web/router.ex | 2 +- test/pleroma/web/plugs/session_authentication_plug_test.exs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/plugs/session_authentication_plug.ex b/lib/pleroma/web/plugs/session_authentication_plug.ex index 0f83a5e53..6e176d553 100644 --- a/lib/pleroma/web/plugs/session_authentication_plug.ex +++ b/lib/pleroma/web/plugs/session_authentication_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.SessionAuthenticationPlug do +defmodule Pleroma.Web.Plugs.SessionAuthenticationPlug do import Plug.Conn def init(options) do diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 379f16252..f90933e5a 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -28,7 +28,7 @@ defmodule Pleroma.Web.Router do plug(Pleroma.Plugs.OAuthPlug) plug(Pleroma.Plugs.BasicAuthDecoderPlug) plug(Pleroma.Web.Plugs.UserFetcherPlug) - plug(Pleroma.Plugs.SessionAuthenticationPlug) + plug(Pleroma.Web.Plugs.SessionAuthenticationPlug) plug(Pleroma.Plugs.LegacyAuthenticationPlug) plug(Pleroma.Plugs.AuthenticationPlug) end diff --git a/test/pleroma/web/plugs/session_authentication_plug_test.exs b/test/pleroma/web/plugs/session_authentication_plug_test.exs index 34518414f..2b4d5bc0c 100644 --- a/test/pleroma/web/plugs/session_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/session_authentication_plug_test.exs @@ -5,8 +5,8 @@ defmodule Pleroma.Web.Plugs.SessionAuthenticationPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.SessionAuthenticationPlug alias Pleroma.User + alias Pleroma.Web.Plugs.SessionAuthenticationPlug setup %{conn: conn} do session_opts = [ From 3be8ab51038cdfeb4bbf78633eb79c4d6f6b8d0b Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:30:32 +0300 Subject: [PATCH 24/62] RemoteIp module name --- config/config.exs | 2 +- config/description.exs | 4 ++-- config/test.exs | 2 +- docs/configuration/cheatsheet.md | 6 +++--- lib/pleroma/web/endpoint.ex | 2 +- lib/pleroma/web/plugs/remote_ip.ex | 2 +- test/pleroma/web/plugs/rate_limiter_test.exs | 2 +- test/pleroma/web/plugs/remote_ip_test.exs | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config/config.exs b/config/config.exs index d53663d36..273da5bb6 100644 --- a/config/config.exs +++ b/config/config.exs @@ -677,7 +677,7 @@ config :pleroma, Pleroma.Workers.PurgeExpiredActivity, enabled: true, min_lifetime: 600 -config :pleroma, Pleroma.Plugs.RemoteIp, +config :pleroma, Pleroma.Web.Plugs.RemoteIp, enabled: true, headers: ["x-forwarded-for"], proxies: [], diff --git a/config/description.exs b/config/description.exs index 3902b9632..6e83a8e09 100644 --- a/config/description.exs +++ b/config/description.exs @@ -3250,10 +3250,10 @@ }, %{ group: :pleroma, - key: Pleroma.Plugs.RemoteIp, + key: Pleroma.Web.Plugs.RemoteIp, type: :group, description: """ - `Pleroma.Plugs.RemoteIp` is a shim to call [`RemoteIp`](https://git.pleroma.social/pleroma/remote_ip) but with runtime configuration. + `Pleroma.Web.Plugs.RemoteIp` is a shim to call [`RemoteIp`](https://git.pleroma.social/pleroma/remote_ip) but with runtime configuration. **If your instance is not behind at least one reverse proxy, you should not enable this plug.** """, children: [ diff --git a/config/test.exs b/config/test.exs index 95f860f2f..7cc660e3c 100644 --- a/config/test.exs +++ b/config/test.exs @@ -113,7 +113,7 @@ config :pleroma, Pleroma.Emails.NewUsersDigestEmail, enabled: true -config :pleroma, Pleroma.Plugs.RemoteIp, enabled: false +config :pleroma, Pleroma.Web.Plugs.RemoteIp, enabled: false config :pleroma, Pleroma.Web.ApiSpec.CastAndValidate, strict: true diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index ea7dfec98..a6a152b7e 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -416,12 +416,12 @@ This will make Pleroma listen on `127.0.0.1` port `8080` and generate urls start * ``referrer_policy``: The referrer policy to use, either `"same-origin"` or `"no-referrer"`. * ``report_uri``: Adds the specified url to `report-uri` and `report-to` group in CSP header. -### Pleroma.Plugs.RemoteIp +### Pleroma.Web.Plugs.RemoteIp !!! warning If your instance is not behind at least one reverse proxy, you should not enable this plug. -`Pleroma.Plugs.RemoteIp` is a shim to call [`RemoteIp`](https://git.pleroma.social/pleroma/remote_ip) but with runtime configuration. +`Pleroma.Web.Plugs.RemoteIp` is a shim to call [`RemoteIp`](https://git.pleroma.social/pleroma/remote_ip) but with runtime configuration. Available options: @@ -434,7 +434,7 @@ Available options: ### :rate_limit !!! note - If your instance is behind a reverse proxy ensure [`Pleroma.Plugs.RemoteIp`](#pleroma-plugs-remoteip) is enabled (it is enabled by default). + If your instance is behind a reverse proxy ensure [`Pleroma.Web.Plugs.RemoteIp`](#pleroma-plugs-remoteip) is enabled (it is enabled by default). A keyword list of rate limiters where a key is a limiter name and value is the limiter configuration. The basic configuration is a tuple where: diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index 0512b9c61..003bb1194 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -122,7 +122,7 @@ defmodule Pleroma.Web.Endpoint do extra: extra ) - plug(Pleroma.Plugs.RemoteIp) + plug(Pleroma.Web.Plugs.RemoteIp) defmodule Instrumenter do use Prometheus.PhoenixInstrumenter diff --git a/lib/pleroma/web/plugs/remote_ip.ex b/lib/pleroma/web/plugs/remote_ip.ex index 987022156..401e2cbfa 100644 --- a/lib/pleroma/web/plugs/remote_ip.ex +++ b/lib/pleroma/web/plugs/remote_ip.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.RemoteIp do +defmodule Pleroma.Web.Plugs.RemoteIp do @moduledoc """ This is a shim to call [`RemoteIp`](https://git.pleroma.social/pleroma/remote_ip) but with runtime configuration. """ diff --git a/test/pleroma/web/plugs/rate_limiter_test.exs b/test/pleroma/web/plugs/rate_limiter_test.exs index dfc1abcbd..7c10c97b3 100644 --- a/test/pleroma/web/plugs/rate_limiter_test.exs +++ b/test/pleroma/web/plugs/rate_limiter_test.exs @@ -19,7 +19,7 @@ defmodule Pleroma.Web.Plugs.RateLimiterTest do describe "config" do @limiter_name :test_init - setup do: clear_config([Pleroma.Plugs.RemoteIp, :enabled]) + setup do: clear_config([Pleroma.Web.Plugs.RemoteIp, :enabled]) test "config is required for plug to work" do Config.put([:rate_limit, @limiter_name], {1, 1}) diff --git a/test/pleroma/web/plugs/remote_ip_test.exs b/test/pleroma/web/plugs/remote_ip_test.exs index 14c557694..0bdb4c168 100644 --- a/test/pleroma/web/plugs/remote_ip_test.exs +++ b/test/pleroma/web/plugs/remote_ip_test.exs @@ -6,7 +6,7 @@ defmodule Pleroma.Web.Plugs.RemoteIpTest do use ExUnit.Case use Plug.Test - alias Pleroma.Plugs.RemoteIp + alias Pleroma.Web.Plugs.RemoteIp import Pleroma.Tests.Helpers, only: [clear_config: 2] From 4b1863ca4e0a99d794f856fcb6bf5630d8408825 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:35:00 +0300 Subject: [PATCH 25/62] RateLimiter module name --- .../mastodon_api/controllers/account_controller.ex | 2 +- .../mastodon_api/controllers/auth_controller.ex | 2 +- .../mastodon_api/controllers/search_controller.ex | 2 +- .../mastodon_api/controllers/status_controller.ex | 2 +- .../controllers/timeline_controller.ex | 2 +- .../web/mongoose_im/mongoose_im_controller.ex | 2 +- lib/pleroma/web/o_auth/o_auth_controller.ex | 2 +- lib/pleroma/web/o_status/o_status_controller.ex | 2 +- .../pleroma_api/controllers/account_controller.ex | 2 +- lib/pleroma/web/plugs/rate_limiter.ex | 14 +++++++------- test/pleroma/web/plugs/rate_limiter_test.exs | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex index 95d8452df..0d9dfb827 100644 --- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex @@ -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 diff --git a/lib/pleroma/web/mastodon_api/controllers/auth_controller.ex b/lib/pleroma/web/mastodon_api/controllers/auth_controller.ex index 57c0be5fe..75b809aab 100644 --- a/lib/pleroma/web/mastodon_api/controllers/auth_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/auth_controller.ex @@ -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" diff --git a/lib/pleroma/web/mastodon_api/controllers/search_controller.ex b/lib/pleroma/web/mastodon_api/controllers/search_controller.ex index 5a983db39..d5afac981 100644 --- a/lib/pleroma/web/mastodon_api/controllers/search_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/search_controller.ex @@ -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 diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index ecfa38489..6c1ac9458 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -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 diff --git a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex index 5272790d3..cc410d4f4 100644 --- a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex @@ -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 diff --git a/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex b/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex index 6cbbe8fd8..42cf5a85f 100644 --- a/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex +++ b/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex @@ -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 diff --git a/lib/pleroma/web/o_auth/o_auth_controller.ex b/lib/pleroma/web/o_auth/o_auth_controller.ex index a4152e840..a57e2bef4 100644 --- a/lib/pleroma/web/o_auth/o_auth_controller.ex +++ b/lib/pleroma/web/o_auth/o_auth_controller.ex @@ -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 diff --git a/lib/pleroma/web/o_status/o_status_controller.ex b/lib/pleroma/web/o_status/o_status_controller.ex index d4d095a75..5bd767c96 100644 --- a/lib/pleroma/web/o_status/o_status_controller.ex +++ b/lib/pleroma/web/o_status/o_status_controller.ex @@ -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 diff --git a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex index 563edded7..d228a875e 100644 --- a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex @@ -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 diff --git a/lib/pleroma/web/plugs/rate_limiter.ex b/lib/pleroma/web/plugs/rate_limiter.ex index d4a707675..669c399c9 100644 --- a/lib/pleroma/web/plugs/rate_limiter.ex +++ b/lib/pleroma/web/plugs/rate_limiter.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # 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 """ diff --git a/test/pleroma/web/plugs/rate_limiter_test.exs b/test/pleroma/web/plugs/rate_limiter_test.exs index 7c10c97b3..249c78b37 100644 --- a/test/pleroma/web/plugs/rate_limiter_test.exs +++ b/test/pleroma/web/plugs/rate_limiter_test.exs @@ -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 From 15772fda5715f901fcc676ce43d3debe462d94c3 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:42:36 +0300 Subject: [PATCH 26/62] PlugHelper module name --- lib/pleroma/web.ex | 2 +- lib/pleroma/web/plugs/plug_helper.ex | 2 +- test/pleroma/web/plugs/authentication_plug_test.exs | 2 +- test/pleroma/web/plugs/legacy_authentication_plug_test.exs | 2 +- test/pleroma/web/plugs/plug_helper_test.exs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web.ex b/lib/pleroma/web.ex index 9ca52733d..66ebe8deb 100644 --- a/lib/pleroma/web.ex +++ b/lib/pleroma/web.ex @@ -25,7 +25,7 @@ defmodule Pleroma.Web do alias Pleroma.Plugs.ExpectAuthenticatedCheckPlug alias Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug alias Pleroma.Plugs.OAuthScopesPlug - alias Pleroma.Plugs.PlugHelper + alias Pleroma.Web.Plugs.PlugHelper def controller do quote do diff --git a/lib/pleroma/web/plugs/plug_helper.ex b/lib/pleroma/web/plugs/plug_helper.ex index 9c67be8ef..b314e7596 100644 --- a/lib/pleroma/web/plugs/plug_helper.ex +++ b/lib/pleroma/web/plugs/plug_helper.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.PlugHelper do +defmodule Pleroma.Web.Plugs.PlugHelper do @moduledoc "Pleroma Plug helper" @called_plugs_list_id :called_plugs diff --git a/test/pleroma/web/plugs/authentication_plug_test.exs b/test/pleroma/web/plugs/authentication_plug_test.exs index 550543ff2..0bc589fbe 100644 --- a/test/pleroma/web/plugs/authentication_plug_test.exs +++ b/test/pleroma/web/plugs/authentication_plug_test.exs @@ -7,7 +7,7 @@ defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do alias Pleroma.Plugs.AuthenticationPlug alias Pleroma.Plugs.OAuthScopesPlug - alias Pleroma.Plugs.PlugHelper + alias Pleroma.Web.Plugs.PlugHelper alias Pleroma.User import ExUnit.CaptureLog diff --git a/test/pleroma/web/plugs/legacy_authentication_plug_test.exs b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs index fbb25ee7b..6a44c673e 100644 --- a/test/pleroma/web/plugs/legacy_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs @@ -9,7 +9,7 @@ defmodule Pleroma.Web.Plugs.LegacyAuthenticationPlugTest do alias Pleroma.Plugs.LegacyAuthenticationPlug alias Pleroma.Plugs.OAuthScopesPlug - alias Pleroma.Plugs.PlugHelper + alias Pleroma.Web.Plugs.PlugHelper alias Pleroma.User setup do diff --git a/test/pleroma/web/plugs/plug_helper_test.exs b/test/pleroma/web/plugs/plug_helper_test.exs index 0d32031e8..6febd4388 100644 --- a/test/pleroma/web/plugs/plug_helper_test.exs +++ b/test/pleroma/web/plugs/plug_helper_test.exs @@ -7,7 +7,7 @@ defmodule Pleroma.Web.Plugs.PlugHelperTest do alias Pleroma.Plugs.ExpectAuthenticatedCheckPlug alias Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug - alias Pleroma.Plugs.PlugHelper + alias Pleroma.Web.Plugs.PlugHelper import Mock From a6d8cef33e9ac91c373d0ac4c96a42bd941fe6b2 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:57:27 +0300 Subject: [PATCH 27/62] OAuthScopesPlug module name --- docs/dev.md | 4 ++-- lib/pleroma/tests/auth_test_controller.ex | 2 +- lib/pleroma/web.ex | 2 +- .../web/admin_api/controllers/admin_api_controller.ex | 2 +- .../web/admin_api/controllers/config_controller.ex | 2 +- .../web/admin_api/controllers/invite_controller.ex | 2 +- .../controllers/media_proxy_cache_controller.ex | 2 +- .../web/admin_api/controllers/o_auth_app_controller.ex | 2 +- .../web/admin_api/controllers/relay_controller.ex | 2 +- .../web/admin_api/controllers/report_controller.ex | 2 +- .../web/admin_api/controllers/status_controller.ex | 2 +- lib/pleroma/web/masto_fe_controller.ex | 2 +- .../web/mastodon_api/controllers/account_controller.ex | 2 +- .../web/mastodon_api/controllers/app_controller.ex | 2 +- .../mastodon_api/controllers/conversation_controller.ex | 2 +- .../mastodon_api/controllers/custom_emoji_controller.ex | 2 +- .../mastodon_api/controllers/domain_block_controller.ex | 2 +- .../web/mastodon_api/controllers/filter_controller.ex | 2 +- .../controllers/follow_request_controller.ex | 2 +- .../web/mastodon_api/controllers/instance_controller.ex | 2 +- .../web/mastodon_api/controllers/list_controller.ex | 2 +- .../web/mastodon_api/controllers/marker_controller.ex | 2 +- .../mastodon_api/controllers/mastodon_api_controller.ex | 2 +- .../web/mastodon_api/controllers/media_controller.ex | 2 +- .../mastodon_api/controllers/notification_controller.ex | 2 +- .../web/mastodon_api/controllers/poll_controller.ex | 2 +- .../web/mastodon_api/controllers/report_controller.ex | 4 +--- .../controllers/scheduled_activity_controller.ex | 2 +- .../web/mastodon_api/controllers/search_controller.ex | 2 +- .../web/mastodon_api/controllers/status_controller.ex | 2 +- .../mastodon_api/controllers/subscription_controller.ex | 2 +- .../mastodon_api/controllers/suggestion_controller.ex | 2 +- .../web/mastodon_api/controllers/timeline_controller.ex | 2 +- lib/pleroma/web/o_auth/o_auth_controller.ex | 5 ++++- lib/pleroma/web/o_auth/scopes.ex | 2 +- .../web/pleroma_api/controllers/account_controller.ex | 2 +- .../web/pleroma_api/controllers/chat_controller.ex | 2 +- .../pleroma_api/controllers/conversation_controller.ex | 2 +- .../web/pleroma_api/controllers/emoji_pack_controller.ex | 9 ++++++--- .../pleroma_api/controllers/emoji_reaction_controller.ex | 2 +- .../web/pleroma_api/controllers/mascot_controller.ex | 2 +- .../pleroma_api/controllers/notification_controller.ex | 8 ++++++-- .../web/pleroma_api/controllers/scrobble_controller.ex | 2 +- .../controllers/two_factor_authentication_controller.ex | 2 +- lib/pleroma/web/plugs/authentication_plug.ex | 3 +-- lib/pleroma/web/plugs/legacy_authentication_plug.ex | 3 +-- lib/pleroma/web/plugs/o_auth_scopes_plug.ex | 2 +- lib/pleroma/web/twitter_api/controller.ex | 2 +- .../twitter_api/controllers/remote_follow_controller.ex | 3 +-- .../web/twitter_api/controllers/util_controller.ex | 2 +- test/pleroma/web/plugs/authentication_plug_test.exs | 2 +- .../web/plugs/legacy_authentication_plug_test.exs | 2 +- test/pleroma/web/plugs/o_auth_scopes_plug_test.exs | 2 +- 53 files changed, 67 insertions(+), 62 deletions(-) diff --git a/docs/dev.md b/docs/dev.md index 9c749c17c..085d66760 100644 --- a/docs/dev.md +++ b/docs/dev.md @@ -6,7 +6,7 @@ This document contains notes and guidelines for Pleroma developers. * Pleroma supports hierarchical OAuth scopes, just like Mastodon but with added granularity of admin scopes. For a reference, see [Mastodon OAuth scopes](https://docs.joinmastodon.org/api/oauth-scopes/). -* It is important to either define OAuth scope restrictions or explicitly mark OAuth scope check as skipped, for every controller action. To define scopes, call `plug(Pleroma.Plugs.OAuthScopesPlug, %{scopes: [...]})`. To explicitly set OAuth scopes check skipped, call `plug(:skip_plug, Pleroma.Plugs.OAuthScopesPlug )`. +* It is important to either define OAuth scope restrictions or explicitly mark OAuth scope check as skipped, for every controller action. To define scopes, call `plug(Pleroma.Web.Plugs.OAuthScopesPlug, %{scopes: [...]})`. To explicitly set OAuth scopes check skipped, call `plug(:skip_plug, Pleroma.Web.Plugs.OAuthScopesPlug )`. * In controllers, `use Pleroma.Web, :controller` will result in `action/2` (see `Pleroma.Web.controller/0` for definition) be called prior to actual controller action, and it'll perform security / privacy checks before passing control to actual controller action. @@ -16,7 +16,7 @@ This document contains notes and guidelines for Pleroma developers. ## [HTTP Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization) -* With HTTP Basic Auth, OAuth scopes check is _not_ performed for any action (since password is provided during the auth, requester is able to obtain a token with full permissions anyways). `Pleroma.Plugs.AuthenticationPlug` and `Pleroma.Plugs.LegacyAuthenticationPlug` both call `Pleroma.Plugs.OAuthScopesPlug.skip_plug(conn)` when password is provided. +* With HTTP Basic Auth, OAuth scopes check is _not_ performed for any action (since password is provided during the auth, requester is able to obtain a token with full permissions anyways). `Pleroma.Plugs.AuthenticationPlug` and `Pleroma.Plugs.LegacyAuthenticationPlug` both call `Pleroma.Web.Plugs.OAuthScopesPlug.skip_plug(conn)` when password is provided. ## Auth-related configuration, OAuth consumer mode etc. diff --git a/lib/pleroma/tests/auth_test_controller.ex b/lib/pleroma/tests/auth_test_controller.ex index fb04411d9..296cae522 100644 --- a/lib/pleroma/tests/auth_test_controller.ex +++ b/lib/pleroma/tests/auth_test_controller.ex @@ -9,7 +9,7 @@ defmodule Pleroma.Tests.AuthTestController do use Pleroma.Web, :controller alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User # Serves only with proper OAuth token (:api and :authenticated_api) diff --git a/lib/pleroma/web.ex b/lib/pleroma/web.ex index 66ebe8deb..96fe4fdc6 100644 --- a/lib/pleroma/web.ex +++ b/lib/pleroma/web.ex @@ -24,7 +24,7 @@ defmodule Pleroma.Web do alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Plugs.ExpectAuthenticatedCheckPlug alias Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.PlugHelper def controller do diff --git a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex index d5713c3dd..ea4bc06f8 100644 --- a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex @@ -10,7 +10,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do alias Pleroma.Config alias Pleroma.MFA alias Pleroma.ModerationLog - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Stats alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub diff --git a/lib/pleroma/web/admin_api/controllers/config_controller.ex b/lib/pleroma/web/admin_api/controllers/config_controller.ex index 0df13007f..5d155af3d 100644 --- a/lib/pleroma/web/admin_api/controllers/config_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/config_controller.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Web.AdminAPI.ConfigController do alias Pleroma.Config alias Pleroma.ConfigDB - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug plug(Pleroma.Web.ApiSpec.CastAndValidate) plug(OAuthScopesPlug, %{scopes: ["write"], admin: true} when action == :update) diff --git a/lib/pleroma/web/admin_api/controllers/invite_controller.ex b/lib/pleroma/web/admin_api/controllers/invite_controller.ex index 7d169b8d2..47b7d9953 100644 --- a/lib/pleroma/web/admin_api/controllers/invite_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/invite_controller.ex @@ -8,7 +8,7 @@ defmodule Pleroma.Web.AdminAPI.InviteController do import Pleroma.Web.ControllerHelper, only: [json_response: 3] alias Pleroma.Config - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.UserInviteToken require Logger diff --git a/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex b/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex index 131e22d78..3aa110b8b 100644 --- a/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex @@ -5,7 +5,7 @@ defmodule Pleroma.Web.AdminAPI.MediaProxyCacheController do use Pleroma.Web, :controller - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.ApiSpec.Admin, as: Spec alias Pleroma.Web.MediaProxy diff --git a/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex b/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex index dca23ea73..eb86ed17c 100644 --- a/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Web.AdminAPI.OAuthAppController do import Pleroma.Web.ControllerHelper, only: [json_response: 3] - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.OAuth.App require Logger diff --git a/lib/pleroma/web/admin_api/controllers/relay_controller.ex b/lib/pleroma/web/admin_api/controllers/relay_controller.ex index 6c19f09f7..8a4cafde3 100644 --- a/lib/pleroma/web/admin_api/controllers/relay_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/relay_controller.ex @@ -6,7 +6,7 @@ defmodule Pleroma.Web.AdminAPI.RelayController do use Pleroma.Web, :controller alias Pleroma.ModerationLog - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.ActivityPub.Relay require Logger diff --git a/lib/pleroma/web/admin_api/controllers/report_controller.ex b/lib/pleroma/web/admin_api/controllers/report_controller.ex index 4c011e174..6e8c31645 100644 --- a/lib/pleroma/web/admin_api/controllers/report_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/report_controller.ex @@ -9,7 +9,7 @@ defmodule Pleroma.Web.AdminAPI.ReportController do alias Pleroma.Activity alias Pleroma.ModerationLog - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.ReportNote alias Pleroma.Web.ActivityPub.Utils alias Pleroma.Web.AdminAPI diff --git a/lib/pleroma/web/admin_api/controllers/status_controller.ex b/lib/pleroma/web/admin_api/controllers/status_controller.ex index bc48cc527..cefdf5d40 100644 --- a/lib/pleroma/web/admin_api/controllers/status_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/status_controller.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Web.AdminAPI.StatusController do alias Pleroma.Activity alias Pleroma.ModerationLog - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.CommonAPI alias Pleroma.Web.MastodonAPI diff --git a/lib/pleroma/web/masto_fe_controller.ex b/lib/pleroma/web/masto_fe_controller.ex index 43ec70021..6e348db14 100644 --- a/lib/pleroma/web/masto_fe_controller.ex +++ b/lib/pleroma/web/masto_fe_controller.ex @@ -6,7 +6,7 @@ defmodule Pleroma.Web.MastoFEController do use Pleroma.Web, :controller alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User plug(OAuthScopesPlug, %{scopes: ["write:accounts"]} when action == :put_settings) diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex index 0d9dfb827..518fa775c 100644 --- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex @@ -16,7 +16,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do alias Pleroma.Maps alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub diff --git a/lib/pleroma/web/mastodon_api/controllers/app_controller.ex b/lib/pleroma/web/mastodon_api/controllers/app_controller.ex index a516b6c20..098859cd3 100644 --- a/lib/pleroma/web/mastodon_api/controllers/app_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/app_controller.ex @@ -6,7 +6,7 @@ defmodule Pleroma.Web.MastodonAPI.AppController do use Pleroma.Web, :controller alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Repo alias Pleroma.Web.OAuth.App alias Pleroma.Web.OAuth.Scopes diff --git a/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex b/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex index f35ec3596..ee8cc11ef 100644 --- a/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex @@ -8,7 +8,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationController do import Pleroma.Web.ControllerHelper, only: [add_link_headers: 2] alias Pleroma.Conversation.Participation - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Repo action_fallback(Pleroma.Web.MastodonAPI.FallbackController) diff --git a/lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex b/lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex index c5f47c5df..29f1fdb9a 100644 --- a/lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex @@ -9,7 +9,7 @@ defmodule Pleroma.Web.MastodonAPI.CustomEmojiController do plug( :skip_plug, - [Pleroma.Plugs.OAuthScopesPlug, Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug] + [Pleroma.Web.Plugs.OAuthScopesPlug, Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug] when action == :index ) diff --git a/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex b/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex index 9c2d093cd..fda27f669 100644 --- a/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex @@ -5,7 +5,7 @@ defmodule Pleroma.Web.MastodonAPI.DomainBlockController do use Pleroma.Web, :controller - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User plug(Pleroma.Web.ApiSpec.CastAndValidate) diff --git a/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex b/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex index abbf0ce02..c71a34b15 100644 --- a/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex @@ -6,7 +6,7 @@ defmodule Pleroma.Web.MastodonAPI.FilterController do use Pleroma.Web, :controller alias Pleroma.Filter - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug @oauth_read_actions [:show, :index] diff --git a/lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex b/lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex index 748b6b475..e9fd8630f 100644 --- a/lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex @@ -5,7 +5,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestController do use Pleroma.Web, :controller - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.CommonAPI diff --git a/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex b/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex index d8859731d..1280f10cb 100644 --- a/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex @@ -9,7 +9,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceController do plug( :skip_plug, - [Pleroma.Plugs.OAuthScopesPlug, Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug] + [Pleroma.Web.Plugs.OAuthScopesPlug, Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug] when action in [:show, :peers] ) diff --git a/lib/pleroma/web/mastodon_api/controllers/list_controller.ex b/lib/pleroma/web/mastodon_api/controllers/list_controller.ex index 5daeaa780..bd6460881 100644 --- a/lib/pleroma/web/mastodon_api/controllers/list_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/list_controller.ex @@ -5,7 +5,7 @@ defmodule Pleroma.Web.MastodonAPI.ListController do use Pleroma.Web, :controller - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.MastodonAPI.AccountView diff --git a/lib/pleroma/web/mastodon_api/controllers/marker_controller.ex b/lib/pleroma/web/mastodon_api/controllers/marker_controller.ex index 85310edfa..0628b2b49 100644 --- a/lib/pleroma/web/mastodon_api/controllers/marker_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/marker_controller.ex @@ -4,7 +4,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerController do use Pleroma.Web, :controller - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug plug(Pleroma.Web.ApiSpec.CastAndValidate) diff --git a/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex index e7767de4e..12c99d8c8 100644 --- a/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex @@ -17,7 +17,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do plug( :skip_plug, - [Pleroma.Plugs.OAuthScopesPlug, Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug] + [Pleroma.Web.Plugs.OAuthScopesPlug, Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug] when action in [:empty_array, :empty_object] ) diff --git a/lib/pleroma/web/mastodon_api/controllers/media_controller.ex b/lib/pleroma/web/mastodon_api/controllers/media_controller.ex index 513de279f..b60d736f7 100644 --- a/lib/pleroma/web/mastodon_api/controllers/media_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/media_controller.ex @@ -6,7 +6,7 @@ defmodule Pleroma.Web.MastodonAPI.MediaController do use Pleroma.Web, :controller alias Pleroma.Object - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub diff --git a/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex b/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex index e25cef30b..9ccac3d41 100644 --- a/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex @@ -8,7 +8,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationController do import Pleroma.Web.ControllerHelper, only: [add_link_headers: 2] alias Pleroma.Notification - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.MastodonAPI.MastodonAPI @oauth_read_actions [:show, :index] diff --git a/lib/pleroma/web/mastodon_api/controllers/poll_controller.ex b/lib/pleroma/web/mastodon_api/controllers/poll_controller.ex index db46ffcfc..9f97bd609 100644 --- a/lib/pleroma/web/mastodon_api/controllers/poll_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/poll_controller.ex @@ -9,7 +9,7 @@ defmodule Pleroma.Web.MastodonAPI.PollController do alias Pleroma.Activity alias Pleroma.Object - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.CommonAPI diff --git a/lib/pleroma/web/mastodon_api/controllers/report_controller.ex b/lib/pleroma/web/mastodon_api/controllers/report_controller.ex index 405167108..156544f40 100644 --- a/lib/pleroma/web/mastodon_api/controllers/report_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/report_controller.ex @@ -3,14 +3,12 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ReportController do - alias Pleroma.Plugs.OAuthScopesPlug - use Pleroma.Web, :controller action_fallback(Pleroma.Web.MastodonAPI.FallbackController) plug(Pleroma.Web.ApiSpec.CastAndValidate) - plug(OAuthScopesPlug, %{scopes: ["write:reports"]} when action == :create) + plug(Pleroma.Web.Plugs.OAuthScopesPlug, %{scopes: ["write:reports"]} when action == :create) defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.ReportOperation diff --git a/lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex b/lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex index 1719c67ea..97d2fea23 100644 --- a/lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Web.MastodonAPI.ScheduledActivityController do import Pleroma.Web.ControllerHelper, only: [add_link_headers: 2] - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.ScheduledActivity alias Pleroma.Web.MastodonAPI.MastodonAPI diff --git a/lib/pleroma/web/mastodon_api/controllers/search_controller.ex b/lib/pleroma/web/mastodon_api/controllers/search_controller.ex index d5afac981..c60b3dff6 100644 --- a/lib/pleroma/web/mastodon_api/controllers/search_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/search_controller.ex @@ -6,7 +6,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do use Pleroma.Web, :controller alias Pleroma.Activity - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.Repo alias Pleroma.User diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index 6c1ac9458..c160ac27d 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -13,7 +13,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do alias Pleroma.Activity alias Pleroma.Bookmark alias Pleroma.Object - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.Repo alias Pleroma.ScheduledActivity diff --git a/lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex b/lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex index 34eac97c5..20138908c 100644 --- a/lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex @@ -13,7 +13,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionController do plug(Pleroma.Web.ApiSpec.CastAndValidate) plug(:restrict_push_enabled) - plug(Pleroma.Plugs.OAuthScopesPlug, %{scopes: ["push"]}) + plug(Pleroma.Web.Plugs.OAuthScopesPlug, %{scopes: ["push"]}) defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.SubscriptionOperation diff --git a/lib/pleroma/web/mastodon_api/controllers/suggestion_controller.ex b/lib/pleroma/web/mastodon_api/controllers/suggestion_controller.ex index f91df9ab7..5765271cf 100644 --- a/lib/pleroma/web/mastodon_api/controllers/suggestion_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/suggestion_controller.ex @@ -8,7 +8,7 @@ defmodule Pleroma.Web.MastodonAPI.SuggestionController do require Logger plug(Pleroma.Web.ApiSpec.CastAndValidate) - plug(Pleroma.Plugs.OAuthScopesPlug, %{scopes: ["read"]} when action == :index) + plug(Pleroma.Web.Plugs.OAuthScopesPlug, %{scopes: ["read"]} when action == :index) def open_api_operation(action) do operation = String.to_existing_atom("#{action}_operation") diff --git a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex index cc410d4f4..74a4bf689 100644 --- a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex @@ -11,7 +11,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineController do alias Pleroma.Config alias Pleroma.Pagination alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub diff --git a/lib/pleroma/web/o_auth/o_auth_controller.ex b/lib/pleroma/web/o_auth/o_auth_controller.ex index a57e2bef4..65a2aa91b 100644 --- a/lib/pleroma/web/o_auth/o_auth_controller.ex +++ b/lib/pleroma/web/o_auth/o_auth_controller.ex @@ -31,7 +31,10 @@ defmodule Pleroma.Web.OAuth.OAuthController do plug(:fetch_session) plug(:fetch_flash) - plug(:skip_plug, [Pleroma.Plugs.OAuthScopesPlug, Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug]) + plug(:skip_plug, [ + Pleroma.Web.Plugs.OAuthScopesPlug, + Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug + ]) plug(RateLimiter, [name: :authentication] when action == :create_authorization) diff --git a/lib/pleroma/web/o_auth/scopes.ex b/lib/pleroma/web/o_auth/scopes.ex index 6f06f1431..90b9a0471 100644 --- a/lib/pleroma/web/o_auth/scopes.ex +++ b/lib/pleroma/web/o_auth/scopes.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Web.OAuth.Scopes do Functions for dealing with scopes. """ - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug @doc """ Fetch scopes from request params. diff --git a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex index d228a875e..8b9cf410f 100644 --- a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex @@ -9,7 +9,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountController do only: [json_response: 3, add_link_headers: 2, assign_account_by_id: 2] alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub diff --git a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex index e667831c5..de0bc96c3 100644 --- a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex @@ -11,7 +11,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatController do alias Pleroma.Chat.MessageReference alias Pleroma.Object alias Pleroma.Pagination - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Repo alias Pleroma.User alias Pleroma.Web.CommonAPI diff --git a/lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex b/lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex index 3d007f324..278616065 100644 --- a/lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex @@ -8,7 +8,7 @@ defmodule Pleroma.Web.PleromaAPI.ConversationController do import Pleroma.Web.ControllerHelper, only: [add_link_headers: 2] alias Pleroma.Conversation.Participation - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.MastodonAPI.StatusView diff --git a/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex index a0e5c739a..81ba69017 100644 --- a/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex @@ -10,7 +10,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackController do plug(Pleroma.Web.ApiSpec.CastAndValidate) plug( - Pleroma.Plugs.OAuthScopesPlug, + Pleroma.Web.Plugs.OAuthScopesPlug, %{scopes: ["write"], admin: true} when action in [ :import_from_filesystem, @@ -22,8 +22,11 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackController do ] ) - @skip_plugs [Pleroma.Plugs.OAuthScopesPlug, Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug] - plug(:skip_plug, @skip_plugs when action in [:index, :show, :archive]) + @skip_plugs [ + Pleroma.Web.Plugs.OAuthScopesPlug, + Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug + ] + plug(:skip_plug, @skip_plugs when action in [:index, :archive, :show]) defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaEmojiPackOperation diff --git a/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex index 7f9254c13..110c7ba8c 100644 --- a/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiReactionController do alias Pleroma.Activity alias Pleroma.Object - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.CommonAPI alias Pleroma.Web.MastodonAPI.StatusView diff --git a/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex b/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex index df6c50ca5..25a46fafa 100644 --- a/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex @@ -5,7 +5,7 @@ defmodule Pleroma.Web.PleromaAPI.MascotController do use Pleroma.Web, :controller - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub diff --git a/lib/pleroma/web/pleroma_api/controllers/notification_controller.ex b/lib/pleroma/web/pleroma_api/controllers/notification_controller.ex index 3ed8bd294..fa32aaa84 100644 --- a/lib/pleroma/web/pleroma_api/controllers/notification_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/notification_controller.ex @@ -6,10 +6,14 @@ defmodule Pleroma.Web.PleromaAPI.NotificationController do use Pleroma.Web, :controller alias Pleroma.Notification - alias Pleroma.Plugs.OAuthScopesPlug plug(Pleroma.Web.ApiSpec.CastAndValidate) - plug(OAuthScopesPlug, %{scopes: ["write:notifications"]} when action == :mark_as_read) + + plug( + Pleroma.Web.Plugs.OAuthScopesPlug, + %{scopes: ["write:notifications"]} when action == :mark_as_read + ) + plug(:put_view, Pleroma.Web.MastodonAPI.NotificationView) defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaNotificationOperation diff --git a/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex b/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex index e9a4fba92..acaaa127f 100644 --- a/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Web.PleromaAPI.ScrobbleController do import Pleroma.Web.ControllerHelper, only: [add_link_headers: 2] - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.CommonAPI diff --git a/lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex b/lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex index b86791d09..7419e9a3c 100644 --- a/lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex @@ -10,7 +10,7 @@ defmodule Pleroma.Web.PleromaAPI.TwoFactorAuthenticationController do alias Pleroma.MFA alias Pleroma.MFA.TOTP - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.CommonAPI.Utils plug(OAuthScopesPlug, %{scopes: ["read:security"]} when action in [:settings]) diff --git a/lib/pleroma/web/plugs/authentication_plug.ex b/lib/pleroma/web/plugs/authentication_plug.ex index 057ea42f1..a8a4a8380 100644 --- a/lib/pleroma/web/plugs/authentication_plug.ex +++ b/lib/pleroma/web/plugs/authentication_plug.ex @@ -3,7 +3,6 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Plugs.AuthenticationPlug do - alias Pleroma.Plugs.OAuthScopesPlug alias Pleroma.User import Plug.Conn @@ -65,7 +64,7 @@ def call( conn |> assign(:user, auth_user) - |> OAuthScopesPlug.skip_plug() + |> Pleroma.Web.Plugs.OAuthScopesPlug.skip_plug() else conn end diff --git a/lib/pleroma/web/plugs/legacy_authentication_plug.ex b/lib/pleroma/web/plugs/legacy_authentication_plug.ex index d346e01a6..a770816e1 100644 --- a/lib/pleroma/web/plugs/legacy_authentication_plug.ex +++ b/lib/pleroma/web/plugs/legacy_authentication_plug.ex @@ -5,7 +5,6 @@ defmodule Pleroma.Plugs.LegacyAuthenticationPlug do import Plug.Conn - alias Pleroma.Plugs.OAuthScopesPlug alias Pleroma.User def init(options) do @@ -29,7 +28,7 @@ def call( conn |> assign(:auth_user, user) |> assign(:user, user) - |> OAuthScopesPlug.skip_plug() + |> Pleroma.Web.Plugs.OAuthScopesPlug.skip_plug() else _ -> conn diff --git a/lib/pleroma/web/plugs/o_auth_scopes_plug.ex b/lib/pleroma/web/plugs/o_auth_scopes_plug.ex index b1a736d78..cfc30837c 100644 --- a/lib/pleroma/web/plugs/o_auth_scopes_plug.ex +++ b/lib/pleroma/web/plugs/o_auth_scopes_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.OAuthScopesPlug do +defmodule Pleroma.Web.Plugs.OAuthScopesPlug do import Plug.Conn import Pleroma.Web.Gettext diff --git a/lib/pleroma/web/twitter_api/controller.ex b/lib/pleroma/web/twitter_api/controller.ex index c2de26b0b..429d8013b 100644 --- a/lib/pleroma/web/twitter_api/controller.ex +++ b/lib/pleroma/web/twitter_api/controller.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do alias Pleroma.Notification alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.OAuth.Token alias Pleroma.Web.TwitterAPI.TokenView diff --git a/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex b/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex index 072d889e2..0e39f2812 100644 --- a/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex @@ -10,7 +10,6 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowController do alias Pleroma.Activity alias Pleroma.MFA alias Pleroma.Object.Fetcher - alias Pleroma.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.Auth.Authenticator alias Pleroma.Web.Auth.TOTPAuthenticator @@ -22,7 +21,7 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowController do # Note: follower can submit the form (with password auth) not being signed in (having no token) plug( - OAuthScopesPlug, + Pleroma.Web.Plugs.OAuthScopesPlug, %{fallback: :proceed_unauthenticated, scopes: ["follow", "write:follows"]} when action in [:do_follow] ) diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex index 6d827846d..db5684a91 100644 --- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex @@ -11,7 +11,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do alias Pleroma.Emoji alias Pleroma.Healthcheck alias Pleroma.Notification - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.CommonAPI alias Pleroma.Web.WebFinger diff --git a/test/pleroma/web/plugs/authentication_plug_test.exs b/test/pleroma/web/plugs/authentication_plug_test.exs index 0bc589fbe..5b6186e4e 100644 --- a/test/pleroma/web/plugs/authentication_plug_test.exs +++ b/test/pleroma/web/plugs/authentication_plug_test.exs @@ -6,7 +6,7 @@ defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Plugs.AuthenticationPlug - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.PlugHelper alias Pleroma.User diff --git a/test/pleroma/web/plugs/legacy_authentication_plug_test.exs b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs index 6a44c673e..a0e1a7909 100644 --- a/test/pleroma/web/plugs/legacy_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs @@ -8,7 +8,7 @@ defmodule Pleroma.Web.Plugs.LegacyAuthenticationPlugTest do import Pleroma.Factory alias Pleroma.Plugs.LegacyAuthenticationPlug - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.PlugHelper alias Pleroma.User diff --git a/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs index 6a7676c8a..c8944f971 100644 --- a/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs +++ b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs @@ -5,7 +5,7 @@ defmodule Pleroma.Web.Plugs.OAuthScopesPlugTest do use Pleroma.Web.ConnCase - alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Repo import Mock From 96d320bdfecdb147cfbd7e74156f546885821915 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 09:59:21 +0300 Subject: [PATCH 28/62] OAuthPlug module name --- lib/pleroma/web/plugs/o_auth_plug.ex | 2 +- lib/pleroma/web/router.ex | 4 ++-- test/pleroma/web/plugs/o_auth_plug_test.exs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/plugs/o_auth_plug.ex b/lib/pleroma/web/plugs/o_auth_plug.ex index 6fa71ef47..c7b58d90f 100644 --- a/lib/pleroma/web/plugs/o_auth_plug.ex +++ b/lib/pleroma/web/plugs/o_auth_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.OAuthPlug do +defmodule Pleroma.Web.Plugs.OAuthPlug do import Plug.Conn import Ecto.Query diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index f90933e5a..2deb4bbbb 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -12,7 +12,7 @@ defmodule Pleroma.Web.Router do pipeline :oauth do plug(:fetch_session) - plug(Pleroma.Plugs.OAuthPlug) + plug(Pleroma.Web.Plugs.OAuthPlug) plug(Pleroma.Web.Plugs.UserEnabledPlug) end @@ -25,7 +25,7 @@ defmodule Pleroma.Web.Router do end pipeline :authenticate do - plug(Pleroma.Plugs.OAuthPlug) + plug(Pleroma.Web.Plugs.OAuthPlug) plug(Pleroma.Plugs.BasicAuthDecoderPlug) plug(Pleroma.Web.Plugs.UserFetcherPlug) plug(Pleroma.Web.Plugs.SessionAuthenticationPlug) diff --git a/test/pleroma/web/plugs/o_auth_plug_test.exs b/test/pleroma/web/plugs/o_auth_plug_test.exs index f4df8f4cb..b9d722f76 100644 --- a/test/pleroma/web/plugs/o_auth_plug_test.exs +++ b/test/pleroma/web/plugs/o_auth_plug_test.exs @@ -5,7 +5,7 @@ defmodule Pleroma.Web.Plugs.OAuthPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.OAuthPlug + alias Pleroma.Web.Plugs.OAuthPlug import Pleroma.Factory @session_opts [ From e2332d92ceae60cf333b9ad930f80410daf6615e Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 10:01:40 +0300 Subject: [PATCH 29/62] LegacyAuthenticationPlug module name --- docs/dev.md | 2 +- lib/pleroma/web/plugs/legacy_authentication_plug.ex | 2 +- lib/pleroma/web/router.ex | 2 +- test/pleroma/web/plugs/legacy_authentication_plug_test.exs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/dev.md b/docs/dev.md index 085d66760..e3e04c8eb 100644 --- a/docs/dev.md +++ b/docs/dev.md @@ -16,7 +16,7 @@ This document contains notes and guidelines for Pleroma developers. ## [HTTP Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization) -* With HTTP Basic Auth, OAuth scopes check is _not_ performed for any action (since password is provided during the auth, requester is able to obtain a token with full permissions anyways). `Pleroma.Plugs.AuthenticationPlug` and `Pleroma.Plugs.LegacyAuthenticationPlug` both call `Pleroma.Web.Plugs.OAuthScopesPlug.skip_plug(conn)` when password is provided. +* With HTTP Basic Auth, OAuth scopes check is _not_ performed for any action (since password is provided during the auth, requester is able to obtain a token with full permissions anyways). `Pleroma.Plugs.AuthenticationPlug` and `Pleroma.Web.Plugs.LegacyAuthenticationPlug` both call `Pleroma.Web.Plugs.OAuthScopesPlug.skip_plug(conn)` when password is provided. ## Auth-related configuration, OAuth consumer mode etc. diff --git a/lib/pleroma/web/plugs/legacy_authentication_plug.ex b/lib/pleroma/web/plugs/legacy_authentication_plug.ex index a770816e1..2a54d0b59 100644 --- a/lib/pleroma/web/plugs/legacy_authentication_plug.ex +++ b/lib/pleroma/web/plugs/legacy_authentication_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.LegacyAuthenticationPlug do +defmodule Pleroma.Web.Plugs.LegacyAuthenticationPlug do import Plug.Conn alias Pleroma.User diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 2deb4bbbb..11a8e509c 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -29,7 +29,7 @@ defmodule Pleroma.Web.Router do plug(Pleroma.Plugs.BasicAuthDecoderPlug) plug(Pleroma.Web.Plugs.UserFetcherPlug) plug(Pleroma.Web.Plugs.SessionAuthenticationPlug) - plug(Pleroma.Plugs.LegacyAuthenticationPlug) + plug(Pleroma.Web.Plugs.LegacyAuthenticationPlug) plug(Pleroma.Plugs.AuthenticationPlug) end diff --git a/test/pleroma/web/plugs/legacy_authentication_plug_test.exs b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs index a0e1a7909..0a2f6f22f 100644 --- a/test/pleroma/web/plugs/legacy_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs @@ -7,7 +7,7 @@ defmodule Pleroma.Web.Plugs.LegacyAuthenticationPlugTest do import Pleroma.Factory - alias Pleroma.Plugs.LegacyAuthenticationPlug + alias Pleroma.Web.Plugs.LegacyAuthenticationPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.PlugHelper alias Pleroma.User From 8dfaa54ffc114ea1af205026737f6e8be5af2ccd Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 10:03:10 +0300 Subject: [PATCH 30/62] InstanceStatic module name --- lib/pleroma/web/endpoint.ex | 2 +- lib/pleroma/web/fallback/redirect_controller.ex | 2 +- lib/pleroma/web/plugs/instance_static.ex | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index 003bb1194..db3971558 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -19,7 +19,7 @@ defmodule Pleroma.Web.Endpoint do # InstanceStatic needs to be before Plug.Static to be able to override shipped-static files # If you're adding new paths to `only:` you'll need to configure them in InstanceStatic as well # Cache-control headers are duplicated in case we turn off etags in the future - plug(Pleroma.Plugs.InstanceStatic, + plug(Pleroma.Web.Plugs.InstanceStatic, at: "/", gzip: true, cache_control_for_etags: @static_cache_control, diff --git a/lib/pleroma/web/fallback/redirect_controller.ex b/lib/pleroma/web/fallback/redirect_controller.ex index a7b36a34b..6f759d559 100644 --- a/lib/pleroma/web/fallback/redirect_controller.ex +++ b/lib/pleroma/web/fallback/redirect_controller.ex @@ -75,7 +75,7 @@ def empty(conn, _params) do end defp index_file_path do - Pleroma.Plugs.InstanceStatic.file_path("index.html") + Pleroma.Web.Plugs.InstanceStatic.file_path("index.html") end defp build_tags(conn, params) do diff --git a/lib/pleroma/web/plugs/instance_static.ex b/lib/pleroma/web/plugs/instance_static.ex index 0fb57e422..3e6aa826b 100644 --- a/lib/pleroma/web/plugs/instance_static.ex +++ b/lib/pleroma/web/plugs/instance_static.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.InstanceStatic do +defmodule Pleroma.Web.Plugs.InstanceStatic do require Pleroma.Constants @moduledoc """ From 5cd7030076a9dde9272321edf8f50b3367fc11c6 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 10:09:39 +0300 Subject: [PATCH 31/62] IdempotencyPlug module name --- lib/pleroma/web/plugs/idempotency_plug.ex | 2 +- lib/pleroma/web/router.ex | 6 +++--- test/pleroma/web/plugs/idempotency_plug_test.exs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/plugs/idempotency_plug.ex b/lib/pleroma/web/plugs/idempotency_plug.ex index f41397075..254a790b0 100644 --- a/lib/pleroma/web/plugs/idempotency_plug.ex +++ b/lib/pleroma/web/plugs/idempotency_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.IdempotencyPlug do +defmodule Pleroma.Web.Plugs.IdempotencyPlug do import Phoenix.Controller, only: [json: 2] import Plug.Conn diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 11a8e509c..ca9b65ac6 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -50,7 +50,7 @@ defmodule Pleroma.Web.Router do plug(:expect_public_instance_or_authentication) plug(:base_api) plug(:after_auth) - plug(Pleroma.Plugs.IdempotencyPlug) + plug(Pleroma.Web.Plugs.IdempotencyPlug) end pipeline :authenticated_api do @@ -58,7 +58,7 @@ defmodule Pleroma.Web.Router do plug(:base_api) plug(:after_auth) plug(Pleroma.Plugs.EnsureAuthenticatedPlug) - plug(Pleroma.Plugs.IdempotencyPlug) + plug(Pleroma.Web.Plugs.IdempotencyPlug) end pipeline :admin_api do @@ -68,7 +68,7 @@ defmodule Pleroma.Web.Router do plug(:after_auth) plug(Pleroma.Plugs.EnsureAuthenticatedPlug) plug(Pleroma.Web.Plugs.UserIsAdminPlug) - plug(Pleroma.Plugs.IdempotencyPlug) + plug(Pleroma.Web.Plugs.IdempotencyPlug) end pipeline :mastodon_html do diff --git a/test/pleroma/web/plugs/idempotency_plug_test.exs b/test/pleroma/web/plugs/idempotency_plug_test.exs index c7b8abcaf..4a7835993 100644 --- a/test/pleroma/web/plugs/idempotency_plug_test.exs +++ b/test/pleroma/web/plugs/idempotency_plug_test.exs @@ -6,7 +6,7 @@ defmodule Pleroma.Web.Plugs.IdempotencyPlugTest do use ExUnit.Case, async: true use Plug.Test - alias Pleroma.Plugs.IdempotencyPlug + alias Pleroma.Web.Plugs.IdempotencyPlug alias Plug.Conn test "returns result from cache" do From abc3c7689b82cf166ba9f759e58fcbd15dfbf3a4 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 10:39:17 +0300 Subject: [PATCH 32/62] HTTPSecurityPlug module name and filename --- lib/pleroma/application.ex | 2 +- lib/pleroma/web/endpoint.ex | 2 +- lib/pleroma/web/plugs/http_security_plug.ex | 2 +- .../web/plugs/{http_signature.ex => http_signature_plug.ex} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename lib/pleroma/web/plugs/{http_signature.ex => http_signature_plug.ex} (100%) diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index 0f39c7d92..958e32db2 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -52,7 +52,7 @@ def start(_type, _args) do Pleroma.HTML.compile_scrubbers() Pleroma.Config.Oban.warn() Config.DeprecationWarnings.warn() - Pleroma.Plugs.HTTPSecurityPlug.warn_if_disabled() + Pleroma.Web.Plugs.HTTPSecurityPlug.warn_if_disabled() Pleroma.ApplicationRequirements.verify!() setup_instrumenters() load_custom_modules() diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index db3971558..6acca0db6 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -11,7 +11,7 @@ defmodule Pleroma.Web.Endpoint do plug(Pleroma.Web.Plugs.SetLocalePlug) plug(CORSPlug) - plug(Pleroma.Plugs.HTTPSecurityPlug) + plug(Pleroma.Web.Plugs.HTTPSecurityPlug) plug(Pleroma.Web.Plugs.UploadedMedia) @static_cache_control "public, no-cache" diff --git a/lib/pleroma/web/plugs/http_security_plug.ex b/lib/pleroma/web/plugs/http_security_plug.ex index c363b193b..45aaf188e 100644 --- a/lib/pleroma/web/plugs/http_security_plug.ex +++ b/lib/pleroma/web/plugs/http_security_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.HTTPSecurityPlug do +defmodule Pleroma.Web.Plugs.HTTPSecurityPlug do alias Pleroma.Config import Plug.Conn diff --git a/lib/pleroma/web/plugs/http_signature.ex b/lib/pleroma/web/plugs/http_signature_plug.ex similarity index 100% rename from lib/pleroma/web/plugs/http_signature.ex rename to lib/pleroma/web/plugs/http_signature_plug.ex From 8c993c5f6322c09c8b88e62aa23865648aab3690 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 10:41:09 +0300 Subject: [PATCH 33/62] FederatingPlug module name --- lib/pleroma/web/activity_pub/activity_pub_controller.ex | 2 +- lib/pleroma/web/o_status/o_status_controller.ex | 2 +- lib/pleroma/web/plugs/federating_plug.ex | 2 +- lib/pleroma/web/static_fe/static_fe_controller.ex | 2 +- .../web/twitter_api/controllers/remote_follow_controller.ex | 2 +- lib/pleroma/web/twitter_api/controllers/util_controller.ex | 2 +- lib/pleroma/web/web_finger/web_finger_controller.ex | 2 +- test/pleroma/web/plugs/federating_plug_test.exs | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index 732c44271..5de51c0c7 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -23,7 +23,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.ControllerHelper alias Pleroma.Web.Endpoint - alias Pleroma.Web.FederatingPlug + alias Pleroma.Web.Plugs.FederatingPlug alias Pleroma.Web.Federator require Logger diff --git a/lib/pleroma/web/o_status/o_status_controller.ex b/lib/pleroma/web/o_status/o_status_controller.ex index 5bd767c96..f6069e4f3 100644 --- a/lib/pleroma/web/o_status/o_status_controller.ex +++ b/lib/pleroma/web/o_status/o_status_controller.ex @@ -17,7 +17,7 @@ defmodule Pleroma.Web.OStatus.OStatusController do alias Pleroma.Web.Router plug(Pleroma.Plugs.EnsureAuthenticatedPlug, - unless_func: &Pleroma.Web.FederatingPlug.federating?/1 + unless_func: &Pleroma.Web.Plugs.FederatingPlug.federating?/1 ) plug( diff --git a/lib/pleroma/web/plugs/federating_plug.ex b/lib/pleroma/web/plugs/federating_plug.ex index 09038f3c6..3c90a7644 100644 --- a/lib/pleroma/web/plugs/federating_plug.ex +++ b/lib/pleroma/web/plugs/federating_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.FederatingPlug do +defmodule Pleroma.Web.Plugs.FederatingPlug do import Plug.Conn def init(options) do diff --git a/lib/pleroma/web/static_fe/static_fe_controller.ex b/lib/pleroma/web/static_fe/static_fe_controller.ex index a7a891b13..cc408ab5c 100644 --- a/lib/pleroma/web/static_fe/static_fe_controller.ex +++ b/lib/pleroma/web/static_fe/static_fe_controller.ex @@ -18,7 +18,7 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do plug(:assign_id) plug(Pleroma.Plugs.EnsureAuthenticatedPlug, - unless_func: &Pleroma.Web.FederatingPlug.federating?/1 + unless_func: &Pleroma.Web.Plugs.FederatingPlug.federating?/1 ) @page_keys ["max_id", "min_id", "limit", "since_id", "order"] diff --git a/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex b/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex index 0e39f2812..4480a4922 100644 --- a/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex @@ -17,7 +17,7 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowController do @status_types ["Article", "Event", "Note", "Video", "Page", "Question"] - plug(Pleroma.Web.FederatingPlug) + plug(Pleroma.Web.Plugs.FederatingPlug) # Note: follower can submit the form (with password auth) not being signed in (having no token) plug( diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex index db5684a91..f97bd4823 100644 --- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex @@ -16,7 +16,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do alias Pleroma.Web.CommonAPI alias Pleroma.Web.WebFinger - plug(Pleroma.Web.FederatingPlug when action == :remote_subscribe) + plug(Pleroma.Web.Plugs.FederatingPlug when action == :remote_subscribe) plug( OAuthScopesPlug, diff --git a/lib/pleroma/web/web_finger/web_finger_controller.ex b/lib/pleroma/web/web_finger/web_finger_controller.ex index 14cb87df8..9f0938fc0 100644 --- a/lib/pleroma/web/web_finger/web_finger_controller.ex +++ b/lib/pleroma/web/web_finger/web_finger_controller.ex @@ -8,7 +8,7 @@ defmodule Pleroma.Web.WebFinger.WebFingerController do alias Pleroma.Web.WebFinger plug(Pleroma.Web.Plugs.SetFormatPlug) - plug(Pleroma.Web.FederatingPlug) + plug(Pleroma.Web.Plugs.FederatingPlug) def host_meta(conn, _params) do xml = WebFinger.host_meta() diff --git a/test/pleroma/web/plugs/federating_plug_test.exs b/test/pleroma/web/plugs/federating_plug_test.exs index a39fe8adb..a4652f6c5 100644 --- a/test/pleroma/web/plugs/federating_plug_test.exs +++ b/test/pleroma/web/plugs/federating_plug_test.exs @@ -12,7 +12,7 @@ test "returns and halt the conn when federating is disabled" do conn = build_conn() - |> Pleroma.Web.FederatingPlug.call(%{}) + |> Pleroma.Web.Plugs.FederatingPlug.call(%{}) assert conn.status == 404 assert conn.halted @@ -23,7 +23,7 @@ test "does nothing when federating is enabled" do conn = build_conn() - |> Pleroma.Web.FederatingPlug.call(%{}) + |> Pleroma.Web.Plugs.FederatingPlug.call(%{}) refute conn.status refute conn.halted From 99e4ed21b19d989112cf26141c3f87f9fe12b72b Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 10:43:19 +0300 Subject: [PATCH 34/62] ExpectPublicOrAuthenticatedCheckPlug module name --- lib/pleroma/web.ex | 2 +- .../web/plugs/expect_public_or_authenticated_check_plug.ex | 2 +- lib/pleroma/web/router.ex | 2 +- test/pleroma/web/plugs/plug_helper_test.exs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web.ex b/lib/pleroma/web.ex index 96fe4fdc6..4056d161d 100644 --- a/lib/pleroma/web.ex +++ b/lib/pleroma/web.ex @@ -23,7 +23,7 @@ defmodule Pleroma.Web do alias Pleroma.Plugs.EnsureAuthenticatedPlug alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Plugs.ExpectAuthenticatedCheckPlug - alias Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug + alias Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.PlugHelper diff --git a/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex b/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex index ba0ef76bd..d1b66efae 100644 --- a/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex +++ b/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug do +defmodule Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug do @moduledoc """ Marks `Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug` as expected to be executed later in plug chain. diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index ca9b65ac6..ed22158bc 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -21,7 +21,7 @@ defmodule Pleroma.Web.Router do end pipeline :expect_public_instance_or_authentication do - plug(Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug) + plug(Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug) end pipeline :authenticate do diff --git a/test/pleroma/web/plugs/plug_helper_test.exs b/test/pleroma/web/plugs/plug_helper_test.exs index 6febd4388..adb0bb111 100644 --- a/test/pleroma/web/plugs/plug_helper_test.exs +++ b/test/pleroma/web/plugs/plug_helper_test.exs @@ -6,7 +6,7 @@ defmodule Pleroma.Web.Plugs.PlugHelperTest do @moduledoc "Tests for the functionality added via `use Pleroma.Web, :plug`" alias Pleroma.Plugs.ExpectAuthenticatedCheckPlug - alias Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug + alias Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug alias Pleroma.Web.Plugs.PlugHelper import Mock From d6cb1a3b4627b40b9d347e4b05d0589e3a584166 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 10:44:50 +0300 Subject: [PATCH 35/62] ExpectAuthenticatedCheckPlug module name --- lib/pleroma/web.ex | 2 +- lib/pleroma/web/plugs/expect_authenticated_check_plug.ex | 2 +- lib/pleroma/web/router.ex | 2 +- test/pleroma/web/plugs/plug_helper_test.exs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web.ex b/lib/pleroma/web.ex index 4056d161d..34656c953 100644 --- a/lib/pleroma/web.ex +++ b/lib/pleroma/web.ex @@ -22,7 +22,7 @@ defmodule Pleroma.Web do alias Pleroma.Plugs.EnsureAuthenticatedPlug alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug - alias Pleroma.Plugs.ExpectAuthenticatedCheckPlug + alias Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug alias Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.PlugHelper diff --git a/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex b/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex index 66b8d5de5..1fa742717 100644 --- a/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex +++ b/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.ExpectAuthenticatedCheckPlug do +defmodule Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug do @moduledoc """ Marks `Pleroma.Plugs.EnsureAuthenticatedPlug` as expected to be executed later in plug chain. diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index ed22158bc..b9d8c4845 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -17,7 +17,7 @@ defmodule Pleroma.Web.Router do end pipeline :expect_authentication do - plug(Pleroma.Plugs.ExpectAuthenticatedCheckPlug) + plug(Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug) end pipeline :expect_public_instance_or_authentication do diff --git a/test/pleroma/web/plugs/plug_helper_test.exs b/test/pleroma/web/plugs/plug_helper_test.exs index adb0bb111..670d699f0 100644 --- a/test/pleroma/web/plugs/plug_helper_test.exs +++ b/test/pleroma/web/plugs/plug_helper_test.exs @@ -5,7 +5,7 @@ defmodule Pleroma.Web.Plugs.PlugHelperTest do @moduledoc "Tests for the functionality added via `use Pleroma.Web, :plug`" - alias Pleroma.Plugs.ExpectAuthenticatedCheckPlug + alias Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug alias Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug alias Pleroma.Web.Plugs.PlugHelper From 8e301a4c37543f819f659b89b20673141f1e9b75 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 10:49:18 +0300 Subject: [PATCH 36/62] EnsureUserKeyPlug module name --- lib/pleroma/web/plugs/ensure_user_key_plug.ex | 2 +- lib/pleroma/web/router.ex | 4 ++-- test/pleroma/web/plugs/ensure_user_key_plug_test.exs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/plugs/ensure_user_key_plug.ex b/lib/pleroma/web/plugs/ensure_user_key_plug.ex index 9795cdbde..70d3091f0 100644 --- a/lib/pleroma/web/plugs/ensure_user_key_plug.ex +++ b/lib/pleroma/web/plugs/ensure_user_key_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.EnsureUserKeyPlug do +defmodule Pleroma.Web.Plugs.EnsureUserKeyPlug do import Plug.Conn def init(opts) do diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index b9d8c4845..6dc7a777b 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -36,7 +36,7 @@ defmodule Pleroma.Web.Router do pipeline :after_auth do plug(Pleroma.Web.Plugs.UserEnabledPlug) plug(Pleroma.Web.Plugs.SetUserSessionIdPlug) - plug(Pleroma.Plugs.EnsureUserKeyPlug) + plug(Pleroma.Web.Plugs.EnsureUserKeyPlug) end pipeline :base_api do @@ -80,7 +80,7 @@ defmodule Pleroma.Web.Router do pipeline :pleroma_html do plug(:browser) plug(:authenticate) - plug(Pleroma.Plugs.EnsureUserKeyPlug) + plug(Pleroma.Web.Plugs.EnsureUserKeyPlug) end pipeline :well_known do diff --git a/test/pleroma/web/plugs/ensure_user_key_plug_test.exs b/test/pleroma/web/plugs/ensure_user_key_plug_test.exs index 474510101..f912ef755 100644 --- a/test/pleroma/web/plugs/ensure_user_key_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_user_key_plug_test.exs @@ -5,7 +5,7 @@ defmodule Pleroma.Web.Plugs.EnsureUserKeyPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.EnsureUserKeyPlug + alias Pleroma.Web.Plugs.EnsureUserKeyPlug test "if the conn has a user key set, it does nothing", %{conn: conn} do conn = From 011525a3d1260ec6814c36bb08feb4cbd3116d4a Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 10:53:10 +0300 Subject: [PATCH 37/62] EnsurePublicOrAuthenticatedPlug module name --- lib/pleroma/tests/auth_test_controller.ex | 2 +- lib/pleroma/web.ex | 2 +- lib/pleroma/web/masto_fe_controller.ex | 2 +- .../web/mastodon_api/controllers/account_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/app_controller.ex | 2 +- .../web/mastodon_api/controllers/custom_emoji_controller.ex | 2 +- .../web/mastodon_api/controllers/instance_controller.ex | 2 +- .../web/mastodon_api/controllers/mastodon_api_controller.ex | 2 +- .../web/mastodon_api/controllers/status_controller.ex | 6 +++++- .../web/mastodon_api/controllers/timeline_controller.ex | 2 +- lib/pleroma/web/o_auth/o_auth_controller.ex | 2 +- .../web/pleroma_api/controllers/account_controller.ex | 2 +- .../web/plugs/ensure_public_or_authenticated_plug.ex | 2 +- .../web/plugs/expect_public_or_authenticated_check_plug.ex | 2 +- lib/pleroma/web/twitter_api/controller.ex | 2 +- .../web/plugs/ensure_public_or_authenticated_plug_test.exs | 2 +- 16 files changed, 20 insertions(+), 16 deletions(-) diff --git a/lib/pleroma/tests/auth_test_controller.ex b/lib/pleroma/tests/auth_test_controller.ex index 296cae522..320df7e5a 100644 --- a/lib/pleroma/tests/auth_test_controller.ex +++ b/lib/pleroma/tests/auth_test_controller.ex @@ -8,7 +8,7 @@ defmodule Pleroma.Tests.AuthTestController do use Pleroma.Web, :controller - alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User diff --git a/lib/pleroma/web.ex b/lib/pleroma/web.ex index 34656c953..667ef67a8 100644 --- a/lib/pleroma/web.ex +++ b/lib/pleroma/web.ex @@ -21,7 +21,7 @@ defmodule Pleroma.Web do """ alias Pleroma.Plugs.EnsureAuthenticatedPlug - alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug alias Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug alias Pleroma.Web.Plugs.OAuthScopesPlug diff --git a/lib/pleroma/web/masto_fe_controller.ex b/lib/pleroma/web/masto_fe_controller.ex index 6e348db14..8d99f8907 100644 --- a/lib/pleroma/web/masto_fe_controller.ex +++ b/lib/pleroma/web/masto_fe_controller.ex @@ -5,7 +5,7 @@ defmodule Pleroma.Web.MastoFEController do use Pleroma.Web, :controller - alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex index 518fa775c..1c8199504 100644 --- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex @@ -15,7 +15,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do ] alias Pleroma.Maps - alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.User diff --git a/lib/pleroma/web/mastodon_api/controllers/app_controller.ex b/lib/pleroma/web/mastodon_api/controllers/app_controller.ex index 098859cd3..ed2f92fa6 100644 --- a/lib/pleroma/web/mastodon_api/controllers/app_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/app_controller.ex @@ -5,7 +5,7 @@ defmodule Pleroma.Web.MastodonAPI.AppController do use Pleroma.Web, :controller - alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Repo alias Pleroma.Web.OAuth.App diff --git a/lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex b/lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex index 29f1fdb9a..872cb1f4d 100644 --- a/lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex @@ -9,7 +9,7 @@ defmodule Pleroma.Web.MastodonAPI.CustomEmojiController do plug( :skip_plug, - [Pleroma.Web.Plugs.OAuthScopesPlug, Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug] + [Pleroma.Web.Plugs.OAuthScopesPlug, Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug] when action == :index ) diff --git a/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex b/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex index 1280f10cb..07a32491a 100644 --- a/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex @@ -9,7 +9,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceController do plug( :skip_plug, - [Pleroma.Web.Plugs.OAuthScopesPlug, Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug] + [Pleroma.Web.Plugs.OAuthScopesPlug, Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug] when action in [:show, :peers] ) diff --git a/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex index 12c99d8c8..9cf682c7b 100644 --- a/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex @@ -17,7 +17,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do plug( :skip_plug, - [Pleroma.Web.Plugs.OAuthScopesPlug, Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug] + [Pleroma.Web.Plugs.OAuthScopesPlug, Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug] when action in [:empty_array, :empty_object] ) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index c160ac27d..ec2605022 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -25,7 +25,11 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do alias Pleroma.Web.MastodonAPI.ScheduledActivityView plug(Pleroma.Web.ApiSpec.CastAndValidate) - plug(:skip_plug, Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug when action in [:index, :show]) + + plug( + :skip_plug, + Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug when action in [:index, :show] + ) @unauthenticated_access %{fallback: :proceed_unauthenticated, scopes: []} diff --git a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex index 74a4bf689..834452dd6 100644 --- a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex @@ -10,7 +10,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineController do alias Pleroma.Config alias Pleroma.Pagination - alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.User diff --git a/lib/pleroma/web/o_auth/o_auth_controller.ex b/lib/pleroma/web/o_auth/o_auth_controller.ex index 65a2aa91b..782617021 100644 --- a/lib/pleroma/web/o_auth/o_auth_controller.ex +++ b/lib/pleroma/web/o_auth/o_auth_controller.ex @@ -33,7 +33,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do plug(:skip_plug, [ Pleroma.Web.Plugs.OAuthScopesPlug, - Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug + Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug ]) plug(RateLimiter, [name: :authentication] when action == :create_authorization) diff --git a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex index 8b9cf410f..90c63b4f5 100644 --- a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex @@ -8,7 +8,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountController do import Pleroma.Web.ControllerHelper, only: [json_response: 3, add_link_headers: 2, assign_account_by_id: 2] - alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.User diff --git a/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex b/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex index 7265bb87a..3bebdac6d 100644 --- a/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex +++ b/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug do +defmodule Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug do import Pleroma.Web.TranslationHelpers import Plug.Conn diff --git a/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex b/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex index d1b66efae..ace512a78 100644 --- a/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex +++ b/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex @@ -4,7 +4,7 @@ defmodule Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug do @moduledoc """ - Marks `Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug` as expected to be executed later in plug + Marks `Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug` as expected to be executed later in plug chain. No-op plug which affects `Pleroma.Web` operation (is checked with `PlugHelper.plug_called?/2`). diff --git a/lib/pleroma/web/twitter_api/controller.ex b/lib/pleroma/web/twitter_api/controller.ex index 429d8013b..dc9c41f16 100644 --- a/lib/pleroma/web/twitter_api/controller.ex +++ b/lib/pleroma/web/twitter_api/controller.ex @@ -6,7 +6,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do use Pleroma.Web, :controller alias Pleroma.Notification - alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.OAuth.Token diff --git a/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs index 9cd5bc715..a73175fa6 100644 --- a/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs @@ -6,7 +6,7 @@ defmodule Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Config - alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.User setup do: clear_config([:instance, :public]) From c6baa811d69f25879ca77d0a25b527baec60d42e Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 10:55:56 +0300 Subject: [PATCH 38/62] EnsureAuthenticatedPlug module name --- lib/pleroma/web.ex | 2 +- lib/pleroma/web/activity_pub/activity_pub_controller.ex | 2 +- lib/pleroma/web/feed/user_controller.ex | 2 +- lib/pleroma/web/o_status/o_status_controller.ex | 2 +- lib/pleroma/web/plugs/ensure_authenticated_plug.ex | 2 +- lib/pleroma/web/plugs/expect_authenticated_check_plug.ex | 2 +- lib/pleroma/web/router.ex | 4 ++-- lib/pleroma/web/static_fe/static_fe_controller.ex | 2 +- test/pleroma/web/plugs/ensure_authenticated_plug_test.exs | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/pleroma/web.ex b/lib/pleroma/web.ex index 667ef67a8..7779826e3 100644 --- a/lib/pleroma/web.ex +++ b/lib/pleroma/web.ex @@ -20,7 +20,7 @@ defmodule Pleroma.Web do below. """ - alias Pleroma.Plugs.EnsureAuthenticatedPlug + alias Pleroma.Web.Plugs.EnsureAuthenticatedPlug alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug alias Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index 5de51c0c7..4bdb2e38b 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -9,7 +9,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do alias Pleroma.Delivery alias Pleroma.Object alias Pleroma.Object.Fetcher - alias Pleroma.Plugs.EnsureAuthenticatedPlug + alias Pleroma.Web.Plugs.EnsureAuthenticatedPlug alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.ActivityPub.Builder diff --git a/lib/pleroma/web/feed/user_controller.ex b/lib/pleroma/web/feed/user_controller.ex index 6aad6af44..1ecb8fda6 100644 --- a/lib/pleroma/web/feed/user_controller.ex +++ b/lib/pleroma/web/feed/user_controller.ex @@ -23,7 +23,7 @@ def feed_redirect(%{assigns: %{format: "html"}} = conn, %{"nickname" => nickname def feed_redirect(%{assigns: %{format: format}} = conn, _params) when format in ["json", "activity+json"] do with %{halted: false} = conn <- - Pleroma.Plugs.EnsureAuthenticatedPlug.call(conn, + Pleroma.Web.Plugs.EnsureAuthenticatedPlug.call(conn, unless_func: &Pleroma.Web.FederatingPlug.federating?/1 ) do ActivityPubController.call(conn, :user) diff --git a/lib/pleroma/web/o_status/o_status_controller.ex b/lib/pleroma/web/o_status/o_status_controller.ex index f6069e4f3..b058200f1 100644 --- a/lib/pleroma/web/o_status/o_status_controller.ex +++ b/lib/pleroma/web/o_status/o_status_controller.ex @@ -16,7 +16,7 @@ defmodule Pleroma.Web.OStatus.OStatusController do alias Pleroma.Web.Metadata.PlayerView alias Pleroma.Web.Router - plug(Pleroma.Plugs.EnsureAuthenticatedPlug, + plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug, unless_func: &Pleroma.Web.Plugs.FederatingPlug.federating?/1 ) diff --git a/lib/pleroma/web/plugs/ensure_authenticated_plug.ex b/lib/pleroma/web/plugs/ensure_authenticated_plug.ex index 3fe550806..ea2af6881 100644 --- a/lib/pleroma/web/plugs/ensure_authenticated_plug.ex +++ b/lib/pleroma/web/plugs/ensure_authenticated_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.EnsureAuthenticatedPlug do +defmodule Pleroma.Web.Plugs.EnsureAuthenticatedPlug do import Plug.Conn import Pleroma.Web.TranslationHelpers diff --git a/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex b/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex index 1fa742717..0925ded4d 100644 --- a/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex +++ b/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex @@ -4,7 +4,7 @@ defmodule Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug do @moduledoc """ - Marks `Pleroma.Plugs.EnsureAuthenticatedPlug` as expected to be executed later in plug chain. + Marks `Pleroma.Web.Plugs.EnsureAuthenticatedPlug` as expected to be executed later in plug chain. No-op plug which affects `Pleroma.Web` operation (is checked with `PlugHelper.plug_called?/2`). """ diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 6dc7a777b..524674e1a 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -57,7 +57,7 @@ defmodule Pleroma.Web.Router do plug(:expect_authentication) plug(:base_api) plug(:after_auth) - plug(Pleroma.Plugs.EnsureAuthenticatedPlug) + plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug) plug(Pleroma.Web.Plugs.IdempotencyPlug) end @@ -66,7 +66,7 @@ defmodule Pleroma.Web.Router do plug(:base_api) plug(Pleroma.Plugs.AdminSecretAuthenticationPlug) plug(:after_auth) - plug(Pleroma.Plugs.EnsureAuthenticatedPlug) + plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug) plug(Pleroma.Web.Plugs.UserIsAdminPlug) plug(Pleroma.Web.Plugs.IdempotencyPlug) end diff --git a/lib/pleroma/web/static_fe/static_fe_controller.ex b/lib/pleroma/web/static_fe/static_fe_controller.ex index cc408ab5c..687b17df6 100644 --- a/lib/pleroma/web/static_fe/static_fe_controller.ex +++ b/lib/pleroma/web/static_fe/static_fe_controller.ex @@ -17,7 +17,7 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do plug(:put_view, Pleroma.Web.StaticFE.StaticFEView) plug(:assign_id) - plug(Pleroma.Plugs.EnsureAuthenticatedPlug, + plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug, unless_func: &Pleroma.Web.Plugs.FederatingPlug.federating?/1 ) diff --git a/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs index b87f4e103..35095e018 100644 --- a/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs @@ -5,7 +5,7 @@ defmodule Pleroma.Web.Plugs.EnsureAuthenticatedPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.EnsureAuthenticatedPlug + alias Pleroma.Web.Plugs.EnsureAuthenticatedPlug alias Pleroma.User describe "without :if_func / :unless_func options" do From 66e0b0065b2fd115b1239edfab70eef54c34af2d Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 11:08:43 +0300 Subject: [PATCH 39/62] Cache plug module name --- lib/pleroma/web/activity_pub/activity_pub_controller.ex | 2 +- lib/pleroma/web/plugs/cache.ex | 6 +++--- test/pleroma/web/plugs/cache_test.exs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index 4bdb2e38b..37e076f1b 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -46,7 +46,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do ) plug( - Pleroma.Plugs.Cache, + Pleroma.Web.Plugs.Cache, [query_params: false, tracking_fun: &__MODULE__.track_object_fetch/2] when action in [:activity, :object] ) diff --git a/lib/pleroma/web/plugs/cache.ex b/lib/pleroma/web/plugs/cache.ex index f65c2a189..6de01804a 100644 --- a/lib/pleroma/web/plugs/cache.ex +++ b/lib/pleroma/web/plugs/cache.ex @@ -2,19 +2,19 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.Cache do +defmodule Pleroma.Web.Plugs.Cache do @moduledoc """ Caches successful GET responses. To enable the cache add the plug to a router pipeline or controller: - plug(Pleroma.Plugs.Cache) + plug(Pleroma.Web.Plugs.Cache) ## Configuration To configure the plug you need to pass settings as the second argument to the `plug/2` macro: - plug(Pleroma.Plugs.Cache, [ttl: nil, query_params: true]) + plug(Pleroma.Web.Plugs.Cache, [ttl: nil, query_params: true]) Available options: diff --git a/test/pleroma/web/plugs/cache_test.exs b/test/pleroma/web/plugs/cache_test.exs index 105b170f0..93a66f5d3 100644 --- a/test/pleroma/web/plugs/cache_test.exs +++ b/test/pleroma/web/plugs/cache_test.exs @@ -6,7 +6,7 @@ defmodule Pleroma.Web.Plugs.CacheTest do use ExUnit.Case, async: true use Plug.Test - alias Pleroma.Plugs.Cache + alias Pleroma.Web.Plugs.Cache @miss_resp {200, [ From 970932689f0bf1772da4f81d4f092060fd251a58 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 11:09:13 +0300 Subject: [PATCH 40/62] DigestPlug rename --- lib/pleroma/web/plugs/{digest.ex => digest_plug.ex} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/pleroma/web/plugs/{digest.ex => digest_plug.ex} (100%) diff --git a/lib/pleroma/web/plugs/digest.ex b/lib/pleroma/web/plugs/digest_plug.ex similarity index 100% rename from lib/pleroma/web/plugs/digest.ex rename to lib/pleroma/web/plugs/digest_plug.ex From c1777e74796d3be4757826ddb3395fc0c13495ff Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 11:13:19 +0300 Subject: [PATCH 41/62] BasicAuthDecoderPlug module name --- lib/pleroma/web/plugs/basic_auth_decoder_plug.ex | 2 +- lib/pleroma/web/router.ex | 2 +- test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/plugs/basic_auth_decoder_plug.ex b/lib/pleroma/web/plugs/basic_auth_decoder_plug.ex index af7ecb0d8..4dadfb000 100644 --- a/lib/pleroma/web/plugs/basic_auth_decoder_plug.ex +++ b/lib/pleroma/web/plugs/basic_auth_decoder_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.BasicAuthDecoderPlug do +defmodule Pleroma.Web.Plugs.BasicAuthDecoderPlug do import Plug.Conn def init(options) do diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 524674e1a..46f007d3d 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -26,7 +26,7 @@ defmodule Pleroma.Web.Router do pipeline :authenticate do plug(Pleroma.Web.Plugs.OAuthPlug) - plug(Pleroma.Plugs.BasicAuthDecoderPlug) + plug(Pleroma.Web.Plugs.BasicAuthDecoderPlug) plug(Pleroma.Web.Plugs.UserFetcherPlug) plug(Pleroma.Web.Plugs.SessionAuthenticationPlug) plug(Pleroma.Web.Plugs.LegacyAuthenticationPlug) diff --git a/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs b/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs index 49f5ea238..2d6af228c 100644 --- a/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs +++ b/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs @@ -5,7 +5,7 @@ defmodule Pleroma.Web.Plugs.BasicAuthDecoderPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.BasicAuthDecoderPlug + alias Pleroma.Web.Plugs.BasicAuthDecoderPlug defp basic_auth_enc(username, password) do "Basic " <> Base.encode64("#{username}:#{password}") From c497558d433216c12a3335d138716a10d464a922 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 11:16:09 +0300 Subject: [PATCH 42/62] AuthenticationPlug module name --- docs/dev.md | 2 +- lib/pleroma/bbs/authenticator.ex | 2 +- lib/pleroma/web/auth/pleroma_authenticator.ex | 2 +- lib/pleroma/web/auth/totp_authenticator.ex | 2 +- lib/pleroma/web/common_api/utils.ex | 2 +- lib/pleroma/web/mongoose_im/mongoose_im_controller.ex | 2 +- lib/pleroma/web/plugs/authentication_plug.ex | 2 +- lib/pleroma/web/router.ex | 2 +- test/pleroma/web/plugs/authentication_plug_test.exs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/dev.md b/docs/dev.md index e3e04c8eb..22e0691f1 100644 --- a/docs/dev.md +++ b/docs/dev.md @@ -16,7 +16,7 @@ This document contains notes and guidelines for Pleroma developers. ## [HTTP Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization) -* With HTTP Basic Auth, OAuth scopes check is _not_ performed for any action (since password is provided during the auth, requester is able to obtain a token with full permissions anyways). `Pleroma.Plugs.AuthenticationPlug` and `Pleroma.Web.Plugs.LegacyAuthenticationPlug` both call `Pleroma.Web.Plugs.OAuthScopesPlug.skip_plug(conn)` when password is provided. +* With HTTP Basic Auth, OAuth scopes check is _not_ performed for any action (since password is provided during the auth, requester is able to obtain a token with full permissions anyways). `Pleroma.Web.Plugs.AuthenticationPlug` and `Pleroma.Web.Plugs.LegacyAuthenticationPlug` both call `Pleroma.Web.Plugs.OAuthScopesPlug.skip_plug(conn)` when password is provided. ## Auth-related configuration, OAuth consumer mode etc. diff --git a/lib/pleroma/bbs/authenticator.ex b/lib/pleroma/bbs/authenticator.ex index 815de7002..f837a103a 100644 --- a/lib/pleroma/bbs/authenticator.ex +++ b/lib/pleroma/bbs/authenticator.ex @@ -4,7 +4,7 @@ defmodule Pleroma.BBS.Authenticator do use Sshd.PasswordAuthenticator - alias Pleroma.Plugs.AuthenticationPlug + alias Pleroma.Web.Plugs.AuthenticationPlug alias Pleroma.User def authenticate(username, password) do diff --git a/lib/pleroma/web/auth/pleroma_authenticator.ex b/lib/pleroma/web/auth/pleroma_authenticator.ex index c611b3e09..36e7ff0fa 100644 --- a/lib/pleroma/web/auth/pleroma_authenticator.ex +++ b/lib/pleroma/web/auth/pleroma_authenticator.ex @@ -3,7 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Auth.PleromaAuthenticator do - alias Pleroma.Plugs.AuthenticationPlug + alias Pleroma.Web.Plugs.AuthenticationPlug alias Pleroma.Registration alias Pleroma.Repo alias Pleroma.User diff --git a/lib/pleroma/web/auth/totp_authenticator.ex b/lib/pleroma/web/auth/totp_authenticator.ex index 1794e407c..b4df422fe 100644 --- a/lib/pleroma/web/auth/totp_authenticator.ex +++ b/lib/pleroma/web/auth/totp_authenticator.ex @@ -5,7 +5,7 @@ defmodule Pleroma.Web.Auth.TOTPAuthenticator do alias Pleroma.MFA alias Pleroma.MFA.TOTP - alias Pleroma.Plugs.AuthenticationPlug + alias Pleroma.Web.Plugs.AuthenticationPlug alias Pleroma.User @doc "Verify code or check backup code." diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 9d7b24eb2..10093a806 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -12,7 +12,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do alias Pleroma.Conversation.Participation alias Pleroma.Formatter alias Pleroma.Object - alias Pleroma.Plugs.AuthenticationPlug + alias Pleroma.Web.Plugs.AuthenticationPlug alias Pleroma.Repo alias Pleroma.User alias Pleroma.Web.ActivityPub.Utils diff --git a/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex b/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex index 42cf5a85f..ba8eb56fa 100644 --- a/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex +++ b/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex @@ -5,7 +5,7 @@ defmodule Pleroma.Web.MongooseIM.MongooseIMController do use Pleroma.Web, :controller - alias Pleroma.Plugs.AuthenticationPlug + alias Pleroma.Web.Plugs.AuthenticationPlug alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.Repo alias Pleroma.User diff --git a/lib/pleroma/web/plugs/authentication_plug.ex b/lib/pleroma/web/plugs/authentication_plug.ex index a8a4a8380..e2a8b1b69 100644 --- a/lib/pleroma/web/plugs/authentication_plug.ex +++ b/lib/pleroma/web/plugs/authentication_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.AuthenticationPlug do +defmodule Pleroma.Web.Plugs.AuthenticationPlug do alias Pleroma.User import Plug.Conn diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 46f007d3d..855e69077 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -30,7 +30,7 @@ defmodule Pleroma.Web.Router do plug(Pleroma.Web.Plugs.UserFetcherPlug) plug(Pleroma.Web.Plugs.SessionAuthenticationPlug) plug(Pleroma.Web.Plugs.LegacyAuthenticationPlug) - plug(Pleroma.Plugs.AuthenticationPlug) + plug(Pleroma.Web.Plugs.AuthenticationPlug) end pipeline :after_auth do diff --git a/test/pleroma/web/plugs/authentication_plug_test.exs b/test/pleroma/web/plugs/authentication_plug_test.exs index 5b6186e4e..2167f2457 100644 --- a/test/pleroma/web/plugs/authentication_plug_test.exs +++ b/test/pleroma/web/plugs/authentication_plug_test.exs @@ -5,7 +5,7 @@ defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.AuthenticationPlug + alias Pleroma.Web.Plugs.AuthenticationPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.PlugHelper alias Pleroma.User From 3ef4e9d17008a220f02531f70aad9568b995e396 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 11:18:42 +0300 Subject: [PATCH 43/62] AdminSecretAuthenticationPlug module name --- lib/pleroma/web/plugs/admin_secret_authentication_plug.ex | 2 +- lib/pleroma/web/router.ex | 2 +- .../web/plugs/admin_secret_authentication_plug_test.exs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex b/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex index 2e54df47a..9c7454443 100644 --- a/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex +++ b/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.AdminSecretAuthenticationPlug do +defmodule Pleroma.Web.Plugs.AdminSecretAuthenticationPlug do import Plug.Conn alias Pleroma.Plugs.OAuthScopesPlug diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 855e69077..d2d939989 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -64,7 +64,7 @@ defmodule Pleroma.Web.Router do pipeline :admin_api do plug(:expect_authentication) plug(:base_api) - plug(Pleroma.Plugs.AdminSecretAuthenticationPlug) + plug(Pleroma.Web.Plugs.AdminSecretAuthenticationPlug) plug(:after_auth) plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug) plug(Pleroma.Web.Plugs.UserIsAdminPlug) diff --git a/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs index 4d35dc99c..33394722a 100644 --- a/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs @@ -8,10 +8,10 @@ defmodule Pleroma.Web.Plugs.AdminSecretAuthenticationPlugTest do import Mock import Pleroma.Factory - alias Pleroma.Plugs.AdminSecretAuthenticationPlug - alias Pleroma.Plugs.OAuthScopesPlug - alias Pleroma.Plugs.PlugHelper - alias Pleroma.Plugs.RateLimiter + alias Pleroma.Web.Plugs.AdminSecretAuthenticationPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.PlugHelper + alias Pleroma.Web.Plugs.RateLimiter test "does nothing if a user is assigned", %{conn: conn} do user = insert(:user) From 9f4fe5485b7132307c7eff0690c8443b4ad57405 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 13:07:47 +0300 Subject: [PATCH 44/62] alias alphabetically order --- lib/pleroma/bbs/authenticator.ex | 2 +- lib/pleroma/tests/auth_test_controller.ex | 2 +- lib/pleroma/web/activity_pub/activity_pub_controller.ex | 4 ++-- .../web/admin_api/controllers/admin_api_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/invite_controller.ex | 2 +- .../admin_api/controllers/media_proxy_cache_controller.ex | 2 +- .../web/admin_api/controllers/o_auth_app_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/relay_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/report_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/status_controller.ex | 2 +- lib/pleroma/web/auth/pleroma_authenticator.ex | 2 +- lib/pleroma/web/auth/totp_authenticator.ex | 2 +- lib/pleroma/web/common_api/utils.ex | 2 +- lib/pleroma/web/feed/user_controller.ex | 2 +- lib/pleroma/web/masto_fe_controller.ex | 2 +- .../web/mastodon_api/controllers/account_controller.ex | 7 ++++--- lib/pleroma/web/mastodon_api/controllers/app_controller.ex | 4 ++-- .../mastodon_api/controllers/conversation_controller.ex | 2 +- .../mastodon_api/controllers/domain_block_controller.ex | 2 +- .../mastodon_api/controllers/follow_request_controller.ex | 2 +- .../web/mastodon_api/controllers/list_controller.ex | 2 +- .../web/mastodon_api/controllers/media_controller.ex | 2 +- .../mastodon_api/controllers/notification_controller.ex | 2 +- .../web/mastodon_api/controllers/poll_controller.ex | 2 +- .../controllers/scheduled_activity_controller.ex | 2 +- .../web/mastodon_api/controllers/search_controller.ex | 4 ++-- .../web/mastodon_api/controllers/status_controller.ex | 4 ++-- .../web/mastodon_api/controllers/timeline_controller.ex | 4 ++-- lib/pleroma/web/mongoose_im/mongoose_im_controller.ex | 4 ++-- lib/pleroma/web/o_auth/o_auth_controller.ex | 2 +- lib/pleroma/web/o_status/o_status_controller.ex | 2 +- .../web/pleroma_api/controllers/account_controller.ex | 6 +++--- lib/pleroma/web/pleroma_api/controllers/chat_controller.ex | 2 +- .../web/pleroma_api/controllers/conversation_controller.ex | 2 +- .../pleroma_api/controllers/emoji_reaction_controller.ex | 2 +- .../web/pleroma_api/controllers/mascot_controller.ex | 2 +- .../web/pleroma_api/controllers/scrobble_controller.ex | 2 +- .../controllers/two_factor_authentication_controller.ex | 2 +- lib/pleroma/web/plugs/rate_limiter.ex | 2 +- lib/pleroma/web/twitter_api/controller.ex | 4 ++-- lib/pleroma/web/twitter_api/controllers/util_controller.ex | 2 +- test/pleroma/web/plugs/authentication_plug_test.exs | 4 ++-- test/pleroma/web/plugs/ensure_authenticated_plug_test.exs | 2 +- .../web/plugs/ensure_public_or_authenticated_plug_test.exs | 2 +- test/pleroma/web/plugs/legacy_authentication_plug_test.exs | 2 +- test/pleroma/web/plugs/o_auth_scopes_plug_test.exs | 2 +- test/pleroma/web/plugs/set_user_session_id_plug_test.exs | 2 +- 47 files changed, 60 insertions(+), 59 deletions(-) diff --git a/lib/pleroma/bbs/authenticator.ex b/lib/pleroma/bbs/authenticator.ex index f837a103a..83ebb756d 100644 --- a/lib/pleroma/bbs/authenticator.ex +++ b/lib/pleroma/bbs/authenticator.ex @@ -4,8 +4,8 @@ defmodule Pleroma.BBS.Authenticator do use Sshd.PasswordAuthenticator - alias Pleroma.Web.Plugs.AuthenticationPlug alias Pleroma.User + alias Pleroma.Web.Plugs.AuthenticationPlug def authenticate(username, password) do username = to_string(username) diff --git a/lib/pleroma/tests/auth_test_controller.ex b/lib/pleroma/tests/auth_test_controller.ex index 320df7e5a..b30d83567 100644 --- a/lib/pleroma/tests/auth_test_controller.ex +++ b/lib/pleroma/tests/auth_test_controller.ex @@ -8,9 +8,9 @@ defmodule Pleroma.Tests.AuthTestController do use Pleroma.Web, :controller + alias Pleroma.User alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.OAuthScopesPlug - alias Pleroma.User # Serves only with proper OAuth token (:api and :authenticated_api) # Skipping EnsurePublicOrAuthenticatedPlug has no effect in this case diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index 37e076f1b..6bf7421bb 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -9,7 +9,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do alias Pleroma.Delivery alias Pleroma.Object alias Pleroma.Object.Fetcher - alias Pleroma.Web.Plugs.EnsureAuthenticatedPlug alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.ActivityPub.Builder @@ -23,8 +22,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.ControllerHelper alias Pleroma.Web.Endpoint - alias Pleroma.Web.Plugs.FederatingPlug alias Pleroma.Web.Federator + alias Pleroma.Web.Plugs.EnsureAuthenticatedPlug + alias Pleroma.Web.Plugs.FederatingPlug require Logger diff --git a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex index ea4bc06f8..bdd3e195d 100644 --- a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex @@ -10,7 +10,6 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do alias Pleroma.Config alias Pleroma.MFA alias Pleroma.ModerationLog - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Stats alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub @@ -21,6 +20,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do alias Pleroma.Web.AdminAPI.ModerationLogView alias Pleroma.Web.AdminAPI.Search alias Pleroma.Web.Endpoint + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Router @users_page_size 50 diff --git a/lib/pleroma/web/admin_api/controllers/invite_controller.ex b/lib/pleroma/web/admin_api/controllers/invite_controller.ex index 47b7d9953..6a9b4038a 100644 --- a/lib/pleroma/web/admin_api/controllers/invite_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/invite_controller.ex @@ -8,8 +8,8 @@ defmodule Pleroma.Web.AdminAPI.InviteController do import Pleroma.Web.ControllerHelper, only: [json_response: 3] alias Pleroma.Config - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.UserInviteToken + alias Pleroma.Web.Plugs.OAuthScopesPlug require Logger diff --git a/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex b/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex index 3aa110b8b..6d92e9f7f 100644 --- a/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex @@ -5,9 +5,9 @@ defmodule Pleroma.Web.AdminAPI.MediaProxyCacheController do use Pleroma.Web, :controller - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.ApiSpec.Admin, as: Spec alias Pleroma.Web.MediaProxy + alias Pleroma.Web.Plugs.OAuthScopesPlug plug(Pleroma.Web.ApiSpec.CastAndValidate) diff --git a/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex b/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex index eb86ed17c..116a05a4d 100644 --- a/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex @@ -7,8 +7,8 @@ defmodule Pleroma.Web.AdminAPI.OAuthAppController do import Pleroma.Web.ControllerHelper, only: [json_response: 3] - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.OAuth.App + alias Pleroma.Web.Plugs.OAuthScopesPlug require Logger diff --git a/lib/pleroma/web/admin_api/controllers/relay_controller.ex b/lib/pleroma/web/admin_api/controllers/relay_controller.ex index 8a4cafde3..611388447 100644 --- a/lib/pleroma/web/admin_api/controllers/relay_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/relay_controller.ex @@ -6,8 +6,8 @@ defmodule Pleroma.Web.AdminAPI.RelayController do use Pleroma.Web, :controller alias Pleroma.ModerationLog - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.ActivityPub.Relay + alias Pleroma.Web.Plugs.OAuthScopesPlug require Logger diff --git a/lib/pleroma/web/admin_api/controllers/report_controller.ex b/lib/pleroma/web/admin_api/controllers/report_controller.ex index 6e8c31645..86da93893 100644 --- a/lib/pleroma/web/admin_api/controllers/report_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/report_controller.ex @@ -9,12 +9,12 @@ defmodule Pleroma.Web.AdminAPI.ReportController do alias Pleroma.Activity alias Pleroma.ModerationLog - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.ReportNote alias Pleroma.Web.ActivityPub.Utils alias Pleroma.Web.AdminAPI alias Pleroma.Web.AdminAPI.Report alias Pleroma.Web.CommonAPI + alias Pleroma.Web.Plugs.OAuthScopesPlug require Logger diff --git a/lib/pleroma/web/admin_api/controllers/status_controller.ex b/lib/pleroma/web/admin_api/controllers/status_controller.ex index cefdf5d40..2bb437cfe 100644 --- a/lib/pleroma/web/admin_api/controllers/status_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/status_controller.ex @@ -7,10 +7,10 @@ defmodule Pleroma.Web.AdminAPI.StatusController do alias Pleroma.Activity alias Pleroma.ModerationLog - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.CommonAPI alias Pleroma.Web.MastodonAPI + alias Pleroma.Web.Plugs.OAuthScopesPlug require Logger diff --git a/lib/pleroma/web/auth/pleroma_authenticator.ex b/lib/pleroma/web/auth/pleroma_authenticator.ex index 36e7ff0fa..d6d2a8d06 100644 --- a/lib/pleroma/web/auth/pleroma_authenticator.ex +++ b/lib/pleroma/web/auth/pleroma_authenticator.ex @@ -3,10 +3,10 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Auth.PleromaAuthenticator do - alias Pleroma.Web.Plugs.AuthenticationPlug alias Pleroma.Registration alias Pleroma.Repo alias Pleroma.User + alias Pleroma.Web.Plugs.AuthenticationPlug import Pleroma.Web.Auth.Authenticator, only: [fetch_credentials: 1, fetch_user: 1] diff --git a/lib/pleroma/web/auth/totp_authenticator.ex b/lib/pleroma/web/auth/totp_authenticator.ex index b4df422fe..edc9871ea 100644 --- a/lib/pleroma/web/auth/totp_authenticator.ex +++ b/lib/pleroma/web/auth/totp_authenticator.ex @@ -5,8 +5,8 @@ defmodule Pleroma.Web.Auth.TOTPAuthenticator do alias Pleroma.MFA alias Pleroma.MFA.TOTP - alias Pleroma.Web.Plugs.AuthenticationPlug alias Pleroma.User + alias Pleroma.Web.Plugs.AuthenticationPlug @doc "Verify code or check backup code." @spec verify(String.t(), User.t()) :: diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 10093a806..21f4d43e9 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -12,12 +12,12 @@ defmodule Pleroma.Web.CommonAPI.Utils do alias Pleroma.Conversation.Participation alias Pleroma.Formatter alias Pleroma.Object - alias Pleroma.Web.Plugs.AuthenticationPlug alias Pleroma.Repo alias Pleroma.User alias Pleroma.Web.ActivityPub.Utils alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.MediaProxy + alias Pleroma.Web.Plugs.AuthenticationPlug require Logger require Pleroma.Constants diff --git a/lib/pleroma/web/feed/user_controller.ex b/lib/pleroma/web/feed/user_controller.ex index 1ecb8fda6..752983c3b 100644 --- a/lib/pleroma/web/feed/user_controller.ex +++ b/lib/pleroma/web/feed/user_controller.ex @@ -24,7 +24,7 @@ def feed_redirect(%{assigns: %{format: format}} = conn, _params) when format in ["json", "activity+json"] do with %{halted: false} = conn <- Pleroma.Web.Plugs.EnsureAuthenticatedPlug.call(conn, - unless_func: &Pleroma.Web.FederatingPlug.federating?/1 + unless_func: &Pleroma.Web.Plugs.FederatingPlug.federating?/1 ) do ActivityPubController.call(conn, :user) end diff --git a/lib/pleroma/web/masto_fe_controller.ex b/lib/pleroma/web/masto_fe_controller.ex index 8d99f8907..08f92d55f 100644 --- a/lib/pleroma/web/masto_fe_controller.ex +++ b/lib/pleroma/web/masto_fe_controller.ex @@ -5,9 +5,9 @@ defmodule Pleroma.Web.MastoFEController do use Pleroma.Web, :controller + alias Pleroma.User alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.OAuthScopesPlug - alias Pleroma.User plug(OAuthScopesPlug, %{scopes: ["write:accounts"]} when action == :put_settings) diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex index 1c8199504..f3b6b3571 100644 --- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex @@ -15,9 +15,6 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do ] alias Pleroma.Maps - alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug - alias Pleroma.Web.Plugs.OAuthScopesPlug - alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.ActivityPub.Builder @@ -29,6 +26,10 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do alias Pleroma.Web.MastodonAPI.StatusView alias Pleroma.Web.OAuth.OAuthController alias Pleroma.Web.OAuth.OAuthView + alias Pleroma.Web.OAuth.Token + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.Web.TwitterAPI.TwitterAPI plug(Pleroma.Web.ApiSpec.CastAndValidate) diff --git a/lib/pleroma/web/mastodon_api/controllers/app_controller.ex b/lib/pleroma/web/mastodon_api/controllers/app_controller.ex index ed2f92fa6..143dcf80c 100644 --- a/lib/pleroma/web/mastodon_api/controllers/app_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/app_controller.ex @@ -5,12 +5,12 @@ defmodule Pleroma.Web.MastodonAPI.AppController do use Pleroma.Web, :controller - alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Repo alias Pleroma.Web.OAuth.App alias Pleroma.Web.OAuth.Scopes alias Pleroma.Web.OAuth.Token + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug action_fallback(Pleroma.Web.MastodonAPI.FallbackController) diff --git a/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex b/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex index ee8cc11ef..61347d8db 100644 --- a/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex @@ -8,8 +8,8 @@ defmodule Pleroma.Web.MastodonAPI.ConversationController do import Pleroma.Web.ControllerHelper, only: [add_link_headers: 2] alias Pleroma.Conversation.Participation - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Repo + alias Pleroma.Web.Plugs.OAuthScopesPlug action_fallback(Pleroma.Web.MastodonAPI.FallbackController) diff --git a/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex b/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex index fda27f669..503bd7d5f 100644 --- a/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex @@ -5,8 +5,8 @@ defmodule Pleroma.Web.MastodonAPI.DomainBlockController do use Pleroma.Web, :controller - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User + alias Pleroma.Web.Plugs.OAuthScopesPlug plug(Pleroma.Web.ApiSpec.CastAndValidate) defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.DomainBlockOperation diff --git a/lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex b/lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex index e9fd8630f..f8cd7fa9f 100644 --- a/lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex @@ -5,9 +5,9 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestController do use Pleroma.Web, :controller - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.CommonAPI + alias Pleroma.Web.Plugs.OAuthScopesPlug plug(:put_view, Pleroma.Web.MastodonAPI.AccountView) plug(Pleroma.Web.ApiSpec.CastAndValidate) diff --git a/lib/pleroma/web/mastodon_api/controllers/list_controller.ex b/lib/pleroma/web/mastodon_api/controllers/list_controller.ex index bd6460881..f6b51bf02 100644 --- a/lib/pleroma/web/mastodon_api/controllers/list_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/list_controller.ex @@ -5,9 +5,9 @@ defmodule Pleroma.Web.MastodonAPI.ListController do use Pleroma.Web, :controller - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.MastodonAPI.AccountView + alias Pleroma.Web.Plugs.OAuthScopesPlug @oauth_read_actions [:index, :show, :list_accounts] diff --git a/lib/pleroma/web/mastodon_api/controllers/media_controller.ex b/lib/pleroma/web/mastodon_api/controllers/media_controller.ex index b60d736f7..9586b14bc 100644 --- a/lib/pleroma/web/mastodon_api/controllers/media_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/media_controller.ex @@ -6,9 +6,9 @@ defmodule Pleroma.Web.MastodonAPI.MediaController do use Pleroma.Web, :controller alias Pleroma.Object - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub + alias Pleroma.Web.Plugs.OAuthScopesPlug action_fallback(Pleroma.Web.MastodonAPI.FallbackController) plug(Pleroma.Web.ApiSpec.CastAndValidate) diff --git a/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex b/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex index 9ccac3d41..c3c8606f2 100644 --- a/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex @@ -8,8 +8,8 @@ defmodule Pleroma.Web.MastodonAPI.NotificationController do import Pleroma.Web.ControllerHelper, only: [add_link_headers: 2] alias Pleroma.Notification - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.MastodonAPI.MastodonAPI + alias Pleroma.Web.Plugs.OAuthScopesPlug @oauth_read_actions [:show, :index] diff --git a/lib/pleroma/web/mastodon_api/controllers/poll_controller.ex b/lib/pleroma/web/mastodon_api/controllers/poll_controller.ex index 9f97bd609..3dcd1c44f 100644 --- a/lib/pleroma/web/mastodon_api/controllers/poll_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/poll_controller.ex @@ -9,9 +9,9 @@ defmodule Pleroma.Web.MastodonAPI.PollController do alias Pleroma.Activity alias Pleroma.Object - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.CommonAPI + alias Pleroma.Web.Plugs.OAuthScopesPlug action_fallback(Pleroma.Web.MastodonAPI.FallbackController) diff --git a/lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex b/lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex index 97d2fea23..322a46497 100644 --- a/lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex @@ -7,9 +7,9 @@ defmodule Pleroma.Web.MastodonAPI.ScheduledActivityController do import Pleroma.Web.ControllerHelper, only: [add_link_headers: 2] - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.ScheduledActivity alias Pleroma.Web.MastodonAPI.MastodonAPI + alias Pleroma.Web.Plugs.OAuthScopesPlug @oauth_read_actions [:show, :index] diff --git a/lib/pleroma/web/mastodon_api/controllers/search_controller.ex b/lib/pleroma/web/mastodon_api/controllers/search_controller.ex index c60b3dff6..0043c3a56 100644 --- a/lib/pleroma/web/mastodon_api/controllers/search_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/search_controller.ex @@ -6,14 +6,14 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do use Pleroma.Web, :controller alias Pleroma.Activity - alias Pleroma.Web.Plugs.OAuthScopesPlug - alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.Repo alias Pleroma.User alias Pleroma.Web alias Pleroma.Web.ControllerHelper alias Pleroma.Web.MastodonAPI.AccountView alias Pleroma.Web.MastodonAPI.StatusView + alias Pleroma.Web.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.RateLimiter require Logger diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index ec2605022..08d6c1c22 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -13,8 +13,6 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do alias Pleroma.Activity alias Pleroma.Bookmark alias Pleroma.Object - alias Pleroma.Web.Plugs.OAuthScopesPlug - alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.Repo alias Pleroma.ScheduledActivity alias Pleroma.User @@ -23,6 +21,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do alias Pleroma.Web.CommonAPI alias Pleroma.Web.MastodonAPI.AccountView alias Pleroma.Web.MastodonAPI.ScheduledActivityView + alias Pleroma.Web.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.RateLimiter plug(Pleroma.Web.ApiSpec.CastAndValidate) diff --git a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex index 834452dd6..7a5c80e01 100644 --- a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex @@ -10,11 +10,11 @@ defmodule Pleroma.Web.MastodonAPI.TimelineController do alias Pleroma.Config alias Pleroma.Pagination + alias Pleroma.User + alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.RateLimiter - alias Pleroma.User - alias Pleroma.Web.ActivityPub.ActivityPub plug(Pleroma.Web.ApiSpec.CastAndValidate) plug(:skip_plug, EnsurePublicOrAuthenticatedPlug when action in [:public, :hashtag]) diff --git a/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex b/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex index ba8eb56fa..2a5c7c356 100644 --- a/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex +++ b/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex @@ -5,10 +5,10 @@ defmodule Pleroma.Web.MongooseIM.MongooseIMController do use Pleroma.Web, :controller - alias Pleroma.Web.Plugs.AuthenticationPlug - alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.Repo alias Pleroma.User + alias Pleroma.Web.Plugs.AuthenticationPlug + alias Pleroma.Web.Plugs.RateLimiter plug(RateLimiter, [name: :authentication] when action in [:user_exists, :check_password]) plug(RateLimiter, [name: :authentication, params: ["user"]] when action == :check_password) diff --git a/lib/pleroma/web/o_auth/o_auth_controller.ex b/lib/pleroma/web/o_auth/o_auth_controller.ex index 782617021..d2f9d1ceb 100644 --- a/lib/pleroma/web/o_auth/o_auth_controller.ex +++ b/lib/pleroma/web/o_auth/o_auth_controller.ex @@ -8,7 +8,6 @@ defmodule Pleroma.Web.OAuth.OAuthController do alias Pleroma.Helpers.UriHelper alias Pleroma.Maps alias Pleroma.MFA - alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.Registration alias Pleroma.Repo alias Pleroma.User @@ -23,6 +22,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do alias Pleroma.Web.OAuth.Token alias Pleroma.Web.OAuth.Token.Strategy.RefreshToken alias Pleroma.Web.OAuth.Token.Strategy.Revoke, as: RevokeToken + alias Pleroma.Web.Plugs.RateLimiter require Logger diff --git a/lib/pleroma/web/o_status/o_status_controller.ex b/lib/pleroma/web/o_status/o_status_controller.ex index b058200f1..b044260b3 100644 --- a/lib/pleroma/web/o_status/o_status_controller.ex +++ b/lib/pleroma/web/o_status/o_status_controller.ex @@ -7,13 +7,13 @@ defmodule Pleroma.Web.OStatus.OStatusController do alias Pleroma.Activity alias Pleroma.Object - alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPubController alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.Endpoint alias Pleroma.Web.Fallback.RedirectController alias Pleroma.Web.Metadata.PlayerView + alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.Web.Router plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug, diff --git a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex index 90c63b4f5..61f4a9bd9 100644 --- a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex @@ -8,12 +8,12 @@ defmodule Pleroma.Web.PleromaAPI.AccountController do import Pleroma.Web.ControllerHelper, only: [json_response: 3, add_link_headers: 2, assign_account_by_id: 2] - alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug - alias Pleroma.Web.Plugs.OAuthScopesPlug - alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.MastodonAPI.StatusView + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.RateLimiter require Pleroma.Constants diff --git a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex index de0bc96c3..6357148d0 100644 --- a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex @@ -11,12 +11,12 @@ defmodule Pleroma.Web.PleromaAPI.ChatController do alias Pleroma.Chat.MessageReference alias Pleroma.Object alias Pleroma.Pagination - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Repo alias Pleroma.User alias Pleroma.Web.CommonAPI alias Pleroma.Web.PleromaAPI.Chat.MessageReferenceView alias Pleroma.Web.PleromaAPI.ChatView + alias Pleroma.Web.Plugs.OAuthScopesPlug import Ecto.Query diff --git a/lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex b/lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex index 278616065..df52b7566 100644 --- a/lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex @@ -8,9 +8,9 @@ defmodule Pleroma.Web.PleromaAPI.ConversationController do import Pleroma.Web.ControllerHelper, only: [add_link_headers: 2] alias Pleroma.Conversation.Participation - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.MastodonAPI.StatusView + alias Pleroma.Web.Plugs.OAuthScopesPlug plug(Pleroma.Web.ApiSpec.CastAndValidate) plug(:put_view, Pleroma.Web.MastodonAPI.ConversationView) diff --git a/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex index 110c7ba8c..ae199a50f 100644 --- a/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex @@ -7,9 +7,9 @@ defmodule Pleroma.Web.PleromaAPI.EmojiReactionController do alias Pleroma.Activity alias Pleroma.Object - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.CommonAPI alias Pleroma.Web.MastodonAPI.StatusView + alias Pleroma.Web.Plugs.OAuthScopesPlug plug(Pleroma.Web.ApiSpec.CastAndValidate) plug(OAuthScopesPlug, %{scopes: ["write:statuses"]} when action in [:create, :delete]) diff --git a/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex b/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex index 25a46fafa..0f6f0b9db 100644 --- a/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex @@ -5,9 +5,9 @@ defmodule Pleroma.Web.PleromaAPI.MascotController do use Pleroma.Web, :controller - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub + alias Pleroma.Web.Plugs.OAuthScopesPlug plug(Pleroma.Web.ApiSpec.CastAndValidate) plug(OAuthScopesPlug, %{scopes: ["read:accounts"]} when action == :show) diff --git a/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex b/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex index acaaa127f..632d65434 100644 --- a/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex @@ -7,10 +7,10 @@ defmodule Pleroma.Web.PleromaAPI.ScrobbleController do import Pleroma.Web.ControllerHelper, only: [add_link_headers: 2] - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.CommonAPI + alias Pleroma.Web.Plugs.OAuthScopesPlug plug(Pleroma.Web.ApiSpec.CastAndValidate) diff --git a/lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex b/lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex index 7419e9a3c..eba452300 100644 --- a/lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex @@ -10,8 +10,8 @@ defmodule Pleroma.Web.PleromaAPI.TwoFactorAuthenticationController do alias Pleroma.MFA alias Pleroma.MFA.TOTP - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.CommonAPI.Utils + alias Pleroma.Web.Plugs.OAuthScopesPlug plug(OAuthScopesPlug, %{scopes: ["read:security"]} when action in [:settings]) diff --git a/lib/pleroma/web/plugs/rate_limiter.ex b/lib/pleroma/web/plugs/rate_limiter.ex index 669c399c9..a589610d1 100644 --- a/lib/pleroma/web/plugs/rate_limiter.ex +++ b/lib/pleroma/web/plugs/rate_limiter.ex @@ -67,8 +67,8 @@ defmodule Pleroma.Web.Plugs.RateLimiter do import Plug.Conn alias Pleroma.Config - alias Pleroma.Web.Plugs.RateLimiter.LimiterSupervisor alias Pleroma.User + alias Pleroma.Web.Plugs.RateLimiter.LimiterSupervisor require Logger diff --git a/lib/pleroma/web/twitter_api/controller.ex b/lib/pleroma/web/twitter_api/controller.ex index dc9c41f16..f42dba442 100644 --- a/lib/pleroma/web/twitter_api/controller.ex +++ b/lib/pleroma/web/twitter_api/controller.ex @@ -6,10 +6,10 @@ defmodule Pleroma.Web.TwitterAPI.Controller do use Pleroma.Web, :controller alias Pleroma.Notification - alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.OAuth.Token + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.TwitterAPI.TokenView require Logger diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex index f97bd4823..9ead0d626 100644 --- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex @@ -11,9 +11,9 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do alias Pleroma.Emoji alias Pleroma.Healthcheck alias Pleroma.Notification - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.CommonAPI + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.WebFinger plug(Pleroma.Web.Plugs.FederatingPlug when action == :remote_subscribe) diff --git a/test/pleroma/web/plugs/authentication_plug_test.exs b/test/pleroma/web/plugs/authentication_plug_test.exs index 2167f2457..af39352e2 100644 --- a/test/pleroma/web/plugs/authentication_plug_test.exs +++ b/test/pleroma/web/plugs/authentication_plug_test.exs @@ -5,10 +5,10 @@ defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do use Pleroma.Web.ConnCase, async: true + alias Pleroma.User alias Pleroma.Web.Plugs.AuthenticationPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.PlugHelper - alias Pleroma.User import ExUnit.CaptureLog import Pleroma.Factory @@ -118,7 +118,7 @@ test "it returns false when hash invalid" do "psBWV8gxkGOZWBz$PmfCycChoxeJ3GgGzwvhlgacb9mUoZ.KUXNCssekER4SJ7bOK53uXrHNb2e4i8yPFgSKyzaW9CcmrDXWIEMtD1" assert capture_log(fn -> - refute Pleroma.Plugs.AuthenticationPlug.checkpw("password", hash) + refute AuthenticationPlug.checkpw("password", hash) end) =~ "[error] Password hash not recognized" end end diff --git a/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs index 35095e018..92ff19282 100644 --- a/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs @@ -5,8 +5,8 @@ defmodule Pleroma.Web.Plugs.EnsureAuthenticatedPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Web.Plugs.EnsureAuthenticatedPlug alias Pleroma.User + alias Pleroma.Web.Plugs.EnsureAuthenticatedPlug describe "without :if_func / :unless_func options" do test "it halts if user is NOT assigned", %{conn: conn} do diff --git a/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs index a73175fa6..211443a55 100644 --- a/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs @@ -6,8 +6,8 @@ defmodule Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Config - alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.User + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug setup do: clear_config([:instance, :public]) diff --git a/test/pleroma/web/plugs/legacy_authentication_plug_test.exs b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs index 0a2f6f22f..2016a31a8 100644 --- a/test/pleroma/web/plugs/legacy_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs @@ -7,10 +7,10 @@ defmodule Pleroma.Web.Plugs.LegacyAuthenticationPlugTest do import Pleroma.Factory + alias Pleroma.User alias Pleroma.Web.Plugs.LegacyAuthenticationPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.PlugHelper - alias Pleroma.User setup do user = diff --git a/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs index c8944f971..982a70bf9 100644 --- a/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs +++ b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs @@ -5,8 +5,8 @@ defmodule Pleroma.Web.Plugs.OAuthScopesPlugTest do use Pleroma.Web.ConnCase - alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Repo + alias Pleroma.Web.Plugs.OAuthScopesPlug import Mock import Pleroma.Factory diff --git a/test/pleroma/web/plugs/set_user_session_id_plug_test.exs b/test/pleroma/web/plugs/set_user_session_id_plug_test.exs index 8467d44e3..a89b5628f 100644 --- a/test/pleroma/web/plugs/set_user_session_id_plug_test.exs +++ b/test/pleroma/web/plugs/set_user_session_id_plug_test.exs @@ -5,8 +5,8 @@ defmodule Pleroma.Web.Plugs.SetUserSessionIdPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Web.Plugs.SetUserSessionIdPlug alias Pleroma.User + alias Pleroma.Web.Plugs.SetUserSessionIdPlug setup %{conn: conn} do session_opts = [ From b6eb7997f577c5821f21eb00f623631db2faad0b Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 13:56:16 +0300 Subject: [PATCH 45/62] special namespaces for phoenix and api_spec --- lib/credo/check/consistency/file_location.ex | 39 ++++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/lib/credo/check/consistency/file_location.ex b/lib/credo/check/consistency/file_location.ex index 5ef17b894..08be2bcf9 100644 --- a/lib/credo/check/consistency/file_location.ex +++ b/lib/credo/check/consistency/file_location.ex @@ -1,3 +1,6 @@ +# Originally taken from +# https://github.com/VeryBigThings/elixir_common/blob/master/lib/vbt/credo/check/consistency/file_location.ex + defmodule Credo.Check.Consistency.FileLocation do @moduledoc false @@ -13,7 +16,15 @@ defmodule Credo.Check.Consistency.FileLocation do """ @explanation [warning: @checkdoc] - # `use Credo.Check` required that module attributes are already defined, so we need to place these attributes + @special_namespaces [ + "controllers", + "views", + "operations", + "channels" + ] + + # `use Credo.Check` required that module attributes are already defined, so we need + # to place these attributes # before use/alias expressions. # credo:disable-for-next-line VBT.Credo.Check.Consistency.ModuleLayout use Credo.Check, category: :warning, base_priority: :high @@ -81,11 +92,31 @@ defp verify_module(main_module, relative_path, params) do expected_file_base(parsed_path.root, main_module) <> Path.extname(parsed_path.allowed) - if expected_file == parsed_path.allowed, - do: :ok, - else: {:error, main_module, expected_file} + cond do + expected_file == parsed_path.allowed -> + :ok + + special_namespaces?(parsed_path.allowed) -> + original_path = parsed_path.allowed + + namespace = + Enum.find(@special_namespaces, original_path, fn namespace -> + String.contains?(original_path, namespace) + end) + + allowed = String.replace(original_path, "/" <> namespace, "") + + if expected_file == allowed, + do: :ok, + else: {:error, main_module, expected_file} + + true -> + {:error, main_module, expected_file} + end end + defp special_namespaces?(path), do: String.contains?(path, @special_namespaces) + defp parsed_path(relative_path, params) do parts = Path.split(relative_path) From e33782455d468a867484e30fdeef4c28c2c2aa01 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 14:11:05 +0300 Subject: [PATCH 46/62] updates after rebase --- .../application_requirements_test.exs | 31 ++++++++++--------- test/{ => pleroma}/http/tzdata_test.exs | 0 .../user_update_handling_test.exs | 0 3 files changed, 17 insertions(+), 14 deletions(-) rename test/{ => pleroma}/application_requirements_test.exs (81%) rename test/{ => pleroma}/http/tzdata_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/user_update_handling_test.exs (100%) diff --git a/test/application_requirements_test.exs b/test/pleroma/application_requirements_test.exs similarity index 81% rename from test/application_requirements_test.exs rename to test/pleroma/application_requirements_test.exs index 21d24ddd0..c505ae229 100644 --- a/test/application_requirements_test.exs +++ b/test/pleroma/application_requirements_test.exs @@ -4,9 +4,12 @@ defmodule Pleroma.ApplicationRequirementsTest do use Pleroma.DataCase + import ExUnit.CaptureLog import Mock + alias Pleroma.ApplicationRequirements + alias Pleroma.Config alias Pleroma.Repo describe "check_welcome_message_config!/1" do @@ -70,42 +73,42 @@ test "doesn't do anything if account confirmation is required and mailer is enab setup do: clear_config([:database, :rum_enabled]) test "raises if rum is enabled and detects unapplied rum migrations" do - Pleroma.Config.put([:database, :rum_enabled], true) + Config.put([:database, :rum_enabled], true) with_mocks([{Repo, [:passthrough], [exists?: fn _, _ -> false end]}]) do - assert_raise Pleroma.ApplicationRequirements.VerifyError, + assert_raise ApplicationRequirements.VerifyError, "Unapplied RUM Migrations detected", fn -> - capture_log(&Pleroma.ApplicationRequirements.verify!/0) + capture_log(&ApplicationRequirements.verify!/0) end end end test "raises if rum is disabled and detects rum migrations" do - Pleroma.Config.put([:database, :rum_enabled], false) + Config.put([:database, :rum_enabled], false) with_mocks([{Repo, [:passthrough], [exists?: fn _, _ -> true end]}]) do - assert_raise Pleroma.ApplicationRequirements.VerifyError, + assert_raise ApplicationRequirements.VerifyError, "RUM Migrations detected", fn -> - capture_log(&Pleroma.ApplicationRequirements.verify!/0) + capture_log(&ApplicationRequirements.verify!/0) end end end test "doesn't do anything if rum enabled and applied migrations" do - Pleroma.Config.put([:database, :rum_enabled], true) + Config.put([:database, :rum_enabled], true) with_mocks([{Repo, [:passthrough], [exists?: fn _, _ -> true end]}]) do - assert Pleroma.ApplicationRequirements.verify!() == :ok + assert ApplicationRequirements.verify!() == :ok end end test "doesn't do anything if rum disabled" do - Pleroma.Config.put([:database, :rum_enabled], false) + Config.put([:database, :rum_enabled], false) with_mocks([{Repo, [:passthrough], [exists?: fn _, _ -> false end]}]) do - assert Pleroma.ApplicationRequirements.verify!() == :ok + assert ApplicationRequirements.verify!() == :ok end end end @@ -130,17 +133,17 @@ test "doesn't do anything if rum disabled" do setup do: clear_config([:i_am_aware_this_may_cause_data_loss, :disable_migration_check]) test "raises if it detects unapplied migrations" do - assert_raise Pleroma.ApplicationRequirements.VerifyError, + assert_raise ApplicationRequirements.VerifyError, "Unapplied Migrations detected", fn -> - capture_log(&Pleroma.ApplicationRequirements.verify!/0) + capture_log(&ApplicationRequirements.verify!/0) end end test "doesn't do anything if disabled" do - Pleroma.Config.put([:i_am_aware_this_may_cause_data_loss, :disable_migration_check], true) + Config.put([:i_am_aware_this_may_cause_data_loss, :disable_migration_check], true) - assert :ok == Pleroma.ApplicationRequirements.verify!() + assert :ok == ApplicationRequirements.verify!() end end end diff --git a/test/http/tzdata_test.exs b/test/pleroma/http/tzdata_test.exs similarity index 100% rename from test/http/tzdata_test.exs rename to test/pleroma/http/tzdata_test.exs diff --git a/test/web/activity_pub/transmogrifier/user_update_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/user_update_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs From 3c8c540707db4c6cf43997f08be4f2a857b63688 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 24 Jun 2020 15:31:56 +0300 Subject: [PATCH 47/62] copyright --- lib/credo/check/consistency/file_location.ex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/credo/check/consistency/file_location.ex b/lib/credo/check/consistency/file_location.ex index 08be2bcf9..500983608 100644 --- a/lib/credo/check/consistency/file_location.ex +++ b/lib/credo/check/consistency/file_location.ex @@ -1,5 +1,8 @@ +# Pleroma: A lightweight social networking server # Originally taken from # https://github.com/VeryBigThings/elixir_common/blob/master/lib/vbt/credo/check/consistency/file_location.ex +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only defmodule Credo.Check.Consistency.FileLocation do @moduledoc false From 207211a2b36f2ce119cded088a0795b26f707621 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 26 Jun 2020 08:38:22 +0300 Subject: [PATCH 48/62] update files consistency after rebase --- lib/pleroma/web/preload/{ => providers}/instance.ex | 0 lib/pleroma/web/preload/{ => providers}/provider.ex | 0 lib/pleroma/web/preload/{ => providers}/timelines.ex | 0 lib/pleroma/web/preload/{ => providers}/user.ex | 0 test/{ => pleroma}/http/ex_aws_test.exs | 0 .../preload => pleroma/web/preload/providers}/instance_test.exs | 0 .../preload => pleroma/web/preload/providers}/timeline_test.exs | 0 test/{web/preload => pleroma/web/preload/providers}/user_test.exs | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename lib/pleroma/web/preload/{ => providers}/instance.ex (100%) rename lib/pleroma/web/preload/{ => providers}/provider.ex (100%) rename lib/pleroma/web/preload/{ => providers}/timelines.ex (100%) rename lib/pleroma/web/preload/{ => providers}/user.ex (100%) rename test/{ => pleroma}/http/ex_aws_test.exs (100%) rename test/{web/preload => pleroma/web/preload/providers}/instance_test.exs (100%) rename test/{web/preload => pleroma/web/preload/providers}/timeline_test.exs (100%) rename test/{web/preload => pleroma/web/preload/providers}/user_test.exs (100%) diff --git a/lib/pleroma/web/preload/instance.ex b/lib/pleroma/web/preload/providers/instance.ex similarity index 100% rename from lib/pleroma/web/preload/instance.ex rename to lib/pleroma/web/preload/providers/instance.ex diff --git a/lib/pleroma/web/preload/provider.ex b/lib/pleroma/web/preload/providers/provider.ex similarity index 100% rename from lib/pleroma/web/preload/provider.ex rename to lib/pleroma/web/preload/providers/provider.ex diff --git a/lib/pleroma/web/preload/timelines.ex b/lib/pleroma/web/preload/providers/timelines.ex similarity index 100% rename from lib/pleroma/web/preload/timelines.ex rename to lib/pleroma/web/preload/providers/timelines.ex diff --git a/lib/pleroma/web/preload/user.ex b/lib/pleroma/web/preload/providers/user.ex similarity index 100% rename from lib/pleroma/web/preload/user.ex rename to lib/pleroma/web/preload/providers/user.ex diff --git a/test/http/ex_aws_test.exs b/test/pleroma/http/ex_aws_test.exs similarity index 100% rename from test/http/ex_aws_test.exs rename to test/pleroma/http/ex_aws_test.exs diff --git a/test/web/preload/instance_test.exs b/test/pleroma/web/preload/providers/instance_test.exs similarity index 100% rename from test/web/preload/instance_test.exs rename to test/pleroma/web/preload/providers/instance_test.exs diff --git a/test/web/preload/timeline_test.exs b/test/pleroma/web/preload/providers/timeline_test.exs similarity index 100% rename from test/web/preload/timeline_test.exs rename to test/pleroma/web/preload/providers/timeline_test.exs diff --git a/test/web/preload/user_test.exs b/test/pleroma/web/preload/providers/user_test.exs similarity index 100% rename from test/web/preload/user_test.exs rename to test/pleroma/web/preload/providers/user_test.exs From 0f8ab46a0ea4df745acd6cd915e67d7855db1a04 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 8 Jul 2020 15:41:53 +0300 Subject: [PATCH 49/62] fix after rebase --- lib/pleroma/web/preload/providers/instance.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/preload/providers/instance.ex b/lib/pleroma/web/preload/providers/instance.ex index cc6f8cf99..a549bb1eb 100644 --- a/lib/pleroma/web/preload/providers/instance.ex +++ b/lib/pleroma/web/preload/providers/instance.ex @@ -3,9 +3,9 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Preload.Providers.Instance do - alias Pleroma.Plugs.InstanceStatic alias Pleroma.Web.MastodonAPI.InstanceView alias Pleroma.Web.Nodeinfo.Nodeinfo + alias Pleroma.Web.Plugs.InstanceStatic alias Pleroma.Web.Preload.Providers.Provider alias Pleroma.Web.TwitterAPI.UtilView From c5efded5fd5d3e75990f694088ad15de76e8d83f Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 8 Jul 2020 15:43:14 +0300 Subject: [PATCH 50/62] files consistency for new files --- .../web/activity_pub/transmogrifier/block_handling_test.exs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/{ => pleroma}/web/activity_pub/transmogrifier/block_handling_test.exs (100%) diff --git a/test/web/activity_pub/transmogrifier/block_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/block_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs From b720ad2264cde6e24e63f6cf7f4662731448823b Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 10 Jul 2020 13:02:24 +0300 Subject: [PATCH 51/62] files consistency after rebase --- .../activity_pub/object_validators/announce_validation_test.exs | 2 +- .../object_validators/attachment_validator_test.exs | 0 .../activity_pub/object_validators/block_validation_test.exs | 0 .../web/activity_pub/object_validators/chat_validation_test.exs | 0 .../activity_pub/object_validators/delete_validation_test.exs | 0 .../object_validators/emoji_react_handling_test.exs} | 0 .../activity_pub/object_validators/follow_validation_test.exs | 0 .../web/activity_pub/object_validators/like_validation_test.exs | 0 .../web/activity_pub/object_validators/undo_handling_test.exs} | 0 .../activity_pub/object_validators/update_handling_test.exs} | 0 10 files changed, 1 insertion(+), 1 deletion(-) rename test/{ => pleroma}/web/activity_pub/object_validators/announce_validation_test.exs (97%) rename test/{ => pleroma}/web/activity_pub/object_validators/attachment_validator_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/object_validators/block_validation_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/object_validators/chat_validation_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/object_validators/delete_validation_test.exs (100%) rename test/{web/activity_pub/object_validators/emoji_react_validation_test.exs => pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs} (100%) rename test/{ => pleroma}/web/activity_pub/object_validators/follow_validation_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/object_validators/like_validation_test.exs (100%) rename test/{web/activity_pub/object_validators/undo_validation_test.exs => pleroma/web/activity_pub/object_validators/undo_handling_test.exs} (100%) rename test/{web/activity_pub/object_validators/update_validation_test.exs => pleroma/web/activity_pub/object_validators/update_handling_test.exs} (100%) diff --git a/test/web/activity_pub/object_validators/announce_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs similarity index 97% rename from test/web/activity_pub/object_validators/announce_validation_test.exs rename to test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs index 623342f76..4771c4698 100644 --- a/test/web/activity_pub/object_validators/announce_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnnouncValidationTest do +defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnnounceValidationTest do use Pleroma.DataCase alias Pleroma.Object diff --git a/test/web/activity_pub/object_validators/attachment_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs similarity index 100% rename from test/web/activity_pub/object_validators/attachment_validator_test.exs rename to test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs diff --git a/test/web/activity_pub/object_validators/block_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/block_validation_test.exs similarity index 100% rename from test/web/activity_pub/object_validators/block_validation_test.exs rename to test/pleroma/web/activity_pub/object_validators/block_validation_test.exs diff --git a/test/web/activity_pub/object_validators/chat_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs similarity index 100% rename from test/web/activity_pub/object_validators/chat_validation_test.exs rename to test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs diff --git a/test/web/activity_pub/object_validators/delete_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/delete_validation_test.exs similarity index 100% rename from test/web/activity_pub/object_validators/delete_validation_test.exs rename to test/pleroma/web/activity_pub/object_validators/delete_validation_test.exs diff --git a/test/web/activity_pub/object_validators/emoji_react_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs similarity index 100% rename from test/web/activity_pub/object_validators/emoji_react_validation_test.exs rename to test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs diff --git a/test/web/activity_pub/object_validators/follow_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/follow_validation_test.exs similarity index 100% rename from test/web/activity_pub/object_validators/follow_validation_test.exs rename to test/pleroma/web/activity_pub/object_validators/follow_validation_test.exs diff --git a/test/web/activity_pub/object_validators/like_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs similarity index 100% rename from test/web/activity_pub/object_validators/like_validation_test.exs rename to test/pleroma/web/activity_pub/object_validators/like_validation_test.exs diff --git a/test/web/activity_pub/object_validators/undo_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs similarity index 100% rename from test/web/activity_pub/object_validators/undo_validation_test.exs rename to test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs diff --git a/test/web/activity_pub/object_validators/update_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs similarity index 100% rename from test/web/activity_pub/object_validators/update_validation_test.exs rename to test/pleroma/web/activity_pub/object_validators/update_handling_test.exs From c8418e2d1f0a5dd3b10925a125c3b69c0e8ea18b Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sun, 12 Jul 2020 17:06:23 +0300 Subject: [PATCH 52/62] fix after rebase --- test/{ => pleroma}/upload/filter/exiftool_test.exs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/{ => pleroma}/upload/filter/exiftool_test.exs (100%) diff --git a/test/upload/filter/exiftool_test.exs b/test/pleroma/upload/filter/exiftool_test.exs similarity index 100% rename from test/upload/filter/exiftool_test.exs rename to test/pleroma/upload/filter/exiftool_test.exs From 7f82f18664f73a320f82d0430966b4f673391fbe Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sun, 12 Jul 2020 17:29:02 +0300 Subject: [PATCH 53/62] exclude file_location check from coveralls --- coveralls.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/coveralls.json b/coveralls.json index 75e845ade..8652591ef 100644 --- a/coveralls.json +++ b/coveralls.json @@ -1,6 +1,7 @@ { "skip_files": [ "test/support", - "lib/mix/tasks/pleroma/benchmark.ex" + "lib/mix/tasks/pleroma/benchmark.ex", + "lib/credo/check/consistency/file_location.ex" ] } \ No newline at end of file From 1d0e130cb3f37f611ec8242d99c12f693e328112 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sun, 16 Aug 2020 20:28:31 +0300 Subject: [PATCH 54/62] fixes after rebase --- .../web/mastodon_api/controllers/account_controller.ex | 1 - .../web/pleroma_api/controllers/emoji_pack_controller.ex | 2 +- lib/pleroma/web/plugs/admin_secret_authentication_plug.ex | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex index f3b6b3571..4f9696d52 100644 --- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex @@ -26,7 +26,6 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do alias Pleroma.Web.MastodonAPI.StatusView alias Pleroma.Web.OAuth.OAuthController alias Pleroma.Web.OAuth.OAuthView - alias Pleroma.Web.OAuth.Token alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.RateLimiter diff --git a/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex index 81ba69017..a9accc5af 100644 --- a/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex @@ -24,7 +24,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackController do @skip_plugs [ Pleroma.Web.Plugs.OAuthScopesPlug, - Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug + Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug ] plug(:skip_plug, @skip_plugs when action in [:index, :archive, :show]) diff --git a/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex b/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex index 9c7454443..d7d4e4092 100644 --- a/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex +++ b/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex @@ -5,9 +5,9 @@ defmodule Pleroma.Web.Plugs.AdminSecretAuthenticationPlug do import Plug.Conn - alias Pleroma.Plugs.OAuthScopesPlug - alias Pleroma.Plugs.RateLimiter alias Pleroma.User + alias Pleroma.Web.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.RateLimiter def init(options) do options From c4c5caedd809e46542ae3632762d93f14890d51d Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sun, 16 Aug 2020 21:01:38 +0300 Subject: [PATCH 55/62] changes after rebase --- lib/pleroma/{tesla => http}/middleware/connection_pool.ex | 0 .../gun/connection_pool_test.exs} | 0 .../repo/migrations/autolinker_to_linkify_test.exs} | 0 .../repo/migrations/fix_legacy_tags_test.exs} | 0 .../repo/migrations/fix_malformed_formatter_config_test.exs} | 0 .../repo/migrations/move_welcome_settings_test.exs} | 0 test/{ => pleroma}/report_note_test.exs | 0 .../user/welcome_chat_message_test.exs} | 0 test/{ => pleroma}/user/welcome_email_test.exs | 0 test/{ => pleroma}/user/welcome_message_test.exs | 0 .../object_validators/accept_validation_test.exs | 0 .../object_validators/reject_validation_test.exs | 0 .../web/activity_pub/transmogrifier/accept_handling_test.exs | 0 .../web/activity_pub/transmogrifier/answer_handling_test.exs | 0 .../activity_pub/transmogrifier/question_handling_test.exs | 0 .../web/activity_pub/transmogrifier/reject_handling_test.exs | 0 .../web/plugs/frontend_static_plug_test.exs} | 5 ++--- 17 files changed, 2 insertions(+), 3 deletions(-) rename lib/pleroma/{tesla => http}/middleware/connection_pool.ex (100%) rename test/{gun/conneciton_pool_test.exs => pleroma/gun/connection_pool_test.exs} (100%) rename test/{migrations/20200716195806_autolinker_to_linkify_test.exs => pleroma/repo/migrations/autolinker_to_linkify_test.exs} (100%) rename test/{migrations/20200802170532_fix_legacy_tags_test.exs => pleroma/repo/migrations/fix_legacy_tags_test.exs} (100%) rename test/{migrations/20200722185515_fix_malformed_formatter_config_test.exs => pleroma/repo/migrations/fix_malformed_formatter_config_test.exs} (100%) rename test/{migrations/20200724133313_move_welcome_settings_test.exs => pleroma/repo/migrations/move_welcome_settings_test.exs} (100%) rename test/{ => pleroma}/report_note_test.exs (100%) rename test/{user/welcome_chat_massage_test.exs => pleroma/user/welcome_chat_message_test.exs} (100%) rename test/{ => pleroma}/user/welcome_email_test.exs (100%) rename test/{ => pleroma}/user/welcome_message_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/object_validators/accept_validation_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/object_validators/reject_validation_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/accept_handling_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/answer_handling_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/question_handling_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/reject_handling_test.exs (100%) rename test/{plugs/frontend_static_test.exs => pleroma/web/plugs/frontend_static_plug_test.exs} (92%) diff --git a/lib/pleroma/tesla/middleware/connection_pool.ex b/lib/pleroma/http/middleware/connection_pool.ex similarity index 100% rename from lib/pleroma/tesla/middleware/connection_pool.ex rename to lib/pleroma/http/middleware/connection_pool.ex diff --git a/test/gun/conneciton_pool_test.exs b/test/pleroma/gun/connection_pool_test.exs similarity index 100% rename from test/gun/conneciton_pool_test.exs rename to test/pleroma/gun/connection_pool_test.exs diff --git a/test/migrations/20200716195806_autolinker_to_linkify_test.exs b/test/pleroma/repo/migrations/autolinker_to_linkify_test.exs similarity index 100% rename from test/migrations/20200716195806_autolinker_to_linkify_test.exs rename to test/pleroma/repo/migrations/autolinker_to_linkify_test.exs diff --git a/test/migrations/20200802170532_fix_legacy_tags_test.exs b/test/pleroma/repo/migrations/fix_legacy_tags_test.exs similarity index 100% rename from test/migrations/20200802170532_fix_legacy_tags_test.exs rename to test/pleroma/repo/migrations/fix_legacy_tags_test.exs diff --git a/test/migrations/20200722185515_fix_malformed_formatter_config_test.exs b/test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs similarity index 100% rename from test/migrations/20200722185515_fix_malformed_formatter_config_test.exs rename to test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs diff --git a/test/migrations/20200724133313_move_welcome_settings_test.exs b/test/pleroma/repo/migrations/move_welcome_settings_test.exs similarity index 100% rename from test/migrations/20200724133313_move_welcome_settings_test.exs rename to test/pleroma/repo/migrations/move_welcome_settings_test.exs diff --git a/test/report_note_test.exs b/test/pleroma/report_note_test.exs similarity index 100% rename from test/report_note_test.exs rename to test/pleroma/report_note_test.exs diff --git a/test/user/welcome_chat_massage_test.exs b/test/pleroma/user/welcome_chat_message_test.exs similarity index 100% rename from test/user/welcome_chat_massage_test.exs rename to test/pleroma/user/welcome_chat_message_test.exs diff --git a/test/user/welcome_email_test.exs b/test/pleroma/user/welcome_email_test.exs similarity index 100% rename from test/user/welcome_email_test.exs rename to test/pleroma/user/welcome_email_test.exs diff --git a/test/user/welcome_message_test.exs b/test/pleroma/user/welcome_message_test.exs similarity index 100% rename from test/user/welcome_message_test.exs rename to test/pleroma/user/welcome_message_test.exs diff --git a/test/web/activity_pub/object_validators/accept_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs similarity index 100% rename from test/web/activity_pub/object_validators/accept_validation_test.exs rename to test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs diff --git a/test/web/activity_pub/object_validators/reject_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs similarity index 100% rename from test/web/activity_pub/object_validators/reject_validation_test.exs rename to test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs diff --git a/test/web/activity_pub/transmogrifier/accept_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/accept_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/answer_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/answer_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/question_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/question_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/reject_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/reject_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs diff --git a/test/plugs/frontend_static_test.exs b/test/pleroma/web/plugs/frontend_static_plug_test.exs similarity index 92% rename from test/plugs/frontend_static_test.exs rename to test/pleroma/web/plugs/frontend_static_plug_test.exs index 6f4923048..f6f7d7bdb 100644 --- a/test/plugs/frontend_static_test.exs +++ b/test/pleroma/web/plugs/frontend_static_plug_test.exs @@ -2,8 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.FrontendStaticPlugTest do - alias Pleroma.Plugs.FrontendStatic +defmodule Pleroma.Web.Plugs.FrontendStaticPlugTest do use Pleroma.Web.ConnCase @dir "test/tmp/instance_static" @@ -21,7 +20,7 @@ test "init will give a static plug config + the frontend type" do at: "/admin", frontend_type: :admin ] - |> FrontendStatic.init() + |> Pleroma.Web.Plugs.FrontendStatic.init() assert opts[:at] == ["admin"] assert opts[:frontend_type] == :admin From f679486540625afe30a362c13f70ba0011da2c9c Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 19 Aug 2020 13:45:02 +0300 Subject: [PATCH 56/62] rebase --- .../web/activity_pub/transmogrifier/audio_handling_test.exs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/{ => pleroma}/web/activity_pub/transmogrifier/audio_handling_test.exs (100%) diff --git a/test/web/activity_pub/transmogrifier/audio_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/audio_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs From b081080dd9a138dccf5c3b8417913f975fdb8b52 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 2 Sep 2020 10:29:36 +0300 Subject: [PATCH 57/62] fixes after rebase --- lib/pleroma/web/endpoint.ex | 4 ++-- lib/pleroma/{ => web}/plugs/frontend_static.ex | 2 +- lib/pleroma/web/plugs/instance_static.ex | 2 +- test/mix/tasks/pleroma/frontend_test.exs | 2 +- .../web/activity_pub/transmogrifier/event_handling_test.exs | 0 5 files changed, 5 insertions(+), 5 deletions(-) rename lib/pleroma/{ => web}/plugs/frontend_static.ex (96%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/event_handling_test.exs (100%) diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index 6acca0db6..56562c12f 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -29,7 +29,7 @@ defmodule Pleroma.Web.Endpoint do ) # Careful! No `only` restriction here, as we don't know what frontends contain. - plug(Pleroma.Plugs.FrontendStatic, + plug(Pleroma.Web.Plugs.FrontendStatic, at: "/", frontend_type: :primary, gzip: true, @@ -41,7 +41,7 @@ defmodule Pleroma.Web.Endpoint do plug(Plug.Static.IndexHtml, at: "/pleroma/admin/") - plug(Pleroma.Plugs.FrontendStatic, + plug(Pleroma.Web.Plugs.FrontendStatic, at: "/pleroma/admin", frontend_type: :admin, gzip: true, diff --git a/lib/pleroma/plugs/frontend_static.ex b/lib/pleroma/web/plugs/frontend_static.ex similarity index 96% rename from lib/pleroma/plugs/frontend_static.ex rename to lib/pleroma/web/plugs/frontend_static.ex index 11a0d5382..ceb10dcf8 100644 --- a/lib/pleroma/plugs/frontend_static.ex +++ b/lib/pleroma/web/plugs/frontend_static.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.FrontendStatic do +defmodule Pleroma.Web.Plugs.FrontendStatic do require Pleroma.Constants @moduledoc """ diff --git a/lib/pleroma/web/plugs/instance_static.ex b/lib/pleroma/web/plugs/instance_static.ex index 3e6aa826b..54b9175df 100644 --- a/lib/pleroma/web/plugs/instance_static.ex +++ b/lib/pleroma/web/plugs/instance_static.ex @@ -16,7 +16,7 @@ def file_path(path) do instance_path = Path.join(Pleroma.Config.get([:instance, :static_dir], "instance/static/"), path) - frontend_path = Pleroma.Plugs.FrontendStatic.file_path(path, :primary) + frontend_path = Pleroma.Web.Plugs.FrontendStatic.file_path(path, :primary) (File.exists?(instance_path) && instance_path) || (frontend_path && File.exists?(frontend_path) && frontend_path) || diff --git a/test/mix/tasks/pleroma/frontend_test.exs b/test/mix/tasks/pleroma/frontend_test.exs index 022ae51be..6f9ec14cd 100644 --- a/test/mix/tasks/pleroma/frontend_test.exs +++ b/test/mix/tasks/pleroma/frontend_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.FrontendTest do +defmodule Mix.Tasks.Pleroma.FrontendTest do use Pleroma.DataCase alias Mix.Tasks.Pleroma.Frontend diff --git a/test/web/activity_pub/transmogrifier/event_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/event_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs From 7f5dbb020188eebfbfdf4860bbce4f1a8d66e06f Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 8 Sep 2020 18:35:07 +0300 Subject: [PATCH 58/62] changes after rebase --- lib/pleroma/{http => tesla}/middleware/connection_pool.ex | 0 .../web/activity_pub/{ => mrf}/force_bot_unlisted_policy_test.exs | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename lib/pleroma/{http => tesla}/middleware/connection_pool.ex (100%) rename test/pleroma/web/activity_pub/{ => mrf}/force_bot_unlisted_policy_test.exs (100%) diff --git a/lib/pleroma/http/middleware/connection_pool.ex b/lib/pleroma/tesla/middleware/connection_pool.ex similarity index 100% rename from lib/pleroma/http/middleware/connection_pool.ex rename to lib/pleroma/tesla/middleware/connection_pool.ex diff --git a/test/pleroma/web/activity_pub/force_bot_unlisted_policy_test.exs b/test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs similarity index 100% rename from test/pleroma/web/activity_pub/force_bot_unlisted_policy_test.exs rename to test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs From bb111465a14575fb6d6cc2e11db9b217ada7c431 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sun, 13 Sep 2020 10:35:16 +0300 Subject: [PATCH 59/62] credo fix after rebase --- test/{ => pleroma}/workers/purge_expired_activity_test.exs | 0 test/{ => pleroma}/workers/purge_expired_token_test.exs | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename test/{ => pleroma}/workers/purge_expired_activity_test.exs (100%) rename test/{ => pleroma}/workers/purge_expired_token_test.exs (100%) diff --git a/test/workers/purge_expired_activity_test.exs b/test/pleroma/workers/purge_expired_activity_test.exs similarity index 100% rename from test/workers/purge_expired_activity_test.exs rename to test/pleroma/workers/purge_expired_activity_test.exs diff --git a/test/workers/purge_expired_token_test.exs b/test/pleroma/workers/purge_expired_token_test.exs similarity index 100% rename from test/workers/purge_expired_token_test.exs rename to test/pleroma/workers/purge_expired_token_test.exs From 5f2071c458b19311b035bf18c136e069023b7f5b Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sat, 19 Sep 2020 21:25:01 +0300 Subject: [PATCH 60/62] changes after rebase --- lib/pleroma/web/admin_api/controllers/chat_controller.ex | 2 +- .../web/admin_api/controllers/instance_document_controller.ex | 4 ++-- lib/pleroma/web/{fed_sockets => }/fed_sockets.ex | 0 .../object_validators/article_note_validator_test.exs | 0 .../web/activity_pub/transmogrifier/article_handling_test.exs | 0 .../web/activity_pub/transmogrifier/video_handling_test.exs | 0 .../web/admin_api/controllers/chat_controller_test.exs | 0 .../controllers/instance_document_controller_test.exs | 0 test/{ => pleroma}/web/fed_sockets/fed_registry_test.exs | 0 test/{ => pleroma}/web/fed_sockets/fetch_registry_test.exs | 0 test/{ => pleroma}/web/fed_sockets/socket_info_test.exs | 0 11 files changed, 3 insertions(+), 3 deletions(-) rename lib/pleroma/web/{fed_sockets => }/fed_sockets.ex (100%) rename test/{ => pleroma}/web/activity_pub/object_validators/article_note_validator_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/article_handling_test.exs (100%) rename test/{ => pleroma}/web/activity_pub/transmogrifier/video_handling_test.exs (100%) rename test/{ => pleroma}/web/admin_api/controllers/chat_controller_test.exs (100%) rename test/{ => pleroma}/web/admin_api/controllers/instance_document_controller_test.exs (100%) rename test/{ => pleroma}/web/fed_sockets/fed_registry_test.exs (100%) rename test/{ => pleroma}/web/fed_sockets/fetch_registry_test.exs (100%) rename test/{ => pleroma}/web/fed_sockets/socket_info_test.exs (100%) diff --git a/lib/pleroma/web/admin_api/controllers/chat_controller.ex b/lib/pleroma/web/admin_api/controllers/chat_controller.ex index 967600d69..af8ff8292 100644 --- a/lib/pleroma/web/admin_api/controllers/chat_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/chat_controller.ex @@ -10,10 +10,10 @@ defmodule Pleroma.Web.AdminAPI.ChatController do alias Pleroma.Chat.MessageReference alias Pleroma.ModerationLog alias Pleroma.Pagination - alias Pleroma.Plugs.OAuthScopesPlug alias Pleroma.Web.AdminAPI alias Pleroma.Web.CommonAPI alias Pleroma.Web.PleromaAPI.Chat.MessageReferenceView + alias Pleroma.Web.Plugs.OAuthScopesPlug require Logger diff --git a/lib/pleroma/web/admin_api/controllers/instance_document_controller.ex b/lib/pleroma/web/admin_api/controllers/instance_document_controller.ex index 504d9b517..37dbfeb72 100644 --- a/lib/pleroma/web/admin_api/controllers/instance_document_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/instance_document_controller.ex @@ -5,9 +5,9 @@ defmodule Pleroma.Web.AdminAPI.InstanceDocumentController do use Pleroma.Web, :controller - alias Pleroma.Plugs.InstanceStatic - alias Pleroma.Plugs.OAuthScopesPlug alias Pleroma.Web.InstanceDocument + alias Pleroma.Web.Plugs.InstanceStatic + alias Pleroma.Web.Plugs.OAuthScopesPlug plug(Pleroma.Web.ApiSpec.CastAndValidate) diff --git a/lib/pleroma/web/fed_sockets/fed_sockets.ex b/lib/pleroma/web/fed_sockets.ex similarity index 100% rename from lib/pleroma/web/fed_sockets/fed_sockets.ex rename to lib/pleroma/web/fed_sockets.ex diff --git a/test/web/activity_pub/object_validators/article_note_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/article_note_validator_test.exs similarity index 100% rename from test/web/activity_pub/object_validators/article_note_validator_test.exs rename to test/pleroma/web/activity_pub/object_validators/article_note_validator_test.exs diff --git a/test/web/activity_pub/transmogrifier/article_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/article_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/video_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs similarity index 100% rename from test/web/activity_pub/transmogrifier/video_handling_test.exs rename to test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs diff --git a/test/web/admin_api/controllers/chat_controller_test.exs b/test/pleroma/web/admin_api/controllers/chat_controller_test.exs similarity index 100% rename from test/web/admin_api/controllers/chat_controller_test.exs rename to test/pleroma/web/admin_api/controllers/chat_controller_test.exs diff --git a/test/web/admin_api/controllers/instance_document_controller_test.exs b/test/pleroma/web/admin_api/controllers/instance_document_controller_test.exs similarity index 100% rename from test/web/admin_api/controllers/instance_document_controller_test.exs rename to test/pleroma/web/admin_api/controllers/instance_document_controller_test.exs diff --git a/test/web/fed_sockets/fed_registry_test.exs b/test/pleroma/web/fed_sockets/fed_registry_test.exs similarity index 100% rename from test/web/fed_sockets/fed_registry_test.exs rename to test/pleroma/web/fed_sockets/fed_registry_test.exs diff --git a/test/web/fed_sockets/fetch_registry_test.exs b/test/pleroma/web/fed_sockets/fetch_registry_test.exs similarity index 100% rename from test/web/fed_sockets/fetch_registry_test.exs rename to test/pleroma/web/fed_sockets/fetch_registry_test.exs diff --git a/test/web/fed_sockets/socket_info_test.exs b/test/pleroma/web/fed_sockets/socket_info_test.exs similarity index 100% rename from test/web/fed_sockets/socket_info_test.exs rename to test/pleroma/web/fed_sockets/socket_info_test.exs From 3cb9c88837f3105363c5a615724b6363ee926d35 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sat, 19 Sep 2020 21:44:02 +0300 Subject: [PATCH 61/62] migration and warning for RemoteIp plug rename --- lib/pleroma/config/deprecation_warnings.ex | 19 ++++++++++++++++++- .../20200919182636_remoteip_plug_rename.exs | 19 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 priv/repo/migrations/20200919182636_remoteip_plug_rename.exs diff --git a/lib/pleroma/config/deprecation_warnings.ex b/lib/pleroma/config/deprecation_warnings.ex index 4ba6eaa77..59c6b0f58 100644 --- a/lib/pleroma/config/deprecation_warnings.ex +++ b/lib/pleroma/config/deprecation_warnings.ex @@ -39,7 +39,8 @@ def warn do :ok <- check_media_proxy_whitelist_config(), :ok <- check_welcome_message_config(), :ok <- check_gun_pool_options(), - :ok <- check_activity_expiration_config() do + :ok <- check_activity_expiration_config(), + :ok <- check_remote_ip_plug_name() do :ok else _ -> @@ -176,4 +177,20 @@ def check_activity_expiration_config do warning_preface ) end + + @spec check_remote_ip_plug_name() :: :ok | nil + def check_remote_ip_plug_name do + warning_preface = """ + !!!DEPRECATION WARNING!!! + Your config is using old namespace for RemoteIp Plug. Setting should work for now, but you are advised to change to new namespace to prevent possible issues later: + """ + + move_namespace_and_warn( + [ + {Pleroma.Plugs.RemoteIp, Pleroma.Web.Plugs.RemoteIp, + "\n* `config :pleroma, Pleroma.Plugs.RemoteIp` is now `config :pleroma, Pleroma.Web.Plugs.RemoteIp`"} + ], + warning_preface + ) + end end diff --git a/priv/repo/migrations/20200919182636_remoteip_plug_rename.exs b/priv/repo/migrations/20200919182636_remoteip_plug_rename.exs new file mode 100644 index 000000000..77c3b6db1 --- /dev/null +++ b/priv/repo/migrations/20200919182636_remoteip_plug_rename.exs @@ -0,0 +1,19 @@ +defmodule Pleroma.Repo.Migrations.RemoteipPlugRename do + use Ecto.Migration + + import Ecto.Query + + def up do + config = + from(c in Pleroma.ConfigDB, where: c.group == ^:pleroma and c.key == ^Pleroma.Plugs.RemoteIp) + |> Pleroma.Repo.one() + + if config do + config + |> Ecto.Changeset.change(key: Pleroma.Web.Plugs.RemoteIp) + |> Pleroma.Repo.update() + end + end + + def down, do: :ok +end From 4c4ea9a3486f824cfba825a176439d50ec54fe95 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 13 Oct 2020 17:10:34 +0300 Subject: [PATCH 62/62] changes after rebase --- docs/configuration/cheatsheet.md | 8 +------- .../web/pleroma_api/controllers/emoji_file_controller.ex | 2 +- .../web/pleroma_api/controllers/user_import_controller.ex | 2 +- lib/pleroma/web/streamer.ex | 2 +- test/pleroma/config/deprecation_warnings_test.exs | 2 +- test/{ => pleroma}/emoji/pack_test.exs | 0 test/{ => pleroma}/user/import_test.exs | 0 test/{ => pleroma}/user/query_test.exs | 0 test/{ => pleroma}/utils_test.exs | 0 .../controllers/emoji_file_controller_test.exs | 0 .../controllers/user_import_controller_test.exs | 0 test/pleroma/web/rich_media/helpers_test.exs | 1 - 12 files changed, 5 insertions(+), 12 deletions(-) rename test/{ => pleroma}/emoji/pack_test.exs (100%) rename test/{ => pleroma}/user/import_test.exs (100%) rename test/{ => pleroma}/user/query_test.exs (100%) rename test/{ => pleroma}/utils_test.exs (100%) rename test/{ => pleroma}/web/pleroma_api/controllers/emoji_file_controller_test.exs (100%) rename test/{ => pleroma}/web/pleroma_api/controllers/user_import_controller_test.exs (100%) diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index a6a152b7e..0b13d7e88 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -113,7 +113,7 @@ To add configuration to your config file, you can copy it from the base config. * `Pleroma.Web.ActivityPub.MRF.MentionPolicy`: Drops posts mentioning configurable users. (See [`:mrf_mention`](#mrf_mention)). * `Pleroma.Web.ActivityPub.MRF.VocabularyPolicy`: Restricts activities to a configured set of vocabulary. (See [`:mrf_vocabulary`](#mrf_vocabulary)). * `Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy`: Rejects or delists posts based on their age when received. (See [`:mrf_object_age`](#mrf_object_age)). - * `Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy`: Sets a default expiration on all posts made by users of the local instance. Requires `Pleroma.ActivityExpiration` to be enabled for processing the scheduled delections. + * `Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy`: Sets a default expiration on all posts made by users of the local instance. Requires `Pleroma.Workers.PurgeExpiredActivity` to be enabled for processing the scheduled delections. * `Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicy`: Makes all bot posts to disappear from public timelines. * `transparency`: Make the content of your Message Rewrite Facility settings public (via nodeinfo). * `transparency_exclusions`: Exclude specific instance names from MRF transparency. The use of the exclusions feature will be disclosed in nodeinfo as a boolean value. @@ -219,12 +219,6 @@ config :pleroma, :mrf_user_allowlist, %{ * `total_user_limit`: the number of scheduled activities a user is allowed to create in total (Default: `300`) * `enabled`: whether scheduled activities are sent to the job queue to be executed -## Pleroma.ActivityExpiration - -Enables the worker which processes posts scheduled for deletion. Pinned posts are exempt from expiration. - -* `enabled`: whether expired activities will be sent to the job queue to be deleted - ## FedSockets FedSockets is an experimental feature allowing for Pleroma backends to federate using a persistant websocket connection as opposed to making each federation a seperate http connection. This feature is currently off by default. It is configurable throught he following options. diff --git a/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex index 7c0345094..428c97de6 100644 --- a/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex @@ -11,7 +11,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileController do plug(Pleroma.Web.ApiSpec.CastAndValidate) plug( - Pleroma.Plugs.OAuthScopesPlug, + Pleroma.Web.Plugs.OAuthScopesPlug, %{scopes: ["write"], admin: true} when action in [ :create, diff --git a/lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex b/lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex index f10c45750..7f089af1c 100644 --- a/lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex @@ -7,9 +7,9 @@ defmodule Pleroma.Web.PleromaAPI.UserImportController do require Logger - alias Pleroma.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.ApiSpec + alias Pleroma.Web.Plugs.OAuthScopesPlug plug(OAuthScopesPlug, %{scopes: ["follow", "write:follows"]} when action == :follow) plug(OAuthScopesPlug, %{scopes: ["follow", "write:blocks"]} when action == :blocks) diff --git a/lib/pleroma/web/streamer.ex b/lib/pleroma/web/streamer.ex index 5475f18a6..d618dfe54 100644 --- a/lib/pleroma/web/streamer.ex +++ b/lib/pleroma/web/streamer.ex @@ -11,12 +11,12 @@ defmodule Pleroma.Web.Streamer do alias Pleroma.Conversation.Participation alias Pleroma.Notification alias Pleroma.Object - alias Pleroma.Plugs.OAuthScopesPlug alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.CommonAPI alias Pleroma.Web.OAuth.Token + alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.StreamerView @mix_env Mix.env() diff --git a/test/pleroma/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs index 02ada1aab..0cfed4555 100644 --- a/test/pleroma/config/deprecation_warnings_test.exs +++ b/test/pleroma/config/deprecation_warnings_test.exs @@ -87,7 +87,7 @@ test "check_hellthread_threshold/0" do end test "check_activity_expiration_config/0" do - clear_config([Pleroma.ActivityExpiration, :enabled], true) + clear_config(Pleroma.ActivityExpiration, enabled: true) assert capture_log(fn -> DeprecationWarnings.check_activity_expiration_config() diff --git a/test/emoji/pack_test.exs b/test/pleroma/emoji/pack_test.exs similarity index 100% rename from test/emoji/pack_test.exs rename to test/pleroma/emoji/pack_test.exs diff --git a/test/user/import_test.exs b/test/pleroma/user/import_test.exs similarity index 100% rename from test/user/import_test.exs rename to test/pleroma/user/import_test.exs diff --git a/test/user/query_test.exs b/test/pleroma/user/query_test.exs similarity index 100% rename from test/user/query_test.exs rename to test/pleroma/user/query_test.exs diff --git a/test/utils_test.exs b/test/pleroma/utils_test.exs similarity index 100% rename from test/utils_test.exs rename to test/pleroma/utils_test.exs diff --git a/test/web/pleroma_api/controllers/emoji_file_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs similarity index 100% rename from test/web/pleroma_api/controllers/emoji_file_controller_test.exs rename to test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs diff --git a/test/web/pleroma_api/controllers/user_import_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs similarity index 100% rename from test/web/pleroma_api/controllers/user_import_controller_test.exs rename to test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs diff --git a/test/pleroma/web/rich_media/helpers_test.exs b/test/pleroma/web/rich_media/helpers_test.exs index 4b97bd66b..4c9ee77d0 100644 --- a/test/pleroma/web/rich_media/helpers_test.exs +++ b/test/pleroma/web/rich_media/helpers_test.exs @@ -6,7 +6,6 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do use Pleroma.DataCase alias Pleroma.Config - alias Pleroma.Object alias Pleroma.Web.CommonAPI alias Pleroma.Web.RichMedia.Helpers