.*)/, image_data)
data = Base.decode64!(parsed["data"], ignore: :whitespace)
- hash = String.downcase(Base.encode16(:crypto.hash(:sha256, data)))
+ hash = Base.encode16(:crypto.hash(:sha256, data), lower: true)
with :ok <- check_binary_size(data, opts.size_limit),
tmp_path <- tempfile_for_image(data),
- {:ok, content_type, name} <-
- Pleroma.MIME.bin_mime_type(data, hash <> "." <> parsed["filetype"]) do
+ {:ok, %{mime_type: content_type}} <-
+ Majic.perform({:bytes, data}, pool: Pleroma.MajicPool),
+ [ext | _] <- MIME.extensions(content_type) do
{:ok,
%__MODULE__{
id: UUID.generate(),
- name: name,
+ name: hash <> "." <> ext,
tempfile: tmp_path,
content_type: content_type
}}
@@ -172,7 +173,7 @@ defp prepare_upload(%{img: "data:image/" <> image_data}, opts) do
# For Mix.Tasks.MigrateLocalUploads
defp prepare_upload(%__MODULE__{tempfile: path} = upload, _opts) do
- with {:ok, content_type} <- Pleroma.MIME.file_mime_type(path) do
+ with {:ok, %{mime_type: content_type}} <- Majic.perform(path, pool: Pleroma.MajicPool) do
{:ok, %__MODULE__{upload | content_type: content_type}}
end
end
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/user.ex b/lib/pleroma/user.ex
index 09ea80793..87c8bfbd1 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -107,7 +107,7 @@ defmodule Pleroma.User do
field(:note_count, :integer, default: 0)
field(:follower_count, :integer, default: 0)
field(:following_count, :integer, default: 0)
- field(:locked, :boolean, default: false)
+ field(:is_locked, :boolean, default: false)
field(:confirmation_pending, :boolean, default: false)
field(:password_reset_pending, :boolean, default: false)
field(:approval_pending, :boolean, default: false)
@@ -436,7 +436,7 @@ def remote_user_changeset(struct \\ %User{local: false}, params) do
:avatar,
:ap_enabled,
:banner,
- :locked,
+ :is_locked,
:last_refreshed_at,
:uri,
:follower_address,
@@ -479,7 +479,7 @@ def update_changeset(struct, params \\ %{}) do
:public_key,
:inbox,
:shared_inbox,
- :locked,
+ :is_locked,
:no_rich_text,
:default_scope,
:banner,
@@ -847,7 +847,7 @@ def needs_update?(_), do: true
@spec maybe_direct_follow(User.t(), User.t()) :: {:ok, User.t()} | {:error, String.t()}
# "Locked" (self-locked) users demand explicit authorization of follow requests
- def maybe_direct_follow(%User{} = follower, %User{local: true, locked: true} = followed) do
+ def maybe_direct_follow(%User{} = follower, %User{local: true, is_locked: true} = followed) do
follow(follower, followed, :follow_pending)
end
@@ -954,7 +954,7 @@ def get_follow_state(
end
def locked?(%User{} = user) do
- user.locked || false
+ user.is_locked || false
end
def get_by_id(id) do
@@ -1601,7 +1601,7 @@ def purge_user_changeset(user) do
note_count: 0,
follower_count: 0,
following_count: 0,
- locked: false,
+ is_locked: false,
confirmation_pending: false,
password_reset_pending: false,
approval_pending: false,
diff --git a/lib/pleroma/web/web.ex b/lib/pleroma/web.ex
similarity index 93%
rename from lib/pleroma/web/web.ex
rename to lib/pleroma/web.ex
index 4f9281851..7779826e3 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,
@@ -25,12 +20,12 @@ defmodule Pleroma.Web do
below.
"""
- alias Pleroma.Plugs.EnsureAuthenticatedPlug
- alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug
- alias Pleroma.Plugs.ExpectAuthenticatedCheckPlug
- alias Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug
- alias Pleroma.Plugs.OAuthScopesPlug
- alias Pleroma.Plugs.PlugHelper
+ alias Pleroma.Web.Plugs.EnsureAuthenticatedPlug
+ alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug
+ alias Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug
+ alias Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug
+ alias Pleroma.Web.Plugs.OAuthScopesPlug
+ alias Pleroma.Web.Plugs.PlugHelper
def controller do
quote do
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
index eb44cffec..8022f0402 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -1228,7 +1228,7 @@ defp object_to_user_data(data) do
{String.trim(name, ":"), url}
end)
- locked = data["manuallyApprovesFollowers"] || false
+ is_locked = data["manuallyApprovesFollowers"] || false
capabilities = data["capabilities"] || %{}
accepts_chat_messages = capabilities["acceptsChatMessages"]
data = Transmogrifier.maybe_fix_user_object(data)
@@ -1257,7 +1257,7 @@ defp object_to_user_data(data) do
banner: banner,
fields: fields,
emoji: emojis,
- locked: locked,
+ is_locked: is_locked,
discoverable: discoverable,
invisible: invisible,
avatar: avatar,
diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex
index 732c44271..570bcc7e7 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.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.FederatingPlug
alias Pleroma.Web.Federator
+ alias Pleroma.Web.Plugs.EnsureAuthenticatedPlug
+ alias Pleroma.Web.Plugs.FederatingPlug
require Logger
@@ -45,8 +45,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
when action in [:read_inbox, :update_outbox, :whoami, :upload_media]
)
+ plug(Majic.Plug, [pool: Pleroma.MajicPool] when action in [:upload_media])
+
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/activity_pub/builder.ex b/lib/pleroma/web/activity_pub/builder.ex
index 9a7b7d9de..298aff6b7 100644
--- a/lib/pleroma/web/activity_pub/builder.ex
+++ b/lib/pleroma/web/activity_pub/builder.ex
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.ActivityPub.Builder do
@moduledoc """
This module builds the objects. Meant to be used for creating local objects.
diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex
index b9a83a544..d421ca7af 100644
--- a/lib/pleroma/web/activity_pub/side_effects.ex
+++ b/lib/pleroma/web/activity_pub/side_effects.ex
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.ActivityPub.SideEffects do
@moduledoc """
This module looks at an inserted object and executes the side effects that it
@@ -98,7 +102,7 @@ def handle(
%User{} = followed <- User.get_cached_by_ap_id(followed_user),
{_, {:ok, _}, _, _} <-
{:following, User.follow(follower, followed, :follow_pending), follower, followed} do
- if followed.local && !followed.locked do
+ if followed.local && !followed.is_locked do
{:ok, accept_data, _} = Builder.accept(followed, object)
{:ok, _activity, _} = Pipeline.common_pipeline(accept_data, local: true)
end
diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex
index 3a4564912..c6dee61db 100644
--- a/lib/pleroma/web/activity_pub/views/user_view.ex
+++ b/lib/pleroma/web/activity_pub/views/user_view.ex
@@ -101,7 +101,7 @@ def render("user.json", %{user: user}) do
"name" => user.name,
"summary" => user.bio,
"url" => user.ap_id,
- "manuallyApprovesFollowers" => user.locked,
+ "manuallyApprovesFollowers" => user.is_locked,
"publicKey" => %{
"id" => "#{user.ap_id}#main-key",
"owner" => user.ap_id,
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 8b5310d80..a4f0d7d34 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.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
require Logger
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/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/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/admin_api/controllers/invite_controller.ex b/lib/pleroma/web/admin_api/controllers/invite_controller.ex
index 7d169b8d2..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.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 131e22d78..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.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/oauth_app_controller.ex b/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex
similarity index 97%
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
index dca23ea73..116a05a4d 100644
--- a/lib/pleroma/web/admin_api/controllers/oauth_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.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 6c19f09f7..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.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 4c011e174..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.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 bc48cc527..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.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/admin_api/views/account_view.ex b/lib/pleroma/web/admin_api/views/account_view.ex
index 9c477feab..bda7ea19c 100644
--- a/lib/pleroma/web/admin_api/views/account_view.ex
+++ b/lib/pleroma/web/admin_api/views/account_view.ex
@@ -39,7 +39,7 @@ def render("credentials.json", %{user: user, for: for_user}) do
:fields,
:name,
:nickname,
- :locked,
+ :is_locked,
:no_rich_text,
:default_scope,
:hide_follows,
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/api_spec/schemas/chat.ex b/lib/pleroma/web/api_spec/schemas/chat.ex
index b4986b734..65f908e33 100644
--- a/lib/pleroma/web/api_spec/schemas/chat.ex
+++ b/lib/pleroma/web/api_spec/schemas/chat.ex
@@ -50,7 +50,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Chat do
"fields" => []
},
"statuses_count" => 1,
- "locked" => false,
+ "is_locked" => false,
"created_at" => "2020-04-16T13:40:15.000Z",
"display_name" => "lain",
"fields" => [],
diff --git a/lib/pleroma/web/api_spec/schemas/status.ex b/lib/pleroma/web/api_spec/schemas/status.ex
index 947e42890..e6890df2d 100644
--- a/lib/pleroma/web/api_spec/schemas/status.ex
+++ b/lib/pleroma/web/api_spec/schemas/status.ex
@@ -252,7 +252,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
"header" => "http://localhost:4001/images/banner.png",
"header_static" => "http://localhost:4001/images/banner.png",
"id" => "9toJCsKN7SmSf3aj5c",
- "locked" => false,
+ "is_locked" => false,
"note" => "Tester Number 6",
"pleroma" => %{
"background_image" => nil,
diff --git a/lib/pleroma/web/auth/pleroma_authenticator.ex b/lib/pleroma/web/auth/pleroma_authenticator.ex
index c611b3e09..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.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 1794e407c..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.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/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/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex
index 9d7b24eb2..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.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/endpoint.ex b/lib/pleroma/web/endpoint.ex
index 8b153763d..56562c12f 100644
--- a/lib/pleroma/web/endpoint.ex
+++ b/lib/pleroma/web/endpoint.ex
@@ -9,17 +9,17 @@ 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.Plugs.UploadedMedia)
+ plug(Pleroma.Web.Plugs.HTTPSecurityPlug)
+ plug(Pleroma.Web.Plugs.UploadedMedia)
@static_cache_control "public, no-cache"
# 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,
@@ -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,
@@ -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)
@@ -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/fallback_redirect_controller.ex b/lib/pleroma/web/fallback/redirect_controller.ex
similarity index 95%
rename from lib/pleroma/web/fallback_redirect_controller.ex
rename to lib/pleroma/web/fallback/redirect_controller.ex
index 431ad5485..6f759d559 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
@@ -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/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/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..752983c3b 100644
--- a/lib/pleroma/web/feed/user_controller.ex
+++ b/lib/pleroma/web/feed/user_controller.ex
@@ -5,27 +5,26 @@
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
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)
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
def feed_redirect(%{assigns: %{format: format}} = conn, _params)
when format in ["json", "activity+json"] do
with %{halted: false} = conn <-
- Pleroma.Plugs.EnsureAuthenticatedPlug.call(conn,
- unless_func: &Pleroma.Web.FederatingPlug.federating?/1
+ Pleroma.Web.Plugs.EnsureAuthenticatedPlug.call(conn,
+ unless_func: &Pleroma.Web.Plugs.FederatingPlug.federating?/1
) do
ActivityPubController.call(conn, :user)
end
diff --git a/lib/pleroma/web/mailer/subscription_controller.ex b/lib/pleroma/web/mailer/subscription_controller.ex
index 478a83518..ace44afd1 100644
--- a/lib/pleroma/web/mailer/subscription_controller.ex
+++ b/lib/pleroma/web/mailer/subscription_controller.ex
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.Mailer.SubscriptionController do
use Pleroma.Web, :controller
diff --git a/lib/pleroma/web/masto_fe_controller.ex b/lib/pleroma/web/masto_fe_controller.ex
index 43ec70021..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.Plugs.EnsurePublicOrAuthenticatedPlug
- alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.User
+ alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug
+ alias Pleroma.Web.Plugs.OAuthScopesPlug
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 95d8452df..97858a93c 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.Plugs.EnsurePublicOrAuthenticatedPlug
- alias Pleroma.Plugs.OAuthScopesPlug
- alias Pleroma.Plugs.RateLimiter
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Builder
@@ -29,6 +26,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
alias Pleroma.Web.MastodonAPI.StatusView
alias Pleroma.Web.OAuth.OAuthController
alias Pleroma.Web.OAuth.OAuthView
+ 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)
@@ -177,7 +177,6 @@ def update_credentials(%{assigns: %{user: user}, body_params: params} = conn, _p
user_params =
[
:no_rich_text,
- :locked,
:hide_followers_count,
:hide_follows_count,
:hide_followers,
@@ -210,6 +209,7 @@ def update_credentials(%{assigns: %{user: user}, body_params: params} = conn, _p
if bot, do: {:ok, "Service"}, else: {:ok, "Person"}
end)
|> Maps.put_if_present(:actor_type, params[:actor_type])
+ |> Maps.put_if_present(:is_locked, params[:locked])
# What happens here:
#
diff --git a/lib/pleroma/web/mastodon_api/controllers/app_controller.ex b/lib/pleroma/web/mastodon_api/controllers/app_controller.ex
index a516b6c20..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.Plugs.EnsurePublicOrAuthenticatedPlug
- alias Pleroma.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/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/conversation_controller.ex b/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex
index f35ec3596..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.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/custom_emoji_controller.ex b/lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex
index c5f47c5df..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.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/domain_block_controller.ex b/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex
index 9c2d093cd..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.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/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..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.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/instance_controller.ex b/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex
index d8859731d..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.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/list_controller.ex b/lib/pleroma/web/mastodon_api/controllers/list_controller.ex
index 5daeaa780..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.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/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..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.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/media_controller.ex b/lib/pleroma/web/mastodon_api/controllers/media_controller.ex
index 513de279f..161193134 100644
--- a/lib/pleroma/web/mastodon_api/controllers/media_controller.ex
+++ b/lib/pleroma/web/mastodon_api/controllers/media_controller.ex
@@ -6,11 +6,12 @@ defmodule Pleroma.Web.MastodonAPI.MediaController do
use Pleroma.Web, :controller
alias Pleroma.Object
- alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
+ alias Pleroma.Web.Plugs.OAuthScopesPlug
action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
+ plug(Majic.Plug, [pool: Pleroma.MajicPool] when action in [:create, :create2])
plug(Pleroma.Web.ApiSpec.CastAndValidate)
plug(:put_view, Pleroma.Web.MastodonAPI.StatusView)
diff --git a/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex b/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex
index e25cef30b..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.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 db46ffcfc..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.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/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..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.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 5a983db39..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.Plugs.OAuthScopesPlug
- alias Pleroma.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 ecfa38489..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.Plugs.OAuthScopesPlug
- alias Pleroma.Plugs.RateLimiter
alias Pleroma.Repo
alias Pleroma.ScheduledActivity
alias Pleroma.User
@@ -23,9 +21,15 @@ 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)
- 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/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 5272790d3..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.Plugs.EnsurePublicOrAuthenticatedPlug
- alias Pleroma.Plugs.OAuthScopesPlug
- alias Pleroma.Plugs.RateLimiter
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
+ alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug
+ alias Pleroma.Web.Plugs.OAuthScopesPlug
+ alias Pleroma.Web.Plugs.RateLimiter
plug(Pleroma.Web.ApiSpec.CastAndValidate)
plug(:skip_plug, EnsurePublicOrAuthenticatedPlug when action in [:public, :hashtag])
diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex
index 121ba1693..d54cae732 100644
--- a/lib/pleroma/web/mastodon_api/views/account_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/account_view.ex
@@ -242,7 +242,7 @@ defp do_render("show.json", %{user: user} = opts) do
username: username_from_nickname(user.nickname),
acct: user.nickname,
display_name: display_name,
- locked: user.locked,
+ locked: user.is_locked,
created_at: Utils.to_masto_date(user.inserted_at),
followers_count: followers_count,
following_count: following_count,
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/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/open_graph.ex
similarity index 100%
rename from lib/pleroma/web/metadata/opengraph.ex
rename to lib/pleroma/web/metadata/providers/open_graph.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
diff --git a/lib/pleroma/web/mongooseim/mongoose_im_controller.ex b/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex
similarity index 93%
rename from lib/pleroma/web/mongooseim/mongoose_im_controller.ex
rename to lib/pleroma/web/mongoose_im/mongoose_im_controller.ex
index 6cbbe8fd8..2a5c7c356 100644
--- a/lib/pleroma/web/mongooseim/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.Plugs.AuthenticationPlug
- alias Pleroma.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/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 99%
rename from lib/pleroma/web/oauth/oauth_controller.ex
rename to lib/pleroma/web/o_auth/o_auth_controller.ex
index a4152e840..d2f9d1ceb 100644
--- a/lib/pleroma/web/oauth/oauth_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.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
@@ -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.Web.Plugs.EnsurePublicOrAuthenticatedPlug
+ ])
plug(RateLimiter, [name: :authentication] when action == :create_authorization)
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 97%
rename from lib/pleroma/web/oauth/scopes.ex
rename to lib/pleroma/web/o_auth/scopes.ex
index 6f06f1431..90b9a0471 100644
--- a/lib/pleroma/web/oauth/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/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
diff --git a/lib/pleroma/web/ostatus/ostatus_controller.ex b/lib/pleroma/web/o_status/o_status_controller.ex
similarity index 95%
rename from lib/pleroma/web/ostatus/ostatus_controller.ex
rename to lib/pleroma/web/o_status/o_status_controller.ex
index de1b0b3f0..b044260b3 100644
--- a/lib/pleroma/web/ostatus/ostatus_controller.ex
+++ b/lib/pleroma/web/o_status/o_status_controller.ex
@@ -5,19 +5,19 @@
defmodule Pleroma.Web.OStatus.OStatusController do
use Pleroma.Web, :controller
- alias Fallback.RedirectController
alias Pleroma.Activity
alias Pleroma.Object
- alias Pleroma.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.Plugs.EnsureAuthenticatedPlug,
- unless_func: &Pleroma.Web.FederatingPlug.federating?/1
+ plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug,
+ unless_func: &Pleroma.Web.Plugs.FederatingPlug.federating?/1
)
plug(
@@ -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/pleroma_api/controllers/account_controller.ex b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex
index 563edded7..30cf83567 100644
--- a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex
+++ b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex
@@ -8,15 +8,20 @@ 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.Plugs.OAuthScopesPlug
- alias Pleroma.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
+ plug(
+ Majic.Plug,
+ [pool: Pleroma.MajicPool] when action in [:update_avatar, :update_background, :update_banner]
+ )
+
plug(
OpenApiSpex.Plug.PutApiSpec,
[module: Pleroma.Web.ApiSpec] when action == :confirmation_resend
diff --git a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex
index e667831c5..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.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 3d007f324..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.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_file_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex
index 71c53df1d..428c97de6 100644
--- a/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex
+++ b/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.PleromaAPI.EmojiFileController do
use Pleroma.Web, :controller
@@ -7,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/emoji_pack_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex
index 6696f8b92..a9accc5af 100644
--- a/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex
+++ b/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.PleromaAPI.EmojiPackController do
use Pleroma.Web, :controller
@@ -6,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,
@@ -18,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.EnsurePublicOrAuthenticatedPlug
+ ]
+ 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..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.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 df6c50ca5..15210f1e6 100644
--- a/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex
+++ b/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex
@@ -5,10 +5,11 @@
defmodule Pleroma.Web.PleromaAPI.MascotController do
use Pleroma.Web, :controller
- alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
+ alias Pleroma.Web.Plugs.OAuthScopesPlug
+ plug(Majic.Plug, [pool: Pleroma.MajicPool] when action in [:update])
plug(Pleroma.Web.ApiSpec.CastAndValidate)
plug(OAuthScopesPlug, %{scopes: ["read:accounts"]} when action == :show)
plug(OAuthScopesPlug, %{scopes: ["write:accounts"]} when action != :show)
@@ -22,14 +23,15 @@ def show(%{assigns: %{user: user}} = conn, _params) do
@doc "PUT /api/v1/pleroma/mascot"
def update(%{assigns: %{user: user}, body_params: %{file: file}} = conn, _) do
- with {:ok, object} <- ActivityPub.upload(file, actor: User.ap_id(user)),
- # Reject if not an image
- %{type: "image"} = attachment <- render_attachment(object) do
+ with {:content_type, "image" <> _} <- {:content_type, file.content_type},
+ {:ok, object} <- ActivityPub.upload(file, actor: User.ap_id(user)) do
+ attachment = render_attachment(object)
{:ok, _user} = User.mascot_update(user, attachment)
json(conn, attachment)
else
- %{type: _} -> render_error(conn, :unsupported_media_type, "mascots can only be images")
+ {:content_type, _} ->
+ render_error(conn, :unsupported_media_type, "mascots can only be images")
end
end
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..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.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 b86791d09..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.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/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/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/plugs/admin_secret_authentication_plug.ex b/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex
similarity index 89%
rename from lib/pleroma/plugs/admin_secret_authentication_plug.ex
rename to lib/pleroma/web/plugs/admin_secret_authentication_plug.ex
index 2e54df47a..d7d4e4092 100644
--- a/lib/pleroma/plugs/admin_secret_authentication_plug.ex
+++ b/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex
@@ -2,12 +2,12 @@
# 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
- alias Pleroma.Plugs.RateLimiter
alias Pleroma.User
+ alias Pleroma.Web.Plugs.OAuthScopesPlug
+ alias Pleroma.Web.Plugs.RateLimiter
def init(options) do
options
diff --git a/lib/pleroma/plugs/authentication_plug.ex b/lib/pleroma/web/plugs/authentication_plug.ex
similarity index 94%
rename from lib/pleroma/plugs/authentication_plug.ex
rename to lib/pleroma/web/plugs/authentication_plug.ex
index 057ea42f1..e2a8b1b69 100644
--- a/lib/pleroma/plugs/authentication_plug.ex
+++ b/lib/pleroma/web/plugs/authentication_plug.ex
@@ -2,8 +2,7 @@
# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
-defmodule Pleroma.Plugs.AuthenticationPlug do
- alias Pleroma.Plugs.OAuthScopesPlug
+defmodule Pleroma.Web.Plugs.AuthenticationPlug do
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/plugs/basic_auth_decoder_plug.ex b/lib/pleroma/web/plugs/basic_auth_decoder_plug.ex
similarity index 92%
rename from lib/pleroma/plugs/basic_auth_decoder_plug.ex
rename to lib/pleroma/web/plugs/basic_auth_decoder_plug.ex
index af7ecb0d8..4dadfb000 100644
--- a/lib/pleroma/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/plugs/cache.ex b/lib/pleroma/web/plugs/cache.ex
similarity index 96%
rename from lib/pleroma/plugs/cache.ex
rename to lib/pleroma/web/plugs/cache.ex
index f65c2a189..6de01804a 100644
--- a/lib/pleroma/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/lib/pleroma/plugs/digest.ex b/lib/pleroma/web/plugs/digest_plug.ex
similarity index 100%
rename from lib/pleroma/plugs/digest.ex
rename to lib/pleroma/web/plugs/digest_plug.ex
diff --git a/lib/pleroma/plugs/ensure_authenticated_plug.ex b/lib/pleroma/web/plugs/ensure_authenticated_plug.ex
similarity index 94%
rename from lib/pleroma/plugs/ensure_authenticated_plug.ex
rename to lib/pleroma/web/plugs/ensure_authenticated_plug.ex
index 3fe550806..ea2af6881 100644
--- a/lib/pleroma/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/plugs/ensure_public_or_authenticated_plug.ex b/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex
similarity index 91%
rename from lib/pleroma/plugs/ensure_public_or_authenticated_plug.ex
rename to lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex
index 7265bb87a..3bebdac6d 100644
--- a/lib/pleroma/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/plugs/ensure_user_key_plug.ex b/lib/pleroma/web/plugs/ensure_user_key_plug.ex
similarity index 87%
rename from lib/pleroma/plugs/ensure_user_key_plug.ex
rename to lib/pleroma/web/plugs/ensure_user_key_plug.ex
index 9795cdbde..70d3091f0 100644
--- a/lib/pleroma/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/plugs/expect_authenticated_check_plug.ex b/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex
similarity index 71%
rename from lib/pleroma/plugs/expect_authenticated_check_plug.ex
rename to lib/pleroma/web/plugs/expect_authenticated_check_plug.ex
index 66b8d5de5..0925ded4d 100644
--- a/lib/pleroma/plugs/expect_authenticated_check_plug.ex
+++ b/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex
@@ -2,9 +2,9 @@
# 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.
+ 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/plugs/expect_public_or_authenticated_check_plug.ex b/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex
similarity index 70%
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
index ba0ef76bd..ace512a78 100644
--- a/lib/pleroma/plugs/expect_public_or_authenticated_check_plug.ex
+++ b/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex
@@ -2,9 +2,9 @@
# 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
+ 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/plugs/federating_plug.ex b/lib/pleroma/web/plugs/federating_plug.ex
similarity index 93%
rename from lib/pleroma/plugs/federating_plug.ex
rename to lib/pleroma/web/plugs/federating_plug.ex
index 09038f3c6..3c90a7644 100644
--- a/lib/pleroma/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/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/plugs/http_security_plug.ex b/lib/pleroma/web/plugs/http_security_plug.ex
similarity index 99%
rename from lib/pleroma/plugs/http_security_plug.ex
rename to lib/pleroma/web/plugs/http_security_plug.ex
index c363b193b..45aaf188e 100644
--- a/lib/pleroma/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/plugs/http_signature.ex b/lib/pleroma/web/plugs/http_signature_plug.ex
similarity index 100%
rename from lib/pleroma/plugs/http_signature.ex
rename to lib/pleroma/web/plugs/http_signature_plug.ex
diff --git a/lib/pleroma/plugs/idempotency_plug.ex b/lib/pleroma/web/plugs/idempotency_plug.ex
similarity index 97%
rename from lib/pleroma/plugs/idempotency_plug.ex
rename to lib/pleroma/web/plugs/idempotency_plug.ex
index f41397075..254a790b0 100644
--- a/lib/pleroma/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/plugs/instance_static.ex b/lib/pleroma/web/plugs/instance_static.ex
similarity index 91%
rename from lib/pleroma/plugs/instance_static.ex
rename to lib/pleroma/web/plugs/instance_static.ex
index 0fb57e422..54b9175df 100644
--- a/lib/pleroma/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 """
@@ -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/lib/pleroma/plugs/legacy_authentication_plug.ex b/lib/pleroma/web/plugs/legacy_authentication_plug.ex
similarity index 87%
rename from lib/pleroma/plugs/legacy_authentication_plug.ex
rename to lib/pleroma/web/plugs/legacy_authentication_plug.ex
index d346e01a6..2a54d0b59 100644
--- a/lib/pleroma/plugs/legacy_authentication_plug.ex
+++ b/lib/pleroma/web/plugs/legacy_authentication_plug.ex
@@ -2,10 +2,9 @@
# 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.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/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/oauth_plug.ex b/lib/pleroma/web/plugs/o_auth_plug.ex
similarity index 98%
rename from lib/pleroma/plugs/oauth_plug.ex
rename to lib/pleroma/web/plugs/o_auth_plug.ex
index 6fa71ef47..c7b58d90f 100644
--- a/lib/pleroma/plugs/oauth_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/plugs/oauth_scopes_plug.ex b/lib/pleroma/web/plugs/o_auth_scopes_plug.ex
similarity index 97%
rename from lib/pleroma/plugs/oauth_scopes_plug.ex
rename to lib/pleroma/web/plugs/o_auth_scopes_plug.ex
index b1a736d78..cfc30837c 100644
--- a/lib/pleroma/plugs/oauth_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/plugs/plug_helper.ex b/lib/pleroma/web/plugs/plug_helper.ex
similarity index 97%
rename from lib/pleroma/plugs/plug_helper.ex
rename to lib/pleroma/web/plugs/plug_helper.ex
index 9c67be8ef..b314e7596 100644
--- a/lib/pleroma/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/lib/pleroma/plugs/rate_limiter/rate_limiter.ex b/lib/pleroma/web/plugs/rate_limiter.ex
similarity index 93%
rename from lib/pleroma/plugs/rate_limiter/rate_limiter.ex
rename to lib/pleroma/web/plugs/rate_limiter.ex
index c51e2c634..a589610d1 100644
--- a/lib/pleroma/plugs/rate_limiter/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
"""
@@ -67,8 +67,8 @@ defmodule Pleroma.Plugs.RateLimiter do
import Plug.Conn
alias Pleroma.Config
- alias Pleroma.Plugs.RateLimiter.LimiterSupervisor
alias Pleroma.User
+ alias Pleroma.Web.Plugs.RateLimiter.LimiterSupervisor
require Logger
diff --git a/lib/pleroma/plugs/rate_limiter/limiter_supervisor.ex b/lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex
similarity index 83%
rename from lib/pleroma/plugs/rate_limiter/limiter_supervisor.ex
rename to lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex
index 884268d96..5642bb205 100644
--- a/lib/pleroma/plugs/rate_limiter/limiter_supervisor.ex
+++ b/lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex
@@ -1,4 +1,8 @@
-defmodule Pleroma.Plugs.RateLimiter.LimiterSupervisor do
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Web.Plugs.RateLimiter.LimiterSupervisor do
use DynamicSupervisor
import Cachex.Spec
diff --git a/lib/pleroma/plugs/rate_limiter/supervisor.ex b/lib/pleroma/web/plugs/rate_limiter/supervisor.ex
similarity index 51%
rename from lib/pleroma/plugs/rate_limiter/supervisor.ex
rename to lib/pleroma/web/plugs/rate_limiter/supervisor.ex
index 9672f7876..a1c84063d 100644
--- a/lib/pleroma/plugs/rate_limiter/supervisor.ex
+++ b/lib/pleroma/web/plugs/rate_limiter/supervisor.ex
@@ -1,4 +1,8 @@
-defmodule Pleroma.Plugs.RateLimiter.Supervisor do
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Web.Plugs.RateLimiter.Supervisor do
use Supervisor
def start_link(opts) do
@@ -7,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]
diff --git a/lib/pleroma/web/plugs/remote_ip.ex b/lib/pleroma/web/plugs/remote_ip.ex
new file mode 100644
index 000000000..401e2cbfa
--- /dev/null
+++ b/lib/pleroma/web/plugs/remote_ip.ex
@@ -0,0 +1,48 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+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.
+ """
+
+ alias Pleroma.Config
+ import Plug.Conn
+
+ @behaviour Plug
+
+ def init(_), do: nil
+
+ def call(%{remote_ip: original_remote_ip} = conn, _) do
+ if Config.get([__MODULE__, :enabled]) do
+ %{remote_ip: new_remote_ip} = conn = RemoteIp.call(conn, remote_ip_opts())
+ assign(conn, :remote_ip_found, original_remote_ip != new_remote_ip)
+ else
+ conn
+ end
+ end
+
+ defp remote_ip_opts do
+ headers = Config.get([__MODULE__, :headers], []) |> MapSet.new()
+ reserved = Config.get([__MODULE__, :reserved], [])
+
+ proxies =
+ Config.get([__MODULE__, :proxies], [])
+ |> Enum.concat(reserved)
+ |> Enum.map(&maybe_add_cidr/1)
+
+ {headers, proxies}
+ end
+
+ defp maybe_add_cidr(proxy) when is_binary(proxy) do
+ proxy =
+ cond do
+ "/" in String.codepoints(proxy) -> proxy
+ InetCidr.v4?(InetCidr.parse_address!(proxy)) -> proxy <> "/32"
+ InetCidr.v6?(InetCidr.parse_address!(proxy)) -> proxy <> "/128"
+ end
+
+ InetCidr.parse(proxy, true)
+ end
+end
diff --git a/lib/pleroma/plugs/session_authentication_plug.ex b/lib/pleroma/web/plugs/session_authentication_plug.ex
similarity index 89%
rename from lib/pleroma/plugs/session_authentication_plug.ex
rename to lib/pleroma/web/plugs/session_authentication_plug.ex
index 0f83a5e53..6e176d553 100644
--- a/lib/pleroma/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/plugs/set_format_plug.ex b/lib/pleroma/web/plugs/set_format_plug.ex
similarity index 92%
rename from lib/pleroma/plugs/set_format_plug.ex
rename to lib/pleroma/web/plugs/set_format_plug.ex
index c03fcb28d..c16d2f81d 100644
--- a/lib/pleroma/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/plugs/set_locale_plug.ex b/lib/pleroma/web/plugs/set_locale_plug.ex
similarity index 97%
rename from lib/pleroma/plugs/set_locale_plug.ex
rename to lib/pleroma/web/plugs/set_locale_plug.ex
index 9a21d0a9d..d9d24b93f 100644
--- a/lib/pleroma/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/lib/pleroma/plugs/set_user_session_id_plug.ex b/lib/pleroma/web/plugs/set_user_session_id_plug.ex
similarity index 87%
rename from lib/pleroma/plugs/set_user_session_id_plug.ex
rename to lib/pleroma/web/plugs/set_user_session_id_plug.ex
index 730c4ac74..e520159e4 100644
--- a/lib/pleroma/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/plugs/static_fe_plug.ex b/lib/pleroma/web/plugs/static_fe_plug.ex
similarity index 93%
rename from lib/pleroma/plugs/static_fe_plug.ex
rename to lib/pleroma/web/plugs/static_fe_plug.ex
index 143665c71..658a1052e 100644
--- a/lib/pleroma/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/plugs/trailing_format_plug.ex b/lib/pleroma/web/plugs/trailing_format_plug.ex
similarity index 95%
rename from lib/pleroma/plugs/trailing_format_plug.ex
rename to lib/pleroma/web/plugs/trailing_format_plug.ex
index 8b4d5fc9f..e3f57c14a 100644
--- a/lib/pleroma/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
diff --git a/lib/pleroma/plugs/uploaded_media.ex b/lib/pleroma/web/plugs/uploaded_media.ex
similarity index 98%
rename from lib/pleroma/plugs/uploaded_media.ex
rename to lib/pleroma/web/plugs/uploaded_media.ex
index 40984cfc0..402a8bb34 100644
--- a/lib/pleroma/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 """
"""
diff --git a/lib/pleroma/plugs/user_enabled_plug.ex b/lib/pleroma/web/plugs/user_enabled_plug.ex
similarity index 90%
rename from lib/pleroma/plugs/user_enabled_plug.ex
rename to lib/pleroma/web/plugs/user_enabled_plug.ex
index 23e800a74..fa28ee48b 100644
--- a/lib/pleroma/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/plugs/user_fetcher_plug.ex b/lib/pleroma/web/plugs/user_fetcher_plug.ex
similarity index 91%
rename from lib/pleroma/plugs/user_fetcher_plug.ex
rename to lib/pleroma/web/plugs/user_fetcher_plug.ex
index 235c77d85..4039600da 100644
--- a/lib/pleroma/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/plugs/user_is_admin_plug.ex b/lib/pleroma/web/plugs/user_is_admin_plug.ex
similarity index 91%
rename from lib/pleroma/plugs/user_is_admin_plug.ex
rename to lib/pleroma/web/plugs/user_is_admin_plug.ex
index 488a61d1d..531c965f0 100644
--- a/lib/pleroma/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/preload/instance.ex b/lib/pleroma/web/preload/providers/instance.ex
similarity index 79%
rename from lib/pleroma/web/preload/instance.ex
rename to lib/pleroma/web/preload/providers/instance.ex
index 50d1f3382..a549bb1eb 100644
--- a/lib/pleroma/web/preload/instance.ex
+++ b/lib/pleroma/web/preload/providers/instance.ex
@@ -3,15 +3,17 @@
# 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
@behaviour Provider
@instance_url "/api/v1/instance"
@panel_url "/instance/panel.html"
@nodeinfo_url "/nodeinfo/2.0.json"
+ @fe_config_url "/api/pleroma/frontend_configurations"
@impl Provider
def generate_terms(_params) do
@@ -19,6 +21,7 @@ def generate_terms(_params) do
|> build_info_tag()
|> build_panel_tag()
|> build_nodeinfo_tag()
+ |> build_fe_config_tag()
end
defp build_info_tag(acc) do
@@ -47,4 +50,10 @@ defp build_nodeinfo_tag(acc) do
Map.put(acc, @nodeinfo_url, nodeinfo_data)
end
end
+
+ defp build_fe_config_tag(acc) do
+ fe_data = UtilView.render("frontend_configurations.json", %{})
+
+ Map.put(acc, @fe_config_url, fe_data)
+ end
end
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/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/parser/ttl.ex b/lib/pleroma/web/rich_media/parser/ttl.ex
new file mode 100644
index 000000000..8353f0fff
--- /dev/null
+++ b/lib/pleroma/web/rich_media/parser/ttl.ex
@@ -0,0 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Web.RichMedia.Parser.TTL do
+ @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 87%
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 c5aaea2d4..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
@@ -1,7 +1,11 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
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/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/rich_media/parsers/ttl/ttl.ex b/lib/pleroma/web/rich_media/parsers/ttl/ttl.ex
deleted file mode 100644
index 6b3ec6d30..000000000
--- a/lib/pleroma/web/rich_media/parsers/ttl/ttl.ex
+++ /dev/null
@@ -1,3 +0,0 @@
-defmodule Pleroma.Web.RichMedia.Parser.TTL do
- @callback ttl(Map.t(), String.t()) :: {:ok, Integer.t()} | {:error, String.t()}
-end
diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex
index ad7e315c7..1126536a3 100644
--- a/lib/pleroma/web/router.ex
+++ b/lib/pleroma/web/router.ex
@@ -12,31 +12,31 @@ defmodule Pleroma.Web.Router do
pipeline :oauth do
plug(:fetch_session)
- plug(Pleroma.Plugs.OAuthPlug)
- plug(Pleroma.Plugs.UserEnabledPlug)
+ plug(Pleroma.Web.Plugs.OAuthPlug)
+ plug(Pleroma.Web.Plugs.UserEnabledPlug)
end
pipeline :expect_authentication do
- plug(Pleroma.Plugs.ExpectAuthenticatedCheckPlug)
+ plug(Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug)
end
pipeline :expect_public_instance_or_authentication do
- plug(Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug)
+ plug(Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug)
end
pipeline :authenticate do
- plug(Pleroma.Plugs.OAuthPlug)
- plug(Pleroma.Plugs.BasicAuthDecoderPlug)
- plug(Pleroma.Plugs.UserFetcherPlug)
- plug(Pleroma.Plugs.SessionAuthenticationPlug)
- plug(Pleroma.Plugs.LegacyAuthenticationPlug)
- plug(Pleroma.Plugs.AuthenticationPlug)
+ plug(Pleroma.Web.Plugs.OAuthPlug)
+ plug(Pleroma.Web.Plugs.BasicAuthDecoderPlug)
+ plug(Pleroma.Web.Plugs.UserFetcherPlug)
+ plug(Pleroma.Web.Plugs.SessionAuthenticationPlug)
+ plug(Pleroma.Web.Plugs.LegacyAuthenticationPlug)
+ plug(Pleroma.Web.Plugs.AuthenticationPlug)
end
pipeline :after_auth do
- plug(Pleroma.Plugs.UserEnabledPlug)
- plug(Pleroma.Plugs.SetUserSessionIdPlug)
- plug(Pleroma.Plugs.EnsureUserKeyPlug)
+ plug(Pleroma.Web.Plugs.UserEnabledPlug)
+ plug(Pleroma.Web.Plugs.SetUserSessionIdPlug)
+ plug(Pleroma.Web.Plugs.EnsureUserKeyPlug)
end
pipeline :base_api do
@@ -50,25 +50,25 @@ 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
plug(:expect_authentication)
plug(:base_api)
plug(:after_auth)
- plug(Pleroma.Plugs.EnsureAuthenticatedPlug)
- plug(Pleroma.Plugs.IdempotencyPlug)
+ plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug)
+ plug(Pleroma.Web.Plugs.IdempotencyPlug)
end
pipeline :admin_api do
plug(:expect_authentication)
plug(:base_api)
- plug(Pleroma.Plugs.AdminSecretAuthenticationPlug)
+ plug(Pleroma.Web.Plugs.AdminSecretAuthenticationPlug)
plug(:after_auth)
- plug(Pleroma.Plugs.EnsureAuthenticatedPlug)
- plug(Pleroma.Plugs.UserIsAdminPlug)
- plug(Pleroma.Plugs.IdempotencyPlug)
+ plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug)
+ plug(Pleroma.Web.Plugs.UserIsAdminPlug)
+ plug(Pleroma.Web.Plugs.IdempotencyPlug)
end
pipeline :mastodon_html 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
@@ -573,7 +573,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
@@ -742,7 +742,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/lib/pleroma/web/static_fe/static_fe_controller.ex b/lib/pleroma/web/static_fe/static_fe_controller.ex
index a7a891b13..687b17df6 100644
--- a/lib/pleroma/web/static_fe/static_fe_controller.ex
+++ b/lib/pleroma/web/static_fe/static_fe_controller.ex
@@ -17,8 +17,8 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
plug(:put_view, Pleroma.Web.StaticFE.StaticFEView)
plug(:assign_id)
- plug(Pleroma.Plugs.EnsureAuthenticatedPlug,
- unless_func: &Pleroma.Web.FederatingPlug.federating?/1
+ plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug,
+ unless_func: &Pleroma.Web.Plugs.FederatingPlug.federating?/1
)
@page_keys ["max_id", "min_id", "limit", "since_id", "order"]
diff --git a/lib/pleroma/web/streamer/streamer.ex b/lib/pleroma/web/streamer.ex
similarity index 99%
rename from lib/pleroma/web/streamer/streamer.ex
rename to lib/pleroma/web/streamer.ex
index 5475f18a6..d618dfe54 100644
--- a/lib/pleroma/web/streamer/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/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/controller.ex
similarity index 96%
rename from lib/pleroma/web/twitter_api/twitter_api_controller.ex
rename to lib/pleroma/web/twitter_api/controller.ex
index c2de26b0b..f42dba442 100644
--- a/lib/pleroma/web/twitter_api/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.Plugs.EnsurePublicOrAuthenticatedPlug
- alias Pleroma.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/remote_follow_controller.ex b/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex
index 072d889e2..4480a4922 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
@@ -18,11 +17,11 @@ 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(
- 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 70b0fbd54..9ead0d626 100644
--- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex
+++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex
@@ -11,12 +11,12 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
alias Pleroma.Emoji
alias Pleroma.Healthcheck
alias Pleroma.Notification
- alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.User
alias Pleroma.Web.CommonAPI
+ alias Pleroma.Web.Plugs.OAuthScopesPlug
alias Pleroma.Web.WebFinger
- plug(Pleroma.Web.FederatingPlug when action == :remote_subscribe)
+ plug(Pleroma.Web.Plugs.FederatingPlug when action == :remote_subscribe)
plug(
OAuthScopesPlug,
@@ -74,11 +74,7 @@ def notifications_read(%{assigns: %{user: user}} = conn, %{"id" => notification_
end
def frontend_configurations(conn, _params) do
- config =
- Config.get(:frontend_configurations, %{})
- |> Enum.into(%{})
-
- json(conn, config)
+ render(conn, "frontend_configurations.json")
end
def emoji(conn, _params) do
diff --git a/lib/pleroma/web/twitter_api/views/util_view.ex b/lib/pleroma/web/twitter_api/views/util_view.ex
index d3bdb4f62..98eea1d18 100644
--- a/lib/pleroma/web/twitter_api/views/util_view.ex
+++ b/lib/pleroma/web/twitter_api/views/util_view.ex
@@ -5,6 +5,7 @@
defmodule Pleroma.Web.TwitterAPI.UtilView do
use Pleroma.Web, :view
import Phoenix.HTML.Form
+ alias Pleroma.Config
alias Pleroma.Web
def status_net_config(instance) do
@@ -19,4 +20,9 @@ def status_net_config(instance) do
"""
end
+
+ def render("frontend_configurations.json", _) do
+ Config.get(:frontend_configurations, %{})
+ |> Enum.into(%{})
+ end
end
diff --git a/lib/pleroma/web/views/email_view.ex b/lib/pleroma/web/views/email_view.ex
index 6b0fbe61e..bcdee6571 100644
--- a/lib/pleroma/web/views/email_view.ex
+++ b/lib/pleroma/web/views/email_view.ex
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.EmailView do
use Pleroma.Web, :view
import Phoenix.HTML
diff --git a/lib/pleroma/web/views/mailer/subscription_view.ex b/lib/pleroma/web/views/mailer/subscription_view.ex
index fc3d20816..4562a9d6c 100644
--- a/lib/pleroma/web/views/mailer/subscription_view.ex
+++ b/lib/pleroma/web/views/mailer/subscription_view.ex
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.Mailer.SubscriptionView do
use Pleroma.Web, :view
end
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/web_finger/web_finger_controller.ex b/lib/pleroma/web/web_finger/web_finger_controller.ex
index 7077b20d2..9f0938fc0 100644
--- a/lib/pleroma/web/web_finger/web_finger_controller.ex
+++ b/lib/pleroma/web/web_finger/web_finger_controller.ex
@@ -7,8 +7,8 @@ defmodule Pleroma.Web.WebFinger.WebFingerController do
alias Pleroma.Web.WebFinger
- plug(Pleroma.Plugs.SetFormatPlug)
- plug(Pleroma.Web.FederatingPlug)
+ plug(Pleroma.Web.Plugs.SetFormatPlug)
+ plug(Pleroma.Web.Plugs.FederatingPlug)
def host_meta(conn, _params) do
xml = WebFinger.host_meta()
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
diff --git a/mix.exs b/mix.exs
index b9ce8c500..427329d38 100644
--- a/mix.exs
+++ b/mix.exs
@@ -188,6 +188,8 @@ defp deps do
git: "https://git.pleroma.social/pleroma/elixir-libraries/elixir-captcha.git",
ref: "e0f16822d578866e186a0974d65ad58cddc1e2ab"},
{:restarter, path: "./restarter"},
+ {:majic,
+ git: "https://git.pleroma.social/pleroma/elixir-libraries/majic", branch: "develop"},
{:open_api_spex,
git: "https://git.pleroma.social/pleroma/elixir-libraries/open_api_spex.git",
ref: "f296ac0924ba3cf79c7a588c4c252889df4c2edd"},
diff --git a/mix.lock b/mix.lock
index 2603f70c0..1f2885440 100644
--- a/mix.lock
+++ b/mix.lock
@@ -32,7 +32,7 @@
"ecto_enum": {:hex, :ecto_enum, "1.4.0", "d14b00e04b974afc69c251632d1e49594d899067ee2b376277efd8233027aec8", [:mix], [{:ecto, ">= 3.0.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "> 3.0.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:mariaex, ">= 0.0.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "8fb55c087181c2b15eee406519dc22578fa60dd82c088be376d0010172764ee4"},
"ecto_sql": {:hex, :ecto_sql, "3.4.5", "30161f81b167d561a9a2df4329c10ae05ff36eca7ccc84628f2c8b9fa1e43323", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.4.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.0", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "31990c6a3579b36a3c0841d34a94c275e727de8b84f58509da5f1b2032c98ac2"},
"eimp": {:hex, :eimp, "1.0.14", "fc297f0c7e2700457a95a60c7010a5f1dcb768a083b6d53f49cd94ab95a28f22", [:rebar3], [{:p1_utils, "1.0.18", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "501133f3112079b92d9e22da8b88bf4f0e13d4d67ae9c15c42c30bd25ceb83b6"},
- "elixir_make": {:hex, :elixir_make, "0.6.0", "38349f3e29aff4864352084fc736fa7fa0f2995a819a737554f7ebd28b85aaab", [:mix], [], "hexpm", "d522695b93b7f0b4c0fcb2dfe73a6b905b1c301226a5a55cb42e5b14d509e050"},
+ "elixir_make": {:hex, :elixir_make, "0.6.1", "8faa29a5597faba999aeeb72bbb9c91694ef8068f0131192fb199f98d32994ef", [:mix], [], "hexpm", "35d33270680f8d839a4003c3e9f43afb595310a592405a00afc12de4c7f55a18"},
"esshd": {:hex, :esshd, "0.1.1", "d4dd4c46698093a40a56afecce8a46e246eb35463c457c246dacba2e056f31b5", [:mix], [], "hexpm", "d73e341e3009d390aa36387dc8862860bf9f874c94d9fd92ade2926376f49981"},
"eternal": {:hex, :eternal, "1.2.1", "d5b6b2499ba876c57be2581b5b999ee9bdf861c647401066d3eeed111d096bc4", [:mix], [], "hexpm", "b14f1dc204321429479c569cfbe8fb287541184ed040956c8862cb7a677b8406"},
"ex2ms": {:hex, :ex2ms, "1.5.0", "19e27f9212be9a96093fed8cdfbef0a2b56c21237196d26760f11dfcfae58e97", [:mix], [], "hexpm"},
@@ -65,6 +65,7 @@
"jumper": {:hex, :jumper, "1.0.1", "3c00542ef1a83532b72269fab9f0f0c82bf23a35e27d278bfd9ed0865cecabff", [:mix], [], "hexpm", "318c59078ac220e966d27af3646026db9b5a5e6703cb2aa3e26bcfaba65b7433"},
"libring": {:hex, :libring, "1.4.0", "41246ba2f3fbc76b3971f6bce83119dfec1eee17e977a48d8a9cfaaf58c2a8d6", [:mix], [], "hexpm"},
"linkify": {:hex, :linkify, "0.2.0", "2518bbbea21d2caa9d372424e1ad845b640c6630e2d016f1bd1f518f9ebcca28", [:mix], [], "hexpm", "b8ca8a68b79e30b7938d6c996085f3db14939f29538a59ca5101988bb7f917f6"},
+ "majic": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/majic", "4c692e544b28d1f5e543fb8a44be090f8cd96f80", [branch: "develop"]},
"makeup": {:hex, :makeup, "1.0.3", "e339e2f766d12e7260e6672dd4047405963c5ec99661abdc432e6ec67d29ef95", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "2e9b4996d11832947731f7608fed7ad2f9443011b3b479ae288011265cdd3dad"},
"makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"},
"meck": {:hex, :meck, "0.8.13", "ffedb39f99b0b99703b8601c6f17c7f76313ee12de6b646e671e3188401f7866", [:rebar3], [], "hexpm", "d34f013c156db51ad57cc556891b9720e6a1c1df5fe2e15af999c84d6cebeb1a"},
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
diff --git a/priv/repo/migrations/20201013141127_refactor_locked_user_field.exs b/priv/repo/migrations/20201013141127_refactor_locked_user_field.exs
new file mode 100644
index 000000000..6cd23dbac
--- /dev/null
+++ b/priv/repo/migrations/20201013141127_refactor_locked_user_field.exs
@@ -0,0 +1,15 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.RefactorLockedUserField do
+ use Ecto.Migration
+
+ def up do
+ execute("ALTER TABLE users RENAME COLUMN locked TO is_locked;")
+ end
+
+ def down do
+ execute("ALTER TABLE users RENAME COLUMN is_locked TO locked;")
+ end
+end
diff --git a/priv/static/adminfe/app.07a1f8db.css b/priv/static/adminfe/app.6fb984d1.css
similarity index 55%
rename from priv/static/adminfe/app.07a1f8db.css
rename to priv/static/adminfe/app.6fb984d1.css
index 9d74d13dc..f1c191c2e 100644
Binary files a/priv/static/adminfe/app.07a1f8db.css and b/priv/static/adminfe/app.6fb984d1.css differ
diff --git a/priv/static/adminfe/chunk-0171.aa11eafe.css b/priv/static/adminfe/chunk-0171.aa11eafe.css
deleted file mode 100644
index 45340d06b..000000000
Binary files a/priv/static/adminfe/chunk-0171.aa11eafe.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-03c5.f59788cf.css b/priv/static/adminfe/chunk-03c5.f59788cf.css
new file mode 100644
index 000000000..863f6f4f4
Binary files /dev/null and b/priv/static/adminfe/chunk-03c5.f59788cf.css differ
diff --git a/priv/static/adminfe/chunk-0598.d8f2b478.css b/priv/static/adminfe/chunk-0598.d8f2b478.css
deleted file mode 100644
index 9b84800d0..000000000
Binary files a/priv/static/adminfe/chunk-0598.d8f2b478.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-0f09.66ca2a61.css b/priv/static/adminfe/chunk-0f09.66ca2a61.css
deleted file mode 100644
index b580e0699..000000000
Binary files a/priv/static/adminfe/chunk-0f09.66ca2a61.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-176e.b7aa5351.css b/priv/static/adminfe/chunk-176e.a3c8376d.css
similarity index 100%
rename from priv/static/adminfe/chunk-176e.b7aa5351.css
rename to priv/static/adminfe/chunk-176e.a3c8376d.css
diff --git a/priv/static/adminfe/chunk-19e2.934ad654.css b/priv/static/adminfe/chunk-19e2.934ad654.css
deleted file mode 100644
index 4fd86df25..000000000
Binary files a/priv/static/adminfe/chunk-19e2.934ad654.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-28f8.0aae6427.css b/priv/static/adminfe/chunk-28f8.0aae6427.css
deleted file mode 100644
index e811b3260..000000000
Binary files a/priv/static/adminfe/chunk-28f8.0aae6427.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-2d97.82cbb623.css b/priv/static/adminfe/chunk-2d97.82cbb623.css
deleted file mode 100644
index f6e28e1fb..000000000
Binary files a/priv/static/adminfe/chunk-2d97.82cbb623.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-3221.0ef79c67.css b/priv/static/adminfe/chunk-3221.0ef79c67.css
deleted file mode 100644
index bd64e939a..000000000
Binary files a/priv/static/adminfe/chunk-3221.0ef79c67.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-3365.201aa8e6.css b/priv/static/adminfe/chunk-3365.201aa8e6.css
new file mode 100644
index 000000000..e5024d666
Binary files /dev/null and b/priv/static/adminfe/chunk-3365.201aa8e6.css differ
diff --git a/priv/static/adminfe/chunk-342d.e342722b.css b/priv/static/adminfe/chunk-342d.e342722b.css
new file mode 100644
index 000000000..b0fd8dcb3
Binary files /dev/null and b/priv/static/adminfe/chunk-342d.e342722b.css differ
diff --git a/priv/static/adminfe/chunk-39ad.ba67c97f.css b/priv/static/adminfe/chunk-39ad.ba67c97f.css
deleted file mode 100644
index 778a932cf..000000000
Binary files a/priv/static/adminfe/chunk-39ad.ba67c97f.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-3ba2.63b1228d.css b/priv/static/adminfe/chunk-3ba2.63b1228d.css
deleted file mode 100644
index b375f08d5..000000000
Binary files a/priv/static/adminfe/chunk-3ba2.63b1228d.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-4eb4.b72d16c3.css b/priv/static/adminfe/chunk-4eb4.b72d16c3.css
deleted file mode 100644
index 1ecdec162..000000000
Binary files a/priv/static/adminfe/chunk-4eb4.b72d16c3.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-521f.b745ee5d.css b/priv/static/adminfe/chunk-521f.b745ee5d.css
new file mode 100644
index 000000000..7e8ffb651
Binary files /dev/null and b/priv/static/adminfe/chunk-521f.b745ee5d.css differ
diff --git a/priv/static/adminfe/chunk-546f.692d1ab2.css b/priv/static/adminfe/chunk-546f.692d1ab2.css
new file mode 100644
index 000000000..5fcb223d8
Binary files /dev/null and b/priv/static/adminfe/chunk-546f.692d1ab2.css differ
diff --git a/priv/static/adminfe/chunk-565e.8c036a6e.css b/priv/static/adminfe/chunk-565e.8c036a6e.css
deleted file mode 100644
index c126f246e..000000000
Binary files a/priv/static/adminfe/chunk-565e.8c036a6e.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-60a9.7b5b9559.css b/priv/static/adminfe/chunk-60a9.7b5b9559.css
deleted file mode 100644
index d45d79f4c..000000000
Binary files a/priv/static/adminfe/chunk-60a9.7b5b9559.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-654e.b2e16b59.css b/priv/static/adminfe/chunk-654d.94689c39.css
similarity index 100%
rename from priv/static/adminfe/chunk-654e.b2e16b59.css
rename to priv/static/adminfe/chunk-654d.94689c39.css
diff --git a/priv/static/adminfe/chunk-68ea.81e11186.css b/priv/static/adminfe/chunk-68ea.81e11186.css
deleted file mode 100644
index 30bf7de23..000000000
Binary files a/priv/static/adminfe/chunk-68ea.81e11186.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-68ea.7633295f.css b/priv/static/adminfe/chunk-68ea9.dac85813.css
similarity index 100%
rename from priv/static/adminfe/chunk-68ea.7633295f.css
rename to priv/static/adminfe/chunk-68ea9.dac85813.css
diff --git a/priv/static/adminfe/chunk-6e81.0e9e6d27.css b/priv/static/adminfe/chunk-6e81.1c0f2da2.css
similarity index 100%
rename from priv/static/adminfe/chunk-6e81.0e9e6d27.css
rename to priv/static/adminfe/chunk-6e81.1c0f2da2.css
diff --git a/priv/static/adminfe/chunk-6e81.7e5babfc.css b/priv/static/adminfe/chunk-6e81.7e5babfc.css
deleted file mode 100644
index da819ca09..000000000
Binary files a/priv/static/adminfe/chunk-6e81.7e5babfc.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-6e8c.ef26acfd.css b/priv/static/adminfe/chunk-6e8c.ef26acfd.css
deleted file mode 100644
index 76f698880..000000000
Binary files a/priv/static/adminfe/chunk-6e8c.ef26acfd.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-7503.cc089ee4.css b/priv/static/adminfe/chunk-7503.cc089ee4.css
deleted file mode 100644
index cc1e824b8..000000000
Binary files a/priv/static/adminfe/chunk-7503.cc089ee4.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-0778.29be65e2.css b/priv/static/adminfe/chunk-7c6b.365cbeda.css
similarity index 100%
rename from priv/static/adminfe/chunk-0778.29be65e2.css
rename to priv/static/adminfe/chunk-7c6b.365cbeda.css
diff --git a/priv/static/adminfe/chunk-7c6b.b529c720.css b/priv/static/adminfe/chunk-7c6b.b529c720.css
deleted file mode 100644
index 9d730019a..000000000
Binary files a/priv/static/adminfe/chunk-7c6b.b529c720.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-40a4.665332db.css b/priv/static/adminfe/chunk-850d.cc4f0ac6.css
similarity index 84%
rename from priv/static/adminfe/chunk-40a4.665332db.css
rename to priv/static/adminfe/chunk-850d.cc4f0ac6.css
index 83fefcb55..1cb2ead63 100644
Binary files a/priv/static/adminfe/chunk-40a4.665332db.css and b/priv/static/adminfe/chunk-850d.cc4f0ac6.css differ
diff --git a/priv/static/adminfe/chunk-9043.3f527a93.css b/priv/static/adminfe/chunk-9043.3f527a93.css
deleted file mode 100644
index d3b7604aa..000000000
Binary files a/priv/static/adminfe/chunk-9043.3f527a93.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-97e2.9f9fab0f.css b/priv/static/adminfe/chunk-97e2.9f9fab0f.css
deleted file mode 100644
index d3b7604aa..000000000
Binary files a/priv/static/adminfe/chunk-97e2.9f9fab0f.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-9a72.786caeb3.css b/priv/static/adminfe/chunk-9a72.786caeb3.css
deleted file mode 100644
index c0074e6f7..000000000
Binary files a/priv/static/adminfe/chunk-9a72.786caeb3.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-9d55.e2cb1409.css b/priv/static/adminfe/chunk-9d55.e2cb1409.css
new file mode 100644
index 000000000..13537842a
Binary files /dev/null and b/priv/static/adminfe/chunk-9d55.e2cb1409.css differ
diff --git a/priv/static/adminfe/chunk-commons.a343b725.css b/priv/static/adminfe/chunk-commons.c0eb3eb7.css
similarity index 100%
rename from priv/static/adminfe/chunk-commons.a343b725.css
rename to priv/static/adminfe/chunk-commons.c0eb3eb7.css
diff --git a/priv/static/adminfe/chunk-6198.3c37d6af.css b/priv/static/adminfe/chunk-d34d.b0dd6fb4.css
similarity index 100%
rename from priv/static/adminfe/chunk-6198.3c37d6af.css
rename to priv/static/adminfe/chunk-d34d.b0dd6fb4.css
diff --git a/priv/static/adminfe/chunk-d892.56863b19.css b/priv/static/adminfe/chunk-d892.56863b19.css
deleted file mode 100644
index 483d88545..000000000
Binary files a/priv/static/adminfe/chunk-d892.56863b19.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-elementUI.40545a1f.css b/priv/static/adminfe/chunk-elementUI.40545a1f.css
deleted file mode 100644
index c802d3a40..000000000
Binary files a/priv/static/adminfe/chunk-elementUI.40545a1f.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-elementUI.f77689d7.css b/priv/static/adminfe/chunk-elementUI.f77689d7.css
new file mode 100644
index 000000000..01bdb7fd5
Binary files /dev/null and b/priv/static/adminfe/chunk-elementUI.f77689d7.css differ
diff --git a/priv/static/adminfe/chunk-f625.25a6a4ae.css b/priv/static/adminfe/chunk-f625.25a6a4ae.css
new file mode 100644
index 000000000..ac26ef0f5
Binary files /dev/null and b/priv/static/adminfe/chunk-f625.25a6a4ae.css differ
diff --git a/priv/static/adminfe/chunk-libs.0380664d.css b/priv/static/adminfe/chunk-libs.5cf7f50a.css
similarity index 100%
rename from priv/static/adminfe/chunk-libs.0380664d.css
rename to priv/static/adminfe/chunk-libs.5cf7f50a.css
diff --git a/priv/static/adminfe/index.html b/priv/static/adminfe/index.html
index 0500424b6..d6b9b22b8 100644
--- a/priv/static/adminfe/index.html
+++ b/priv/static/adminfe/index.html
@@ -1 +1 @@
-Admin FE
\ No newline at end of file
+Admin FE
\ No newline at end of file
diff --git a/priv/static/adminfe/static/js/app.1df22cde.js b/priv/static/adminfe/static/js/app.1df22cde.js
deleted file mode 100644
index 00a5fbcd3..000000000
Binary files a/priv/static/adminfe/static/js/app.1df22cde.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/app.1df22cde.js.map b/priv/static/adminfe/static/js/app.1df22cde.js.map
deleted file mode 100644
index 4f6ad8e95..000000000
Binary files a/priv/static/adminfe/static/js/app.1df22cde.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/app.69891fda.js b/priv/static/adminfe/static/js/app.69891fda.js
new file mode 100644
index 000000000..3d04d9273
Binary files /dev/null and b/priv/static/adminfe/static/js/app.69891fda.js differ
diff --git a/priv/static/adminfe/static/js/app.69891fda.js.map b/priv/static/adminfe/static/js/app.69891fda.js.map
new file mode 100644
index 000000000..0131793e9
Binary files /dev/null and b/priv/static/adminfe/static/js/app.69891fda.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-0171.9e927b8a.js b/priv/static/adminfe/static/js/chunk-0171.9e927b8a.js
deleted file mode 100644
index f20f619ad..000000000
Binary files a/priv/static/adminfe/static/js/chunk-0171.9e927b8a.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-0171.9e927b8a.js.map b/priv/static/adminfe/static/js/chunk-0171.9e927b8a.js.map
deleted file mode 100644
index 4f2d63f3e..000000000
Binary files a/priv/static/adminfe/static/js/chunk-0171.9e927b8a.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-03c5.1c694c49.js b/priv/static/adminfe/static/js/chunk-03c5.1c694c49.js
new file mode 100644
index 000000000..b4601abae
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-03c5.1c694c49.js differ
diff --git a/priv/static/adminfe/static/js/chunk-03c5.1c694c49.js.map b/priv/static/adminfe/static/js/chunk-03c5.1c694c49.js.map
new file mode 100644
index 000000000..193c65bb1
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-03c5.1c694c49.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-16d0.6ce78978.js b/priv/static/adminfe/static/js/chunk-16d0.6ce78978.js
deleted file mode 100644
index 497bbcb88..000000000
Binary files a/priv/static/adminfe/static/js/chunk-16d0.6ce78978.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-16d0.6ce78978.js.map b/priv/static/adminfe/static/js/chunk-16d0.6ce78978.js.map
deleted file mode 100644
index 17c3378e3..000000000
Binary files a/priv/static/adminfe/static/js/chunk-16d0.6ce78978.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-16d0.fef0ce65.js b/priv/static/adminfe/static/js/chunk-16d0.fef0ce65.js
new file mode 100644
index 000000000..8bddbe967
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-16d0.fef0ce65.js differ
diff --git a/priv/static/adminfe/static/js/chunk-16d0.fef0ce65.js.map b/priv/static/adminfe/static/js/chunk-16d0.fef0ce65.js.map
new file mode 100644
index 000000000..9617ae0d0
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-16d0.fef0ce65.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-176e.5c19378d.js.map b/priv/static/adminfe/static/js/chunk-176e.5c19378d.js.map
deleted file mode 100644
index fa116fb3b..000000000
Binary files a/priv/static/adminfe/static/js/chunk-176e.5c19378d.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-176e.5c19378d.js b/priv/static/adminfe/static/js/chunk-176e.be050aba.js
similarity index 59%
rename from priv/static/adminfe/static/js/chunk-176e.5c19378d.js
rename to priv/static/adminfe/static/js/chunk-176e.be050aba.js
index 65269ccf1..cab83489b 100644
Binary files a/priv/static/adminfe/static/js/chunk-176e.5c19378d.js and b/priv/static/adminfe/static/js/chunk-176e.be050aba.js differ
diff --git a/priv/static/adminfe/static/js/chunk-176e.be050aba.js.map b/priv/static/adminfe/static/js/chunk-176e.be050aba.js.map
new file mode 100644
index 000000000..bff959cd6
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-176e.be050aba.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-2d97.079e9e64.js b/priv/static/adminfe/static/js/chunk-2d97.079e9e64.js
deleted file mode 100644
index 90399920a..000000000
Binary files a/priv/static/adminfe/static/js/chunk-2d97.079e9e64.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-2d97.079e9e64.js.map b/priv/static/adminfe/static/js/chunk-2d97.079e9e64.js.map
deleted file mode 100644
index 5e3e417cd..000000000
Binary files a/priv/static/adminfe/static/js/chunk-2d97.079e9e64.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-3365.b73c30a8.js b/priv/static/adminfe/static/js/chunk-3365.b73c30a8.js
new file mode 100644
index 000000000..421bf2a99
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-3365.b73c30a8.js differ
diff --git a/priv/static/adminfe/static/js/chunk-3365.b73c30a8.js.map b/priv/static/adminfe/static/js/chunk-3365.b73c30a8.js.map
new file mode 100644
index 000000000..d2ad4d9aa
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-3365.b73c30a8.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-342d.479e01dd.js b/priv/static/adminfe/static/js/chunk-342d.479e01dd.js
new file mode 100644
index 000000000..5ee311c4a
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-342d.479e01dd.js differ
diff --git a/priv/static/adminfe/static/js/chunk-342d.479e01dd.js.map b/priv/static/adminfe/static/js/chunk-342d.479e01dd.js.map
new file mode 100644
index 000000000..b73bbb0aa
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-342d.479e01dd.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-40a4.5dc0e299.js b/priv/static/adminfe/static/js/chunk-40a4.5dc0e299.js
deleted file mode 100644
index ee0e267db..000000000
Binary files a/priv/static/adminfe/static/js/chunk-40a4.5dc0e299.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-40a4.5dc0e299.js.map b/priv/static/adminfe/static/js/chunk-40a4.5dc0e299.js.map
deleted file mode 100644
index 61c30c39b..000000000
Binary files a/priv/static/adminfe/static/js/chunk-40a4.5dc0e299.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-5118.7c48ad58.js b/priv/static/adminfe/static/js/chunk-5118.7c48ad58.js
deleted file mode 100644
index 2357e225d..000000000
Binary files a/priv/static/adminfe/static/js/chunk-5118.7c48ad58.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-5118.7c48ad58.js.map b/priv/static/adminfe/static/js/chunk-5118.7c48ad58.js.map
deleted file mode 100644
index c29b4b170..000000000
Binary files a/priv/static/adminfe/static/js/chunk-5118.7c48ad58.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-521f.748b331d.js b/priv/static/adminfe/static/js/chunk-521f.748b331d.js
new file mode 100644
index 000000000..570dab224
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-521f.748b331d.js differ
diff --git a/priv/static/adminfe/static/js/chunk-521f.748b331d.js.map b/priv/static/adminfe/static/js/chunk-521f.748b331d.js.map
new file mode 100644
index 000000000..3380bbbd5
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-521f.748b331d.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-546f.81668ba7.js b/priv/static/adminfe/static/js/chunk-546f.81668ba7.js
new file mode 100644
index 000000000..252991021
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-546f.81668ba7.js differ
diff --git a/priv/static/adminfe/static/js/chunk-546f.81668ba7.js.map b/priv/static/adminfe/static/js/chunk-546f.81668ba7.js.map
new file mode 100644
index 000000000..6a9d2a8dc
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-546f.81668ba7.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-565e.e1555105.js b/priv/static/adminfe/static/js/chunk-565e.e1555105.js
deleted file mode 100644
index 638c78b38..000000000
Binary files a/priv/static/adminfe/static/js/chunk-565e.e1555105.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-565e.e1555105.js.map b/priv/static/adminfe/static/js/chunk-565e.e1555105.js.map
deleted file mode 100644
index 1cfc4cdfa..000000000
Binary files a/priv/static/adminfe/static/js/chunk-565e.e1555105.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-60a9.22fe45f3.js b/priv/static/adminfe/static/js/chunk-60a9.22fe45f3.js
deleted file mode 100644
index a23d46b72..000000000
Binary files a/priv/static/adminfe/static/js/chunk-60a9.22fe45f3.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-60a9.22fe45f3.js.map b/priv/static/adminfe/static/js/chunk-60a9.22fe45f3.js.map
deleted file mode 100644
index 690979713..000000000
Binary files a/priv/static/adminfe/static/js/chunk-60a9.22fe45f3.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-654e.38dd4b85.js b/priv/static/adminfe/static/js/chunk-654d.653b067f.js
similarity index 58%
rename from priv/static/adminfe/static/js/chunk-654e.38dd4b85.js
rename to priv/static/adminfe/static/js/chunk-654d.653b067f.js
index eecdac498..209873ec1 100644
Binary files a/priv/static/adminfe/static/js/chunk-654e.38dd4b85.js and b/priv/static/adminfe/static/js/chunk-654d.653b067f.js differ
diff --git a/priv/static/adminfe/static/js/chunk-654d.653b067f.js.map b/priv/static/adminfe/static/js/chunk-654d.653b067f.js.map
new file mode 100644
index 000000000..72aca0e98
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-654d.653b067f.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-654e.38dd4b85.js.map b/priv/static/adminfe/static/js/chunk-654e.38dd4b85.js.map
deleted file mode 100644
index 4fc105fb7..000000000
Binary files a/priv/static/adminfe/static/js/chunk-654e.38dd4b85.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-68ea.0dae7e55.js b/priv/static/adminfe/static/js/chunk-68ea.0dae7e55.js
deleted file mode 100644
index dc31a8bb0..000000000
Binary files a/priv/static/adminfe/static/js/chunk-68ea.0dae7e55.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-68ea.0dae7e55.js.map b/priv/static/adminfe/static/js/chunk-68ea.0dae7e55.js.map
deleted file mode 100644
index 6c87803a8..000000000
Binary files a/priv/static/adminfe/static/js/chunk-68ea.0dae7e55.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-68ea.6d56674a.js b/priv/static/adminfe/static/js/chunk-68ea.6d56674a.js
new file mode 100644
index 000000000..1f43a39db
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-68ea.6d56674a.js differ
diff --git a/priv/static/adminfe/static/js/chunk-68ea.6d56674a.js.map b/priv/static/adminfe/static/js/chunk-68ea.6d56674a.js.map
new file mode 100644
index 000000000..45000a1b0
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-68ea.6d56674a.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-68ea9.9821cd6a.js b/priv/static/adminfe/static/js/chunk-68ea9.9821cd6a.js
new file mode 100644
index 000000000..02091ed84
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-68ea9.9821cd6a.js differ
diff --git a/priv/static/adminfe/static/js/chunk-68ea9.9821cd6a.js.map b/priv/static/adminfe/static/js/chunk-68ea9.9821cd6a.js.map
new file mode 100644
index 000000000..019cede66
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-68ea9.9821cd6a.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-6e81.6043af74.js b/priv/static/adminfe/static/js/chunk-6e81.ebe9039f.js
similarity index 97%
rename from priv/static/adminfe/static/js/chunk-6e81.6043af74.js
rename to priv/static/adminfe/static/js/chunk-6e81.ebe9039f.js
index 82b08ad24..cd79db1d3 100644
Binary files a/priv/static/adminfe/static/js/chunk-6e81.6043af74.js and b/priv/static/adminfe/static/js/chunk-6e81.ebe9039f.js differ
diff --git a/priv/static/adminfe/static/js/chunk-6e81.6043af74.js.map b/priv/static/adminfe/static/js/chunk-6e81.ebe9039f.js.map
similarity index 98%
rename from priv/static/adminfe/static/js/chunk-6e81.6043af74.js.map
rename to priv/static/adminfe/static/js/chunk-6e81.ebe9039f.js.map
index 2c1c86e2c..10b437760 100644
Binary files a/priv/static/adminfe/static/js/chunk-6e81.6043af74.js.map and b/priv/static/adminfe/static/js/chunk-6e81.ebe9039f.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-6e8c.2aa335e0.js b/priv/static/adminfe/static/js/chunk-6e8c.2aa335e0.js
deleted file mode 100644
index 020158f81..000000000
Binary files a/priv/static/adminfe/static/js/chunk-6e8c.2aa335e0.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-6e8c.2aa335e0.js.map b/priv/static/adminfe/static/js/chunk-6e8c.2aa335e0.js.map
deleted file mode 100644
index 1e742c3f9..000000000
Binary files a/priv/static/adminfe/static/js/chunk-6e8c.2aa335e0.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-7503.278e0031.js b/priv/static/adminfe/static/js/chunk-7503.278e0031.js
deleted file mode 100644
index 3875f9ad9..000000000
Binary files a/priv/static/adminfe/static/js/chunk-7503.278e0031.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-7503.278e0031.js.map b/priv/static/adminfe/static/js/chunk-7503.278e0031.js.map
deleted file mode 100644
index 494d1a763..000000000
Binary files a/priv/static/adminfe/static/js/chunk-7503.278e0031.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-7c6b.1ebeb0e4.js b/priv/static/adminfe/static/js/chunk-7c6b.1ebeb0e4.js
deleted file mode 100644
index 63be4d84f..000000000
Binary files a/priv/static/adminfe/static/js/chunk-7c6b.1ebeb0e4.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-7c6b.1ebeb0e4.js.map b/priv/static/adminfe/static/js/chunk-7c6b.1ebeb0e4.js.map
deleted file mode 100644
index 85d8dcb1c..000000000
Binary files a/priv/static/adminfe/static/js/chunk-7c6b.1ebeb0e4.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-7c6b.56a14571.js b/priv/static/adminfe/static/js/chunk-7c6b.56a14571.js
new file mode 100644
index 000000000..df9b7d6ac
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7c6b.56a14571.js differ
diff --git a/priv/static/adminfe/static/js/chunk-7c6b.56a14571.js.map b/priv/static/adminfe/static/js/chunk-7c6b.56a14571.js.map
new file mode 100644
index 000000000..6584ba082
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7c6b.56a14571.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-850d.3e6102c2.js b/priv/static/adminfe/static/js/chunk-850d.3e6102c2.js
new file mode 100644
index 000000000..a2c2df2e7
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-850d.3e6102c2.js differ
diff --git a/priv/static/adminfe/static/js/chunk-850d.3e6102c2.js.map b/priv/static/adminfe/static/js/chunk-850d.3e6102c2.js.map
new file mode 100644
index 000000000..7f7718547
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-850d.3e6102c2.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-97e2.c51fe6b0.js b/priv/static/adminfe/static/js/chunk-97e2.c51fe6b0.js
deleted file mode 100644
index a9cef7b6b..000000000
Binary files a/priv/static/adminfe/static/js/chunk-97e2.c51fe6b0.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-97e2.c51fe6b0.js.map b/priv/static/adminfe/static/js/chunk-97e2.c51fe6b0.js.map
deleted file mode 100644
index 1d489f4c2..000000000
Binary files a/priv/static/adminfe/static/js/chunk-97e2.c51fe6b0.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-9a72.41e843cd.js b/priv/static/adminfe/static/js/chunk-9a72.41e843cd.js
deleted file mode 100644
index 575a01d30..000000000
Binary files a/priv/static/adminfe/static/js/chunk-9a72.41e843cd.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-9a72.41e843cd.js.map b/priv/static/adminfe/static/js/chunk-9a72.41e843cd.js.map
deleted file mode 100644
index aede70d0a..000000000
Binary files a/priv/static/adminfe/static/js/chunk-9a72.41e843cd.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-9d55.7af22f45.js b/priv/static/adminfe/static/js/chunk-9d55.7af22f45.js
new file mode 100644
index 000000000..89d35af79
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-9d55.7af22f45.js differ
diff --git a/priv/static/adminfe/static/js/chunk-9d55.7af22f45.js.map b/priv/static/adminfe/static/js/chunk-9d55.7af22f45.js.map
new file mode 100644
index 000000000..fa8694b8e
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-9d55.7af22f45.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-commons.51fe2926.js.map b/priv/static/adminfe/static/js/chunk-commons.51fe2926.js.map
deleted file mode 100644
index 7d55c69d6..000000000
Binary files a/priv/static/adminfe/static/js/chunk-commons.51fe2926.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-commons.51fe2926.js b/priv/static/adminfe/static/js/chunk-commons.a6002038.js
similarity index 89%
rename from priv/static/adminfe/static/js/chunk-commons.51fe2926.js
rename to priv/static/adminfe/static/js/chunk-commons.a6002038.js
index 3fe10f0d3..2b16da9c7 100644
Binary files a/priv/static/adminfe/static/js/chunk-commons.51fe2926.js and b/priv/static/adminfe/static/js/chunk-commons.a6002038.js differ
diff --git a/priv/static/adminfe/static/js/chunk-commons.a6002038.js.map b/priv/static/adminfe/static/js/chunk-commons.a6002038.js.map
new file mode 100644
index 000000000..3c7d78861
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-commons.a6002038.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-d34d.0f06fe76.js b/priv/static/adminfe/static/js/chunk-d34d.0f06fe76.js
new file mode 100644
index 000000000..edd221e6e
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-d34d.0f06fe76.js differ
diff --git a/priv/static/adminfe/static/js/chunk-d34d.0f06fe76.js.map b/priv/static/adminfe/static/js/chunk-d34d.0f06fe76.js.map
new file mode 100644
index 000000000..6bcd4ed8b
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-d34d.0f06fe76.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-d55e.f9bab96d.js b/priv/static/adminfe/static/js/chunk-d55e.f9bab96d.js
new file mode 100644
index 000000000..4e7ab35bb
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-d55e.f9bab96d.js differ
diff --git a/priv/static/adminfe/static/js/chunk-d55e.f9bab96d.js.map b/priv/static/adminfe/static/js/chunk-d55e.f9bab96d.js.map
new file mode 100644
index 000000000..323d9ba2a
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-d55e.f9bab96d.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-df62.6c5105a6.js b/priv/static/adminfe/static/js/chunk-df62.6c5105a6.js
deleted file mode 100644
index c6c4b82ee..000000000
Binary files a/priv/static/adminfe/static/js/chunk-df62.6c5105a6.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-df62.6c5105a6.js.map b/priv/static/adminfe/static/js/chunk-df62.6c5105a6.js.map
deleted file mode 100644
index a2380c4cd..000000000
Binary files a/priv/static/adminfe/static/js/chunk-df62.6c5105a6.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-elementUI.21957ec8.js b/priv/static/adminfe/static/js/chunk-elementUI.21957ec8.js
new file mode 100644
index 000000000..65462dc89
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-elementUI.21957ec8.js differ
diff --git a/priv/static/adminfe/static/js/chunk-elementUI.21957ec8.js.map b/priv/static/adminfe/static/js/chunk-elementUI.21957ec8.js.map
new file mode 100644
index 000000000..3381fd56a
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-elementUI.21957ec8.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-elementUI.8e5c404c.js b/priv/static/adminfe/static/js/chunk-elementUI.8e5c404c.js
deleted file mode 100644
index e8424c9ed..000000000
Binary files a/priv/static/adminfe/static/js/chunk-elementUI.8e5c404c.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-elementUI.8e5c404c.js.map b/priv/static/adminfe/static/js/chunk-elementUI.8e5c404c.js.map
deleted file mode 100644
index a3c9be946..000000000
Binary files a/priv/static/adminfe/static/js/chunk-elementUI.8e5c404c.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-f625.29237434.js b/priv/static/adminfe/static/js/chunk-f625.29237434.js
new file mode 100644
index 000000000..522755a98
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-f625.29237434.js differ
diff --git a/priv/static/adminfe/static/js/chunk-f625.29237434.js.map b/priv/static/adminfe/static/js/chunk-f625.29237434.js.map
new file mode 100644
index 000000000..4f8774c3a
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-f625.29237434.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-libs.32ea9181.js b/priv/static/adminfe/static/js/chunk-libs.32ea9181.js
new file mode 100644
index 000000000..29cfb2b1d
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-libs.32ea9181.js differ
diff --git a/priv/static/adminfe/static/js/chunk-libs.32ea9181.js.map b/priv/static/adminfe/static/js/chunk-libs.32ea9181.js.map
new file mode 100644
index 000000000..c80cf9acc
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-libs.32ea9181.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-libs.f842b12e.js b/priv/static/adminfe/static/js/chunk-libs.f842b12e.js
deleted file mode 100644
index 2e8e0aba5..000000000
Binary files a/priv/static/adminfe/static/js/chunk-libs.f842b12e.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-libs.f842b12e.js.map b/priv/static/adminfe/static/js/chunk-libs.f842b12e.js.map
deleted file mode 100644
index de17844c9..000000000
Binary files a/priv/static/adminfe/static/js/chunk-libs.f842b12e.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/oAJy.2d5429b2.js b/priv/static/adminfe/static/js/oAJy.2d5429b2.js
new file mode 100644
index 000000000..72ef1a89b
Binary files /dev/null and b/priv/static/adminfe/static/js/oAJy.2d5429b2.js differ
diff --git a/priv/static/adminfe/static/js/oAJy.2d5429b2.js.map b/priv/static/adminfe/static/js/oAJy.2d5429b2.js.map
new file mode 100644
index 000000000..e93954508
Binary files /dev/null and b/priv/static/adminfe/static/js/oAJy.2d5429b2.js.map differ
diff --git a/priv/static/adminfe/static/js/oAJy.840fb1c2.js b/priv/static/adminfe/static/js/oAJy.840fb1c2.js
deleted file mode 100644
index 9973db60a..000000000
Binary files a/priv/static/adminfe/static/js/oAJy.840fb1c2.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/oAJy.840fb1c2.js.map b/priv/static/adminfe/static/js/oAJy.840fb1c2.js.map
deleted file mode 100644
index 48420eecd..000000000
Binary files a/priv/static/adminfe/static/js/oAJy.840fb1c2.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/runtime.04c4fa2f.js b/priv/static/adminfe/static/js/runtime.04c4fa2f.js
deleted file mode 100644
index c08585729..000000000
Binary files a/priv/static/adminfe/static/js/runtime.04c4fa2f.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/runtime.04c4fa2f.js.map b/priv/static/adminfe/static/js/runtime.04c4fa2f.js.map
deleted file mode 100644
index bf0af11e1..000000000
Binary files a/priv/static/adminfe/static/js/runtime.04c4fa2f.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/runtime.8f631d12.js b/priv/static/adminfe/static/js/runtime.8f631d12.js
new file mode 100644
index 000000000..6fa7d9ee1
Binary files /dev/null and b/priv/static/adminfe/static/js/runtime.8f631d12.js differ
diff --git a/priv/static/adminfe/static/js/runtime.8f631d12.js.map b/priv/static/adminfe/static/js/runtime.8f631d12.js.map
new file mode 100644
index 000000000..d5c20400e
Binary files /dev/null and b/priv/static/adminfe/static/js/runtime.8f631d12.js.map differ
diff --git a/priv/templates/sample_config.eex b/priv/templates/sample_config.eex
index bc7e37375..cdddc47ea 100644
--- a/priv/templates/sample_config.eex
+++ b/priv/templates/sample_config.eex
@@ -71,3 +71,7 @@ config :pleroma, Pleroma.Uploaders.Local, uploads: "<%= uploads_dir %>"
config :joken, default_signer: "<%= jwt_secret %>"
config :pleroma, configurable_from_database: <%= db_configurable? %>
+
+<%= if Kernel.length(upload_filters) > 0 do
+"config :pleroma, Pleroma.Upload, filters: #{inspect(upload_filters)}"
+end %>
diff --git a/test/credo/check/consistency/file_location.ex b/test/credo/check/consistency/file_location.ex
new file mode 100644
index 000000000..500983608
--- /dev/null
+++ b/test/credo/check/consistency/file_location.ex
@@ -0,0 +1,166 @@
+# 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
+
+ # 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]
+
+ @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
+
+ 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)
+
+ 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)
+
+ 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
diff --git a/test/fixtures/config/temp.secret.exs b/test/fixtures/config/temp.secret.exs
index fa8c7c7e8..621bc8cf6 100644
--- a/test/fixtures/config/temp.secret.exs
+++ b/test/fixtures/config/temp.secret.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
use Mix.Config
config :pleroma, :first_setting, key: "value", key2: [Pleroma.Repo]
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/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 89%
rename from test/tasks/digest_test.exs
rename to test/mix/tasks/pleroma/digest_test.exs
index 0b444c86d..69dccb745 100644
--- a/test/tasks/digest_test.exs
+++ b/test/mix/tasks/pleroma/digest_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Mix.Tasks.Pleroma.DigestTest do
use Pleroma.DataCase
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 94%
rename from test/tasks/email_test.exs
rename to test/mix/tasks/pleroma/email_test.exs
index 5393e3573..9523aefd8 100644
--- a/test/tasks/email_test.exs
+++ b/test/mix/tasks/pleroma/email_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Mix.Tasks.Pleroma.EmailTest do
use Pleroma.DataCase
diff --git a/test/tasks/emoji_test.exs b/test/mix/tasks/pleroma/emoji_test.exs
similarity index 97%
rename from test/tasks/emoji_test.exs
rename to test/mix/tasks/pleroma/emoji_test.exs
index 499f098c2..0fb8603ac 100644
--- a/test/tasks/emoji_test.exs
+++ b/test/mix/tasks/pleroma/emoji_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Mix.Tasks.Pleroma.EmojiTest do
use ExUnit.Case, async: true
diff --git a/test/tasks/frontend_test.exs b/test/mix/tasks/pleroma/frontend_test.exs
similarity index 98%
rename from test/tasks/frontend_test.exs
rename to test/mix/tasks/pleroma/frontend_test.exs
index 022ae51be..6f9ec14cd 100644
--- a/test/tasks/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/tasks/instance_test.exs b/test/mix/tasks/pleroma/instance_test.exs
similarity index 90%
rename from test/tasks/instance_test.exs
rename to test/mix/tasks/pleroma/instance_test.exs
index 3b4c041d9..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
@@ -63,7 +63,13 @@ test "running gen" do
"--uploads-dir",
"test/uploads",
"--static-dir",
- "./test/../test/instance/static/"
+ "./test/../test/instance/static/",
+ "--strip-uploads",
+ "y",
+ "--dedupe-uploads",
+ "n",
+ "--anonymize-uploads",
+ "n"
])
end
@@ -82,6 +88,7 @@ test "running gen" do
assert generated_config =~ "password: \"dbpass\""
assert generated_config =~ "configurable_from_database: true"
assert generated_config =~ "http: [ip: {127, 0, 0, 1}, port: 4000]"
+ assert generated_config =~ "filters: [Pleroma.Upload.Filter.ExifTool]"
assert File.read!(tmp_path() <> "setup.psql") == generated_setup_psql()
assert File.exists?(Path.expand("./test/instance/static/robots.txt"))
end
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 98%
rename from test/tasks/user_test.exs
rename to test/mix/tasks/pleroma/user_test.exs
index b8c423c48..ce819f815 100644
--- a/test/tasks/user_test.exs
+++ b/test/mix/tasks/pleroma/user_test.exs
@@ -248,14 +248,19 @@ test "All statuses set" do
user = User.get_cached_by_nickname(user.nickname)
assert user.is_moderator
- assert user.locked
+ assert user.is_locked
assert user.is_admin
refute user.confirmation_pending
end
test "All statuses unset" do
user =
- insert(:user, locked: true, is_moderator: true, is_admin: true, confirmation_pending: true)
+ insert(:user,
+ is_locked: true,
+ is_moderator: true,
+ is_admin: true,
+ confirmation_pending: true
+ )
Mix.Tasks.Pleroma.User.run([
"set",
@@ -280,7 +285,7 @@ test "All statuses unset" do
user = User.get_cached_by_nickname(user.nickname)
refute user.is_moderator
- refute user.locked
+ refute user.is_locked
refute user.is_admin
assert user.confirmation_pending
end
diff --git a/test/activity/ir/topics_test.exs b/test/pleroma/activity/ir/topics_test.exs
similarity index 96%
rename from test/activity/ir/topics_test.exs
rename to test/pleroma/activity/ir/topics_test.exs
index 14a6e6b71..4ddcea1ec 100644
--- a/test/activity/ir/topics_test.exs
+++ b/test/pleroma/activity/ir/topics_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Activity.Ir.TopicsTest do
use Pleroma.DataCase
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/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/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 95%
rename from test/config/deprecation_warnings_test.exs
rename to test/pleroma/config/deprecation_warnings_test.exs
index f81a7b580..0cfed4555 100644
--- a/test/config/deprecation_warnings_test.exs
+++ b/test/pleroma/config/deprecation_warnings_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Config.DeprecationWarningsTest do
use ExUnit.Case
use Pleroma.Tests.Helpers
@@ -83,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/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 97%
rename from test/docs/generator_test.exs
rename to test/pleroma/docs/generator_test.exs
index b32918a69..43877244d 100644
--- a/test/docs/generator_test.exs
+++ b/test/pleroma/docs/generator_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Docs.GeneratorTest do
use ExUnit.Case, async: true
alias Pleroma.Docs.Generator
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 76%
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 43be8e936..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
@@ -1,4 +1,8 @@
-defmodule Pleroma.Web.ActivityPub.ObjectValidators.Types.DateTimeTest do
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+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 78%
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 053916bdd..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
@@ -1,4 +1,8 @@
-defmodule Pleroma.Web.ObjectValidators.Types.RecipientsTest do
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+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 96%
rename from test/emails/admin_email_test.exs
rename to test/pleroma/emails/admin_email_test.exs
index e24231e27..155057f3e 100644
--- a/test/emails/admin_email_test.exs
+++ b/test/pleroma/emails/admin_email_test.exs
@@ -63,7 +63,7 @@ test "new unapproved registration email" do
assert res.html_body == """
New account for review: @#{account.nickname}
Plz let me in
- Visit AdminFE
+ Visit AdminFE
"""
end
end
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/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/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/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/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/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/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/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/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 63%
rename from test/mfa/backup_codes_test.exs
rename to test/pleroma/mfa/backup_codes_test.exs
index 7bc01b36b..41adb1e96 100644
--- a/test/mfa/backup_codes_test.exs
+++ b/test/pleroma/mfa/backup_codes_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.MFA.BackupCodesTest do
use Pleroma.DataCase
diff --git a/test/mfa/totp_test.exs b/test/pleroma/mfa/totp_test.exs
similarity index 72%
rename from test/mfa/totp_test.exs
rename to test/pleroma/mfa/totp_test.exs
index 50153d208..9edb6fd54 100644
--- a/test/mfa/totp_test.exs
+++ b/test/pleroma/mfa/totp_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.MFA.TOTPTest do
use Pleroma.DataCase
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 99%
rename from test/notification_test.exs
rename to test/pleroma/notification_test.exs
index f2e0f0b0d..0e9630f28 100644
--- a/test/notification_test.exs
+++ b/test/pleroma/notification_test.exs
@@ -346,7 +346,7 @@ test "it creates notifications when someone likes user's status with a filtered
describe "follow / follow_request notifications" do
test "it creates `follow` notification for approved Follow activity" do
user = insert(:user)
- followed_user = insert(:user, locked: false)
+ followed_user = insert(:user, is_locked: false)
{:ok, _, _, _activity} = CommonAPI.follow(user, followed_user)
assert FollowingRelationship.following?(user, followed_user)
@@ -361,7 +361,7 @@ test "it creates `follow` notification for approved Follow activity" do
test "it creates `follow_request` notification for pending Follow activity" do
user = insert(:user)
- followed_user = insert(:user, locked: true)
+ followed_user = insert(:user, is_locked: true)
{:ok, _, _, _activity} = CommonAPI.follow(user, followed_user)
refute FollowingRelationship.following?(user, followed_user)
@@ -383,7 +383,7 @@ test "it creates `follow_request` notification for pending Follow activity" do
test "it doesn't create a notification for follow-unfollow-follow chains" do
user = insert(:user)
- followed_user = insert(:user, locked: false)
+ followed_user = insert(:user, is_locked: false)
{:ok, _, _, _activity} = CommonAPI.follow(user, followed_user)
assert FollowingRelationship.following?(user, followed_user)
@@ -397,7 +397,7 @@ test "it doesn't create a notification for follow-unfollow-follow chains" do
end
test "dismisses the notification on follow request rejection" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
follower = insert(:user)
{:ok, _, _, _follow_activity} = CommonAPI.follow(follower, user)
assert [notification] = Notification.for_user(user)
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 98%
rename from test/object_test.exs
rename to test/pleroma/object_test.exs
index 198d3b1cf..99caba336 100644
--- a/test/object_test.exs
+++ b/test/pleroma/object_test.exs
@@ -82,7 +82,7 @@ test "Disabled via config" do
Pleroma.Config.put([:instance, :cleanup_attachments], false)
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -116,7 +116,7 @@ test "in subdirectories" do
Pleroma.Config.put([:instance, :cleanup_attachments], true)
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -155,7 +155,7 @@ test "with dedupe enabled" do
File.mkdir_p!(uploads_dir)
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -188,7 +188,7 @@ test "with objects that have legacy data.url attribute" do
Pleroma.Config.put([:instance, :cleanup_attachments], true)
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -225,7 +225,7 @@ test "With custom base_url" do
Pleroma.Config.put([:instance, :cleanup_attachments], true)
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
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/migrations/20200716195806_autolinker_to_linkify_test.exs b/test/pleroma/repo/migrations/autolinker_to_linkify_test.exs
similarity index 93%
rename from test/migrations/20200716195806_autolinker_to_linkify_test.exs
rename to test/pleroma/repo/migrations/autolinker_to_linkify_test.exs
index 250d11c61..84f520fe4 100644
--- a/test/migrations/20200716195806_autolinker_to_linkify_test.exs
+++ b/test/pleroma/repo/migrations/autolinker_to_linkify_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Repo.Migrations.AutolinkerToLinkifyTest do
use Pleroma.DataCase
import Pleroma.Factory
diff --git a/test/migrations/20200802170532_fix_legacy_tags_test.exs b/test/pleroma/repo/migrations/fix_legacy_tags_test.exs
similarity index 83%
rename from test/migrations/20200802170532_fix_legacy_tags_test.exs
rename to test/pleroma/repo/migrations/fix_legacy_tags_test.exs
index 3b4dee407..432055e45 100644
--- a/test/migrations/20200802170532_fix_legacy_tags_test.exs
+++ b/test/pleroma/repo/migrations/fix_legacy_tags_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Repo.Migrations.FixLegacyTagsTest do
alias Pleroma.User
use Pleroma.DataCase
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 93%
rename from test/migrations/20200722185515_fix_malformed_formatter_config_test.exs
rename to test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs
index d3490478e..61528599a 100644
--- a/test/migrations/20200722185515_fix_malformed_formatter_config_test.exs
+++ b/test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Repo.Migrations.FixMalformedFormatterConfigTest do
use Pleroma.DataCase
import Pleroma.Factory
diff --git a/test/migrations/20200724133313_move_welcome_settings_test.exs b/test/pleroma/repo/migrations/move_welcome_settings_test.exs
similarity index 96%
rename from test/migrations/20200724133313_move_welcome_settings_test.exs
rename to test/pleroma/repo/migrations/move_welcome_settings_test.exs
index 739f24547..53d05a55a 100644
--- a/test/migrations/20200724133313_move_welcome_settings_test.exs
+++ b/test/pleroma/repo/migrations/move_welcome_settings_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Repo.Migrations.MoveWelcomeSettingsTest do
use Pleroma.DataCase
import Pleroma.Factory
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/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/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 71%
rename from test/safe_jsonb_set_test.exs
rename to test/pleroma/safe_jsonb_set_test.exs
index 748540570..8b1274545 100644
--- a/test/safe_jsonb_set_test.exs
+++ b/test/pleroma/safe_jsonb_set_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.SafeJsonbSetTest do
use Pleroma.DataCase
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 97%
rename from test/upload/filter/anonymize_filename_test.exs
rename to test/pleroma/upload/filter/anonymize_filename_test.exs
index 19b915cc8..7ef01ce91 100644
--- a/test/upload/filter/anonymize_filename_test.exs
+++ b/test/pleroma/upload/filter/anonymize_filename_test.exs
@@ -13,7 +13,7 @@ defmodule Pleroma.Upload.Filter.AnonymizeFilenameTest do
upload_file = %Upload{
name: "an… image.jpg",
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg")
}
diff --git a/test/upload/filter/dedupe_test.exs b/test/pleroma/upload/filter/dedupe_test.exs
similarity index 96%
rename from test/upload/filter/dedupe_test.exs
rename to test/pleroma/upload/filter/dedupe_test.exs
index 75c7198e1..92a3d7df3 100644
--- a/test/upload/filter/dedupe_test.exs
+++ b/test/pleroma/upload/filter/dedupe_test.exs
@@ -18,7 +18,7 @@ test "adds shasum" do
upload = %Upload{
name: "an… image.jpg",
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
tempfile: Path.absname("test/fixtures/image_tmp.jpg")
}
diff --git a/test/upload/filter/exiftool_test.exs b/test/pleroma/upload/filter/exiftool_test.exs
similarity index 97%
rename from test/upload/filter/exiftool_test.exs
rename to test/pleroma/upload/filter/exiftool_test.exs
index d4cd4ba11..6b978b64c 100644
--- a/test/upload/filter/exiftool_test.exs
+++ b/test/pleroma/upload/filter/exiftool_test.exs
@@ -16,7 +16,7 @@ test "apply exiftool filter" do
upload = %Pleroma.Upload{
name: "image_with_GPS_data.jpg",
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/DSCN0010.jpg"),
tempfile: Path.absname("test/fixtures/DSCN0010_tmp.jpg")
}
diff --git a/test/upload/filter/mogrifun_test.exs b/test/pleroma/upload/filter/mogrifun_test.exs
similarity index 96%
rename from test/upload/filter/mogrifun_test.exs
rename to test/pleroma/upload/filter/mogrifun_test.exs
index dc1e9e78f..fc2f68276 100644
--- a/test/upload/filter/mogrifun_test.exs
+++ b/test/pleroma/upload/filter/mogrifun_test.exs
@@ -17,7 +17,7 @@ test "apply mogrify filter" do
upload = %Upload{
name: "an… image.jpg",
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
tempfile: Path.absname("test/fixtures/image_tmp.jpg")
}
diff --git a/test/upload/filter/mogrify_test.exs b/test/pleroma/upload/filter/mogrify_test.exs
similarity index 96%
rename from test/upload/filter/mogrify_test.exs
rename to test/pleroma/upload/filter/mogrify_test.exs
index bf64b96b3..6dee02e8b 100644
--- a/test/upload/filter/mogrify_test.exs
+++ b/test/pleroma/upload/filter/mogrify_test.exs
@@ -18,7 +18,7 @@ test "apply mogrify filter" do
upload = %Pleroma.Upload{
name: "an… image.jpg",
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
tempfile: Path.absname("test/fixtures/image_tmp.jpg")
}
diff --git a/test/upload/filter_test.exs b/test/pleroma/upload/filter_test.exs
similarity index 96%
rename from test/upload/filter_test.exs
rename to test/pleroma/upload/filter_test.exs
index 352b66402..09394929c 100644
--- a/test/upload/filter_test.exs
+++ b/test/pleroma/upload/filter_test.exs
@@ -20,7 +20,7 @@ test "applies filters" do
upload = %Pleroma.Upload{
name: "an… image.jpg",
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
tempfile: Path.absname("test/fixtures/image_tmp.jpg")
}
diff --git a/test/upload_test.exs b/test/pleroma/upload_test.exs
similarity index 81%
rename from test/upload_test.exs
rename to test/pleroma/upload_test.exs
index b06b54487..f52d4dff6 100644
--- a/test/upload_test.exs
+++ b/test/pleroma/upload_test.exs
@@ -11,7 +11,7 @@ defmodule Pleroma.UploadTest do
alias Pleroma.Uploaders.Uploader
@upload_file %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
filename: "image.jpg"
}
@@ -112,7 +112,7 @@ test "does not allow descriptions longer than the post limit" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
filename: "image.jpg"
}
@@ -124,7 +124,7 @@ test "returns a media url" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
filename: "image.jpg"
}
@@ -140,7 +140,7 @@ test "copies the file to the configured folder with deduping" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
filename: "an [image.jpg"
}
@@ -156,7 +156,7 @@ test "copies the file to the configured folder without deduping" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
filename: "an [image.jpg"
}
@@ -165,63 +165,31 @@ test "copies the file to the configured folder without deduping" do
assert data["name"] == "an [image.jpg"
end
- test "fixes incorrect content type" do
- File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
-
- file = %Plug.Upload{
- content_type: "application/octet-stream",
- path: Path.absname("test/fixtures/image_tmp.jpg"),
- filename: "an [image.jpg"
+ test "fixes incorrect content type when base64 is given" do
+ params = %{
+ img: "data:image/png;base64,#{Base.encode64(File.read!("test/fixtures/image.jpg"))}"
}
- {:ok, data} = Upload.store(file, filters: [Pleroma.Upload.Filter.Dedupe])
+ {:ok, data} = Upload.store(params)
assert hd(data["url"])["mediaType"] == "image/jpeg"
end
- test "adds missing extension" do
+ test "adds extension when base64 is given" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
- file = %Plug.Upload{
- content_type: "image/jpg",
- path: Path.absname("test/fixtures/image_tmp.jpg"),
- filename: "an [image"
+ params = %{
+ img: "data:image/png;base64,#{Base.encode64(File.read!("test/fixtures/image.jpg"))}"
}
- {:ok, data} = Upload.store(file)
- assert data["name"] == "an [image.jpg"
- end
-
- test "fixes incorrect file extension" do
- File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
-
- file = %Plug.Upload{
- content_type: "image/jpg",
- path: Path.absname("test/fixtures/image_tmp.jpg"),
- filename: "an [image.blah"
- }
-
- {:ok, data} = Upload.store(file)
- assert data["name"] == "an [image.jpg"
- end
-
- test "don't modify filename of an unknown type" do
- File.cp("test/fixtures/test.txt", "test/fixtures/test_tmp.txt")
-
- file = %Plug.Upload{
- content_type: "text/plain",
- path: Path.absname("test/fixtures/test_tmp.txt"),
- filename: "test.txt"
- }
-
- {:ok, data} = Upload.store(file)
- assert data["name"] == "test.txt"
+ {:ok, data} = Upload.store(params)
+ assert String.ends_with?(data["name"], ".jpg")
end
test "copies the file to the configured folder with anonymizing filename" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
filename: "an [image.jpg"
}
@@ -235,7 +203,7 @@ test "escapes invalid characters in url" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
filename: "an… image.jpg"
}
@@ -250,7 +218,7 @@ test "escapes reserved uri characters" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
filename: ":?#[]@!$&\\'()*+,;=.jpg"
}
@@ -272,7 +240,7 @@ test "returns a media url with configured base_url" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
filename: "image.jpg"
}
diff --git a/test/uploaders/local_test.exs b/test/pleroma/uploaders/local_test.exs
similarity index 95%
rename from test/uploaders/local_test.exs
rename to test/pleroma/uploaders/local_test.exs
index 18122ff6c..1ce7be485 100644
--- a/test/uploaders/local_test.exs
+++ b/test/pleroma/uploaders/local_test.exs
@@ -19,7 +19,7 @@ test "put file to local folder" do
file = %Pleroma.Upload{
name: "image.jpg",
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: file_path,
tempfile: Path.absname("test/fixtures/image_tmp.jpg")
}
@@ -38,7 +38,7 @@ test "deletes local file" do
file = %Pleroma.Upload{
name: "image.jpg",
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: file_path,
tempfile: Path.absname("test/fixtures/image_tmp.jpg")
}
diff --git a/test/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs
similarity index 98%
rename from test/uploaders/s3_test.exs
rename to test/pleroma/uploaders/s3_test.exs
index d949c90a5..e7a013dd8 100644
--- a/test/uploaders/s3_test.exs
+++ b/test/pleroma/uploaders/s3_test.exs
@@ -56,7 +56,7 @@ test "it returns path with bucket namespace when namespace is set" do
setup do
file_upload = %Pleroma.Upload{
name: "image-tet.jpg",
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: "test_folder/image-tet.jpg",
tempfile: Path.absname("test/instance_static/add/shortcode.png")
}
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/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/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/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/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 99%
rename from test/user_test.exs
rename to test/pleroma/user_test.exs
index d506f7047..d8ac652af 100644
--- a/test/user_test.exs
+++ b/test/pleroma/user_test.exs
@@ -174,7 +174,7 @@ test "ap_following returns the following collection for the user" do
test "returns all pending follow requests" do
unlocked = insert(:user)
- locked = insert(:user, locked: true)
+ locked = insert(:user, is_locked: true)
follower = insert(:user)
CommonAPI.follow(follower, unlocked)
@@ -187,7 +187,7 @@ test "returns all pending follow requests" do
end
test "doesn't return already accepted or duplicate follow requests" do
- locked = insert(:user, locked: true)
+ locked = insert(:user, is_locked: true)
pending_follower = insert(:user)
accepted_follower = insert(:user)
@@ -201,7 +201,7 @@ test "doesn't return already accepted or duplicate follow requests" do
end
test "doesn't return follow requests for deactivated accounts" do
- locked = insert(:user, locked: true)
+ locked = insert(:user, is_locked: true)
pending_follower = insert(:user, %{deactivated: true})
CommonAPI.follow(pending_follower, locked)
@@ -211,7 +211,7 @@ test "doesn't return follow requests for deactivated accounts" do
end
test "clears follow requests when requester is blocked" do
- followed = insert(:user, locked: true)
+ followed = insert(:user, is_locked: true)
follower = insert(:user)
CommonAPI.follow(follower, followed)
@@ -299,8 +299,8 @@ test "can't subscribe to a user who blocked us" do
end
test "local users do not automatically follow local locked accounts" do
- follower = insert(:user, locked: true)
- followed = insert(:user, locked: true)
+ follower = insert(:user, is_locked: true)
+ followed = insert(:user, is_locked: true)
{:ok, follower} = User.maybe_direct_follow(follower, followed)
@@ -1360,7 +1360,7 @@ test "it deactivates a user, all follow relationships and all activities", %{use
follower = insert(:user)
{:ok, follower} = User.follow(follower, user)
- locked_user = insert(:user, name: "locked", locked: true)
+ locked_user = insert(:user, name: "locked", is_locked: true)
{:ok, _} = User.follow(user, locked_user, :follow_pending)
object = insert(:note, user: user)
@@ -1450,7 +1450,7 @@ test "delete/1 purges a user when they wouldn't be fully deleted" do
note_count: 9,
follower_count: 9,
following_count: 9001,
- locked: true,
+ is_locked: true,
confirmation_pending: true,
password_reset_pending: true,
approval_pending: true,
@@ -1492,7 +1492,7 @@ test "delete/1 purges a user when they wouldn't be fully deleted" do
note_count: 0,
follower_count: 0,
following_count: 0,
- locked: false,
+ is_locked: false,
confirmation_pending: false,
password_reset_pending: false,
approval_pending: false,
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/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
similarity index 99%
rename from test/web/activity_pub/activity_pub_controller_test.exs
rename to test/pleroma/web/activity_pub/activity_pub_controller_test.exs
index 0517571f2..b11e2f961 100644
--- a/test/web/activity_pub/activity_pub_controller_test.exs
+++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
@@ -1487,9 +1487,9 @@ test "POST /api/ap/upload_media", %{conn: conn} do
desc = "Description of the image"
image = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "bad/content-type",
path: Path.absname("test/fixtures/image.jpg"),
- filename: "an_image.jpg"
+ filename: "an_image.png"
}
object =
@@ -1504,6 +1504,7 @@ test "POST /api/ap/upload_media", %{conn: conn} do
assert [%{"href" => object_href, "mediaType" => object_mediatype}] = object["url"]
assert is_binary(object_href)
assert object_mediatype == "image/jpeg"
+ assert String.ends_with?(object_href, ".jpg")
activity_request = %{
"@context" => "https://www.w3.org/ns/activitystreams",
diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs
similarity index 99%
rename from test/web/activity_pub/activity_pub_test.exs
rename to test/pleroma/web/activity_pub/activity_pub_test.exs
index 804305a13..1a8a844ca 100644
--- a/test/web/activity_pub/activity_pub_test.exs
+++ b/test/pleroma/web/activity_pub/activity_pub_test.exs
@@ -1029,7 +1029,7 @@ test "returns reblogs for users for whom reblogs have not been muted" do
describe "uploading files" do
setup do
test_file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -1120,7 +1120,7 @@ test "creates an undo activity for the last follow" do
test "creates an undo activity for a pending follow request" do
follower = insert(:user)
- followed = insert(:user, %{locked: true})
+ followed = insert(:user, %{is_locked: true})
{:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
{:ok, activity} = ActivityPub.unfollow(follower, followed)
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/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/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs
rename to test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_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 94%
rename from test/web/activity_pub/mrf/mrf_test.exs
rename to test/pleroma/web/activity_pub/mrf_test.exs
index e82c8afa6..e8cdde2e1 100644
--- a/test/web/activity_pub/mrf/mrf_test.exs
+++ b/test/pleroma/web/activity_pub/mrf_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.ActivityPub.MRFTest do
use ExUnit.Case, async: true
use Pleroma.Tests.Helpers
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/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/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/object_validators/attachment_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs
similarity index 98%
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
index 558bb3131..760388e80 100644
--- a/test/web/activity_pub/object_validators/attachment_validator_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs
@@ -56,7 +56,7 @@ test "it handles our own uploads" do
user = insert(:user)
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
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 98%
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
index 16e4808e5..d7e299224 100644
--- a/test/web/activity_pub/object_validators/chat_validation_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs
@@ -77,7 +77,7 @@ test "validates for a basic object with an attachment", %{
user: user
} do
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -98,7 +98,7 @@ test "validates for a basic object with an attachment in an array", %{
user: user
} do
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -119,7 +119,7 @@ test "validates for a basic object with an attachment but without content", %{
user: user
} do
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
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/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/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
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/accept_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs
similarity index 96%
rename from test/web/activity_pub/transmogrifier/accept_handling_test.exs
rename to test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs
index 77d468f5c..c6ff96f08 100644
--- a/test/web/activity_pub/transmogrifier/accept_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs
@@ -46,7 +46,7 @@ test "it works for incoming accepts which were pre-accepted" do
test "it works for incoming accepts which are referenced by IRI only" do
follower = insert(:user)
- followed = insert(:user, locked: true)
+ followed = insert(:user, is_locked: true)
{:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
@@ -72,7 +72,7 @@ test "it works for incoming accepts which are referenced by IRI only" do
test "it fails for incoming accepts which cannot be correlated" do
follower = insert(:user)
- followed = insert(:user, locked: true)
+ followed = insert(:user, is_locked: true)
accept_data =
File.read!("test/fixtures/mastodon-accept-activity.json")
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/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/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/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
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
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/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
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 98%
rename from test/web/activity_pub/transmogrifier/follow_handling_test.exs
rename to test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs
index 757d90941..4ef8210ad 100644
--- a/test/web/activity_pub/transmogrifier/follow_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs
@@ -65,7 +65,7 @@ test "it works for incoming follow requests" do
end
test "with locked accounts, it does create a Follow, but not an Accept" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
@@ -188,7 +188,7 @@ test "it works for incoming follow requests from hubzilla" do
test "it works for incoming follows to locked account" do
pending_follower = insert(:user, ap_id: "http://mastodon.example.org/users/admin")
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
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/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 95%
rename from test/web/activity_pub/transmogrifier/reject_handling_test.exs
rename to test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs
index 7592fbe1c..5c1451def 100644
--- a/test/web/activity_pub/transmogrifier/reject_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs
@@ -14,7 +14,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.RejectHandlingTest do
test "it fails for incoming rejects which cannot be correlated" do
follower = insert(:user)
- followed = insert(:user, locked: true)
+ followed = insert(:user, is_locked: true)
accept_data =
File.read!("test/fixtures/mastodon-reject-activity.json")
@@ -33,7 +33,7 @@ test "it fails for incoming rejects which cannot be correlated" do
test "it works for incoming rejects which are referenced by IRI only" do
follower = insert(:user)
- followed = insert(:user, locked: true)
+ followed = insert(:user, is_locked: true)
{:ok, follower} = User.follow(follower, followed)
{:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
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/user_update_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs
similarity index 99%
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
index 64636656c..7c4d16db7 100644
--- a/test/web/activity_pub/transmogrifier/user_update_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs
@@ -154,6 +154,6 @@ test "it works for incoming update activities which lock the account" do
{:ok, %Activity{local: false}} = Transmogrifier.handle_incoming(update_data)
user = User.get_cached_by_ap_id(user.ap_id)
- assert user.locked == true
+ assert user.is_locked == true
end
end
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/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 99%
rename from test/web/activity_pub/utils_test.exs
rename to test/pleroma/web/activity_pub/utils_test.exs
index d50213545..be9cd7d13 100644
--- a/test/web/activity_pub/utils_test.exs
+++ b/test/pleroma/web/activity_pub/utils_test.exs
@@ -193,7 +193,7 @@ test "fetches only Create activities" do
describe "update_follow_state_for_all/2" do
test "updates the state of all Follow activities with the same actor and object" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
follower = insert(:user)
{:ok, _, _, follow_activity} = CommonAPI.follow(follower, user)
@@ -217,7 +217,7 @@ test "updates the state of all Follow activities with the same actor and object"
describe "update_follow_state/2" do
test "updates the state of the given follow activity" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
follower = insert(:user)
{:ok, _, _, follow_activity} = CommonAPI.follow(follower, user)
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/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/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/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/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/o_auth_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/o_auth_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 87%
rename from test/web/chat_channel_test.exs
rename to test/pleroma/web/chat_channel_test.exs
index f18f3a212..32170873d 100644
--- a/test/web/chat_channel_test.exs
+++ b/test/pleroma/web/chat_channel_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.ChatChannelTest do
use Pleroma.Web.ChannelCase
alias Pleroma.Web.ChatChannel
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 99%
rename from test/web/common_api/common_api_test.exs
rename to test/pleroma/web/common_api_test.exs
index e34f5a49b..f5d09f396 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/pleroma/web/common_api_test.exs
@@ -100,7 +100,7 @@ test "it posts a chat message without content but with an attachment" do
recipient = insert(:user)
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -1071,7 +1071,7 @@ test "also unsubscribes a user" do
test "cancels a pending follow for a local user" do
follower = insert(:user)
- followed = insert(:user, locked: true)
+ followed = insert(:user, is_locked: true)
assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} =
CommonAPI.follow(follower, followed)
@@ -1093,7 +1093,7 @@ test "cancels a pending follow for a local user" do
test "cancels a pending follow for a remote user" do
follower = insert(:user)
- followed = insert(:user, locked: true, local: false, ap_enabled: true)
+ followed = insert(:user, is_locked: true, local: false, ap_enabled: true)
assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} =
CommonAPI.follow(follower, followed)
@@ -1116,7 +1116,7 @@ test "cancels a pending follow for a remote user" do
describe "accept_follow_request/2" do
test "after acceptance, it sets all existing pending follow request states to 'accept'" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
follower = insert(:user)
follower_two = insert(:user)
@@ -1136,7 +1136,7 @@ test "after acceptance, it sets all existing pending follow request states to 'a
end
test "after rejection, it sets all existing pending follow request states to 'reject'" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
follower = insert(:user)
follower_two = insert(:user)
@@ -1156,7 +1156,7 @@ test "after rejection, it sets all existing pending follow request states to 're
end
test "doesn't create a following relationship if the corresponding follow request doesn't exist" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
not_follower = insert(:user)
CommonAPI.accept_follow_request(not_follower, user)
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/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
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 98%
rename from test/web/feed/user_controller_test.exs
rename to test/pleroma/web/feed/user_controller_test.exs
index 9a5610baa..a5dc0894b 100644
--- a/test/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
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 99%
rename from test/web/mastodon_api/controllers/account_controller_test.exs
rename to test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
index f7f1369e4..7336fa8de 100644
--- a/test/web/mastodon_api/controllers/account_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
@@ -380,7 +380,7 @@ test "gets an users media, excludes reblogs", %{conn: conn} do
other_user = insert(:user)
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -706,7 +706,7 @@ test "following / unfollowing a user", %{conn: conn} do
end
test "cancelling follow request", %{conn: conn} do
- %{id: other_user_id} = insert(:user, %{locked: true})
+ %{id: other_user_id} = insert(:user, %{is_locked: true})
assert %{"id" => ^other_user_id, "following" => false, "requested" => true} =
conn
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 98%
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
index 6749e0e83..a9dd7cd30 100644
--- a/test/web/mastodon_api/controllers/follow_request_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs
@@ -12,7 +12,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
describe "locked accounts" do
setup do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
%{conn: conn} = oauth_access(["follow"], user: user)
%{user: user, conn: conn}
end
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 97%
rename from test/web/mastodon_api/controllers/media_controller_test.exs
rename to test/pleroma/web/mastodon_api/controllers/media_controller_test.exs
index 906fd940f..d2bd57515 100644
--- a/test/web/mastodon_api/controllers/media_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs
@@ -14,7 +14,7 @@ defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do
setup do
image = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -74,7 +74,7 @@ test "/api/v2/media", %{conn: conn, user: user, image: image} do
setup %{user: actor} do
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -106,7 +106,7 @@ test "/api/v1/media/:id good request", %{conn: conn, object: object} do
setup %{user: actor} do
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
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 99%
rename from test/web/mastodon_api/controllers/status_controller_test.exs
rename to test/pleroma/web/mastodon_api/controllers/status_controller_test.exs
index 633a25e50..61359214a 100644
--- a/test/web/mastodon_api/controllers/status_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs
@@ -167,7 +167,7 @@ test "Get MRF reason when posting a status is rejected by one", %{conn: conn} do
test "posting an undefined status with an attachment", %{user: user, conn: conn} do
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -408,7 +408,7 @@ test "creates a scheduled activity with a media attachment", %{user: user, conn:
|> Kernel.<>("Z")
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
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 98%
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..ed1921c91 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
@@ -222,7 +222,7 @@ test "updates the user's name", %{conn: conn} do
test "updates the user's avatar", %{user: user, conn: conn} do
new_avatar = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -246,7 +246,7 @@ test "updates the user's avatar", %{user: user, conn: conn} do
test "updates the user's banner", %{user: user, conn: conn} do
new_header = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -265,7 +265,7 @@ test "updates the user's banner", %{user: user, conn: conn} do
test "updates the user's background", %{conn: conn, user: user} do
new_header = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
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 98%
rename from test/web/mastodon_api/views/account_view_test.exs
rename to test/pleroma/web/mastodon_api/views/account_view_test.exs
index a5f39b215..203e61c71 100644
--- a/test/web/mastodon_api/views/account_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs
@@ -332,7 +332,7 @@ test "represent a relationship for the user blocking a domain" do
test "represent a relationship for the user with a pending follow request" do
user = insert(:user)
- other_user = insert(:user, locked: true)
+ other_user = insert(:user, is_locked: true)
{:ok, user, other_user, _} = CommonAPI.follow(user, other_user)
user = User.get_cached_by_id(user.id)
@@ -481,7 +481,7 @@ test "shows zero when no follow requests are pending" do
end
test "shows non-zero when follow requests are pending" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
@@ -493,7 +493,7 @@ test "shows non-zero when follow requests are pending" do
end
test "decreases when accepting a follow request" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
@@ -510,7 +510,7 @@ test "decreases when accepting a follow request" do
end
test "decreases when rejecting a follow request" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
@@ -527,14 +527,14 @@ test "decreases when rejecting a follow request" do
end
test "shows non-zero when historical unapproved requests are present" do
- user = insert(:user, locked: true)
+ user = insert(:user, is_locked: true)
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
other_user = insert(:user)
{:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user)
- {:ok, user} = User.update_and_set_cache(user, %{locked: false})
+ {:ok, user} = User.update_and_set_cache(user, %{is_locked: false})
assert %{locked: false, follow_requests_count: 1} =
AccountView.render("show.json", %{user: user, for: user})
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 98%
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
index fbfd873ef..04f73f5a0 100644
--- a/test/web/mastodon_api/views/scheduled_activity_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs
@@ -22,7 +22,7 @@ test "A scheduled activity with a media attachment" do
|> NaiveDateTime.to_iso8601()
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
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 88%
rename from test/web/media_proxy/invalidations/http_test.exs
rename to test/pleroma/web/media_proxy/invalidation/http_test.exs
index a1bef5237..13d081325 100644
--- a/test/web/media_proxy/invalidations/http_test.exs
+++ b/test/pleroma/web/media_proxy/invalidation/http_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.MediaProxy.Invalidation.HttpTest do
use ExUnit.Case
alias Pleroma.Web.MediaProxy.Invalidation
diff --git a/test/web/media_proxy/invalidations/script_test.exs b/test/pleroma/web/media_proxy/invalidation/script_test.exs
similarity index 83%
rename from test/web/media_proxy/invalidations/script_test.exs
rename to test/pleroma/web/media_proxy/invalidation/script_test.exs
index 51833ab18..692cbb2df 100644
--- a/test/web/media_proxy/invalidations/script_test.exs
+++ b/test/pleroma/web/media_proxy/invalidation/script_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.MediaProxy.Invalidation.ScriptTest do
use ExUnit.Case
alias Pleroma.Web.MediaProxy.Invalidation
diff --git a/test/web/media_proxy/invalidation_test.exs b/test/pleroma/web/media_proxy/invalidation_test.exs
similarity index 93%
rename from test/web/media_proxy/invalidation_test.exs
rename to test/pleroma/web/media_proxy/invalidation_test.exs
index 926ae74ca..aa1435ac0 100644
--- a/test/web/media_proxy/invalidation_test.exs
+++ b/test/pleroma/web/media_proxy/invalidation_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.MediaProxy.InvalidationTest do
use ExUnit.Case
use Pleroma.Tests.Helpers
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 99%
rename from test/web/pleroma_api/controllers/chat_controller_test.exs
rename to test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs
index 11d5ba373..6381f9757 100644
--- a/test/web/pleroma_api/controllers/chat_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs
@@ -105,7 +105,7 @@ test "it fails if there is no content", %{conn: conn, user: user} do
test "it works with an attachment", %{conn: conn, user: user} do
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
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_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/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 96%
rename from test/web/pleroma_api/controllers/mascot_controller_test.exs
rename to test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs
index e2ead6e15..d6be92869 100644
--- a/test/web/pleroma_api/controllers/mascot_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs
@@ -24,7 +24,7 @@ test "mascot upload" do
assert json_response_and_validate_schema(ret_conn, 415)
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@@ -48,7 +48,7 @@ test "mascot retrieving" do
# When a user sets their mascot, we should get that back
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
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 98%
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
index d23d08a00..22988c881 100644
--- 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
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.PleromaAPI.TwoFactorAuthenticationControllerTest do
use Pleroma.Web.ConnCase
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/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 95%
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..f171a1e55 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
@@ -19,7 +19,7 @@ test "it displays a chat message" do
recipient = insert(:user)
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
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 91%
rename from test/web/pleroma_api/views/scrobble_view_test.exs
rename to test/pleroma/web/pleroma_api/views/scrobble_view_test.exs
index 6bdb56509..0f43cbdc3 100644
--- a/test/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
diff --git a/test/plugs/admin_secret_authentication_plug_test.exs b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs
similarity index 88%
rename from test/plugs/admin_secret_authentication_plug_test.exs
rename to test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs
index 14094eda8..33394722a 100644
--- a/test/plugs/admin_secret_authentication_plug_test.exs
+++ b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs
@@ -2,16 +2,16 @@
# 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
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)
diff --git a/test/plugs/authentication_plug_test.exs b/test/pleroma/web/plugs/authentication_plug_test.exs
similarity index 93%
rename from test/plugs/authentication_plug_test.exs
rename to test/pleroma/web/plugs/authentication_plug_test.exs
index 777ae15ae..af39352e2 100644
--- a/test/plugs/authentication_plug_test.exs
+++ b/test/pleroma/web/plugs/authentication_plug_test.exs
@@ -2,13 +2,13 @@
# 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
- alias Pleroma.Plugs.OAuthScopesPlug
- alias Pleroma.Plugs.PlugHelper
alias Pleroma.User
+ alias Pleroma.Web.Plugs.AuthenticationPlug
+ alias Pleroma.Web.Plugs.OAuthScopesPlug
+ alias Pleroma.Web.Plugs.PlugHelper
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/plugs/basic_auth_decoder_plug_test.exs b/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs
similarity index 89%
rename from test/plugs/basic_auth_decoder_plug_test.exs
rename to test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs
index a6063d4f6..2d6af228c 100644
--- a/test/plugs/basic_auth_decoder_plug_test.exs
+++ b/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs
@@ -2,10 +2,10 @@
# 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
+ alias Pleroma.Web.Plugs.BasicAuthDecoderPlug
defp basic_auth_enc(username, password) do
"Basic " <> Base.encode64("#{username}:#{password}")
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 98%
rename from test/plugs/cache_test.exs
rename to test/pleroma/web/plugs/cache_test.exs
index 8b231c881..93a66f5d3 100644
--- a/test/plugs/cache_test.exs
+++ b/test/pleroma/web/plugs/cache_test.exs
@@ -2,11 +2,11 @@
# 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
- alias Pleroma.Plugs.Cache
+ alias Pleroma.Web.Plugs.Cache
@miss_resp {200,
[
diff --git a/test/plugs/ensure_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs
similarity index 96%
rename from test/plugs/ensure_authenticated_plug_test.exs
rename to test/pleroma/web/plugs/ensure_authenticated_plug_test.exs
index a0667c5e0..92ff19282 100644
--- a/test/plugs/ensure_authenticated_plug_test.exs
+++ b/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs
@@ -2,11 +2,11 @@
# 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
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/plugs/ensure_public_or_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs
similarity index 89%
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..211443a55 100644
--- a/test/plugs/ensure_public_or_authenticated_plug_test.exs
+++ b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs
@@ -2,12 +2,12 @@
# 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
- alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug
alias Pleroma.User
+ alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug
setup do: clear_config([:instance, :public])
diff --git a/test/plugs/ensure_user_key_plug_test.exs b/test/pleroma/web/plugs/ensure_user_key_plug_test.exs
similarity index 86%
rename from test/plugs/ensure_user_key_plug_test.exs
rename to test/pleroma/web/plugs/ensure_user_key_plug_test.exs
index 633c05447..f912ef755 100644
--- a/test/plugs/ensure_user_key_plug_test.exs
+++ b/test/pleroma/web/plugs/ensure_user_key_plug_test.exs
@@ -2,10 +2,10 @@
# 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
+ alias Pleroma.Web.Plugs.EnsureUserKeyPlug
test "if the conn has a user key set, it does nothing", %{conn: conn} do
conn =
diff --git a/test/web/plugs/federating_plug_test.exs b/test/pleroma/web/plugs/federating_plug_test.exs
similarity index 80%
rename from test/web/plugs/federating_plug_test.exs
rename to test/pleroma/web/plugs/federating_plug_test.exs
index 2f8aadadc..a4652f6c5 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])
@@ -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
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
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 97%
rename from test/plugs/idempotency_plug_test.exs
rename to test/pleroma/web/plugs/idempotency_plug_test.exs
index 21fa0fbcf..4a7835993 100644
--- a/test/plugs/idempotency_plug_test.exs
+++ b/test/pleroma/web/plugs/idempotency_plug_test.exs
@@ -2,11 +2,11 @@
# 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
- alias Pleroma.Plugs.IdempotencyPlug
+ alias Pleroma.Web.Plugs.IdempotencyPlug
alias Plug.Conn
test "returns result from cache" do
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 90%
rename from test/plugs/legacy_authentication_plug_test.exs
rename to test/pleroma/web/plugs/legacy_authentication_plug_test.exs
index 3b8c07627..2016a31a8 100644
--- a/test/plugs/legacy_authentication_plug_test.exs
+++ b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs
@@ -2,15 +2,15 @@
# 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
- alias Pleroma.Plugs.LegacyAuthenticationPlug
- alias Pleroma.Plugs.OAuthScopesPlug
- alias Pleroma.Plugs.PlugHelper
alias Pleroma.User
+ alias Pleroma.Web.Plugs.LegacyAuthenticationPlug
+ alias Pleroma.Web.Plugs.OAuthScopesPlug
+ alias Pleroma.Web.Plugs.PlugHelper
setup do
user =
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 96%
rename from test/plugs/oauth_plug_test.exs
rename to test/pleroma/web/plugs/o_auth_plug_test.exs
index 9d39d3153..b9d722f76 100644
--- a/test/plugs/oauth_plug_test.exs
+++ b/test/pleroma/web/plugs/o_auth_plug_test.exs
@@ -2,10 +2,10 @@
# 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
+ alias Pleroma.Web.Plugs.OAuthPlug
import Pleroma.Factory
@session_opts [
diff --git a/test/plugs/oauth_scopes_plug_test.exs b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs
similarity index 98%
rename from test/plugs/oauth_scopes_plug_test.exs
rename to test/pleroma/web/plugs/o_auth_scopes_plug_test.exs
index 334316043..982a70bf9 100644
--- a/test/plugs/oauth_scopes_plug_test.exs
+++ b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs
@@ -2,11 +2,11 @@
# 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
alias Pleroma.Repo
+ alias Pleroma.Web.Plugs.OAuthScopesPlug
import Mock
import Pleroma.Factory
diff --git a/test/web/plugs/plug_test.exs b/test/pleroma/web/plugs/plug_helper_test.exs
similarity index 94%
rename from test/web/plugs/plug_test.exs
rename to test/pleroma/web/plugs/plug_helper_test.exs
index 943e484e7..670d699f0 100644
--- a/test/web/plugs/plug_test.exs
+++ b/test/pleroma/web/plugs/plug_helper_test.exs
@@ -2,12 +2,12 @@
# 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
- alias Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug
- alias Pleroma.Plugs.PlugHelper
+ alias Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug
+ alias Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug
+ alias Pleroma.Web.Plugs.PlugHelper
import Mock
diff --git a/test/plugs/rate_limiter_test.exs b/test/pleroma/web/plugs/rate_limiter_test.exs
similarity index 98%
rename from test/plugs/rate_limiter_test.exs
rename to test/pleroma/web/plugs/rate_limiter_test.exs
index 4d3d694f4..249c78b37 100644
--- a/test/plugs/rate_limiter_test.exs
+++ b/test/pleroma/web/plugs/rate_limiter_test.exs
@@ -2,12 +2,12 @@
# 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
alias Pleroma.Config
- alias Pleroma.Plugs.RateLimiter
+ alias Pleroma.Web.Plugs.RateLimiter
alias Plug.Conn
import Pleroma.Factory
@@ -19,7 +19,7 @@ defmodule Pleroma.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/plugs/remote_ip_test.exs b/test/pleroma/web/plugs/remote_ip_test.exs
similarity index 57%
rename from test/plugs/remote_ip_test.exs
rename to test/pleroma/web/plugs/remote_ip_test.exs
index 752ab32e7..0bdb4c168 100644
--- a/test/plugs/remote_ip_test.exs
+++ b/test/pleroma/web/plugs/remote_ip_test.exs
@@ -2,14 +2,28 @@
# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
-defmodule Pleroma.Plugs.RemoteIpTest do
- use ExUnit.Case, async: true
+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: 1, clear_config: 2]
- setup do: clear_config(RemoteIp)
+ import Pleroma.Tests.Helpers, only: [clear_config: 2]
+
+ setup do:
+ clear_config(RemoteIp,
+ enabled: true,
+ headers: ["x-forwarded-for"],
+ proxies: [],
+ reserved: [
+ "127.0.0.0/8",
+ "::1/128",
+ "fc00::/7",
+ "10.0.0.0/8",
+ "172.16.0.0/12",
+ "192.168.0.0/16"
+ ]
+ )
test "disabled" do
Pleroma.Config.put(RemoteIp, enabled: false)
@@ -25,8 +39,6 @@ test "disabled" do
end
test "enabled" do
- Pleroma.Config.put(RemoteIp, enabled: true)
-
conn =
conn(:get, "/")
|> put_req_header("x-forwarded-for", "1.1.1.1")
@@ -54,8 +66,6 @@ test "custom headers" do
end
test "custom proxies" do
- Pleroma.Config.put(RemoteIp, enabled: true)
-
conn =
conn(:get, "/")
|> put_req_header("x-forwarded-for", "173.245.48.1, 1.1.1.1, 173.245.48.2")
@@ -72,4 +82,27 @@ test "custom proxies" do
assert conn.remote_ip == {1, 1, 1, 1}
end
+
+ test "proxies set without CIDR format" do
+ Pleroma.Config.put([RemoteIp, :proxies], ["173.245.48.1"])
+
+ conn =
+ conn(:get, "/")
+ |> put_req_header("x-forwarded-for", "173.245.48.1, 1.1.1.1")
+ |> RemoteIp.call(nil)
+
+ assert conn.remote_ip == {1, 1, 1, 1}
+ end
+
+ test "proxies set `nonsensical` CIDR" do
+ Pleroma.Config.put([RemoteIp, :reserved], ["127.0.0.0/8"])
+ Pleroma.Config.put([RemoteIp, :proxies], ["10.0.0.3/24"])
+
+ conn =
+ conn(:get, "/")
+ |> put_req_header("x-forwarded-for", "10.0.0.3, 1.1.1.1")
+ |> RemoteIp.call(nil)
+
+ assert conn.remote_ip == {1, 1, 1, 1}
+ end
end
diff --git a/test/plugs/session_authentication_plug_test.exs b/test/pleroma/web/plugs/session_authentication_plug_test.exs
similarity index 92%
rename from test/plugs/session_authentication_plug_test.exs
rename to test/pleroma/web/plugs/session_authentication_plug_test.exs
index 0949ecfed..2b4d5bc0c 100644
--- a/test/plugs/session_authentication_plug_test.exs
+++ b/test/pleroma/web/plugs/session_authentication_plug_test.exs
@@ -2,11 +2,11 @@
# 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
alias Pleroma.User
+ alias Pleroma.Web.Plugs.SessionAuthenticationPlug
setup %{conn: conn} do
session_opts = [
diff --git a/test/plugs/set_format_plug_test.exs b/test/pleroma/web/plugs/set_format_plug_test.exs
similarity index 89%
rename from test/plugs/set_format_plug_test.exs
rename to test/pleroma/web/plugs/set_format_plug_test.exs
index 7a1dfe9bf..e95d751fa 100644
--- a/test/plugs/set_format_plug_test.exs
+++ b/test/pleroma/web/plugs/set_format_plug_test.exs
@@ -2,11 +2,11 @@
# 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
- alias Pleroma.Plugs.SetFormatPlug
+ alias Pleroma.Web.Plugs.SetFormatPlug
test "set format from params" do
conn =
diff --git a/test/plugs/set_locale_plug_test.exs b/test/pleroma/web/plugs/set_locale_plug_test.exs
similarity index 92%
rename from test/plugs/set_locale_plug_test.exs
rename to test/pleroma/web/plugs/set_locale_plug_test.exs
index 7114b1557..773f48a5b 100644
--- a/test/plugs/set_locale_plug_test.exs
+++ b/test/pleroma/web/plugs/set_locale_plug_test.exs
@@ -2,11 +2,11 @@
# 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
- alias Pleroma.Plugs.SetLocalePlug
+ alias Pleroma.Web.Plugs.SetLocalePlug
alias Plug.Conn
test "default locale is `en`" do
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 90%
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..a89b5628f 100644
--- a/test/plugs/set_user_session_id_plug_test.exs
+++ b/test/pleroma/web/plugs/set_user_session_id_plug_test.exs
@@ -2,11 +2,11 @@
# 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
alias Pleroma.User
+ alias Pleroma.Web.Plugs.SetUserSessionIdPlug
setup %{conn: conn} do
session_opts = [
diff --git a/test/plugs/uploaded_media_plug_test.exs b/test/pleroma/web/plugs/uploaded_media_plug_test.exs
similarity index 93%
rename from test/plugs/uploaded_media_plug_test.exs
rename to test/pleroma/web/plugs/uploaded_media_plug_test.exs
index 20b13dfac..7c8313121 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
@@ -11,7 +11,7 @@ defp upload_file(context) do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
filename: "nice_tf.jpg"
}
diff --git a/test/plugs/user_enabled_plug_test.exs b/test/pleroma/web/plugs/user_enabled_plug_test.exs
similarity index 93%
rename from test/plugs/user_enabled_plug_test.exs
rename to test/pleroma/web/plugs/user_enabled_plug_test.exs
index b219d8abf..71c56f03a 100644
--- a/test/plugs/user_enabled_plug_test.exs
+++ b/test/pleroma/web/plugs/user_enabled_plug_test.exs
@@ -2,10 +2,10 @@
# 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
+ alias Pleroma.Web.Plugs.UserEnabledPlug
import Pleroma.Factory
setup do: clear_config([:instance, :account_activation_required])
diff --git a/test/plugs/user_fetcher_plug_test.exs b/test/pleroma/web/plugs/user_fetcher_plug_test.exs
similarity index 89%
rename from test/plugs/user_fetcher_plug_test.exs
rename to test/pleroma/web/plugs/user_fetcher_plug_test.exs
index 0496f14dd..b4f875d2d 100644
--- a/test/plugs/user_fetcher_plug_test.exs
+++ b/test/pleroma/web/plugs/user_fetcher_plug_test.exs
@@ -2,10 +2,10 @@
# 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
+ alias Pleroma.Web.Plugs.UserFetcherPlug
import Pleroma.Factory
setup do
diff --git a/test/plugs/user_is_admin_plug_test.exs b/test/pleroma/web/plugs/user_is_admin_plug_test.exs
similarity index 89%
rename from test/plugs/user_is_admin_plug_test.exs
rename to test/pleroma/web/plugs/user_is_admin_plug_test.exs
index 8bc00e444..b550568c1 100644
--- a/test/plugs/user_is_admin_plug_test.exs
+++ b/test/pleroma/web/plugs/user_is_admin_plug_test.exs
@@ -2,10 +2,10 @@
# 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
+ alias Pleroma.Web.Plugs.UserIsAdminPlug
import Pleroma.Factory
test "accepts a user that is an admin" do
diff --git a/test/web/preload/instance_test.exs b/test/pleroma/web/preload/providers/instance_test.exs
similarity index 85%
rename from test/web/preload/instance_test.exs
rename to test/pleroma/web/preload/providers/instance_test.exs
index a46f28312..8493f2a94 100644
--- a/test/web/preload/instance_test.exs
+++ b/test/pleroma/web/preload/providers/instance_test.exs
@@ -45,4 +45,12 @@ test "it renders the node_info", %{"/nodeinfo/2.0.json" => nodeinfo} do
assert metadata.private == false
assert metadata.suggestions == %{enabled: false}
end
+
+ test "it renders the frontend configurations", %{
+ "/api/pleroma/frontend_configurations" => fe_configs
+ } do
+ assert %{
+ pleroma_fe: %{background: "/images/city.jpg", logo: "/static/logo.png"}
+ } = fe_configs
+ end
end
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
diff --git a/test/web/push/impl_test.exs b/test/pleroma/web/push/impl_test.exs
similarity index 99%
rename from test/web/push/impl_test.exs
rename to test/pleroma/web/push/impl_test.exs
index 6cab46696..7d8cc999a 100644
--- a/test/web/push/impl_test.exs
+++ b/test/pleroma/web/push/impl_test.exs
@@ -219,7 +219,7 @@ test "builds content for chat messages with no content" do
recipient = insert(:user)
file = %Plug.Upload{
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
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 99%
rename from test/web/rich_media/helpers_test.exs
rename to test/pleroma/web/rich_media/helpers_test.exs
index 4b97bd66b..4c9ee77d0 100644
--- a/test/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
diff --git a/test/web/rich_media/aws_signed_url_test.exs b/test/pleroma/web/rich_media/parser/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/parser/ttl/aws_signed_url_test.exs
index 1ceae1a31..2f17bebd7 100644
--- a/test/web/rich_media/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.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
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/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 97%
rename from test/web/static_fe/static_fe_controller_test.exs
rename to test/pleroma/web/static_fe/static_fe_controller_test.exs
index 1598bf675..f819a1e52 100644
--- a/test/web/static_fe/static_fe_controller_test.exs
+++ b/test/pleroma/web/static_fe/static_fe_controller_test.exs
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.StaticFE.StaticFEControllerTest do
use Pleroma.Web.ConnCase
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/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
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