aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/web')
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub.ex37
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub_controller.ex9
-rw-r--r--lib/pleroma/web/activity_pub/mrf/keyword_policy.ex73
-rw-r--r--lib/pleroma/web/activity_pub/relay.ex4
-rw-r--r--lib/pleroma/web/activity_pub/transmogrifier.ex2
-rw-r--r--lib/pleroma/web/activity_pub/utils.ex22
-rw-r--r--lib/pleroma/web/activity_pub/views/object_view.ex3
-rw-r--r--lib/pleroma/web/activity_pub/views/user_view.ex10
-rw-r--r--lib/pleroma/web/common_api/common_api.ex5
-rw-r--r--lib/pleroma/web/common_api/utils.ex9
-rw-r--r--lib/pleroma/web/federator/federator.ex11
-rw-r--r--lib/pleroma/web/http_signatures/http_signatures.ex3
-rw-r--r--lib/pleroma/web/mastodon_api/mastodon_api_controller.ex160
-rw-r--r--lib/pleroma/web/mastodon_api/views/account_view.ex5
-rw-r--r--lib/pleroma/web/mastodon_api/views/filter_view.ex2
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex8
-rw-r--r--lib/pleroma/web/mastodon_api/websocket_handler.ex3
-rw-r--r--lib/pleroma/web/media_proxy/controller.ex5
-rw-r--r--lib/pleroma/web/media_proxy/media_proxy.ex2
-rw-r--r--lib/pleroma/web/metadata/opengraph.ex6
-rw-r--r--lib/pleroma/web/nodeinfo/nodeinfo_controller.ex39
-rw-r--r--lib/pleroma/web/oauth/app.ex2
-rw-r--r--lib/pleroma/web/oauth/authorization.ex9
-rw-r--r--lib/pleroma/web/oauth/oauth_controller.ex8
-rw-r--r--lib/pleroma/web/oauth/token.ex7
-rw-r--r--lib/pleroma/web/ostatus/activity_representer.ex5
-rw-r--r--lib/pleroma/web/ostatus/feed_representer.ex5
-rw-r--r--lib/pleroma/web/ostatus/handlers/follow_handler.ex3
-rw-r--r--lib/pleroma/web/ostatus/handlers/note_handler.ex6
-rw-r--r--lib/pleroma/web/ostatus/handlers/unfollow_handler.ex3
-rw-r--r--lib/pleroma/web/ostatus/ostatus.ex14
-rw-r--r--lib/pleroma/web/ostatus/ostatus_controller.ex16
-rw-r--r--lib/pleroma/web/push/push.ex3
-rw-r--r--lib/pleroma/web/push/subscription.ex5
-rw-r--r--lib/pleroma/web/rich_media/helpers.ex4
-rw-r--r--lib/pleroma/web/salmon/salmon.ex4
-rw-r--r--lib/pleroma/web/streamer.ex6
-rw-r--r--lib/pleroma/web/twitter_api/controllers/util_controller.ex11
-rw-r--r--lib/pleroma/web/twitter_api/representers/activity_representer.ex10
-rw-r--r--lib/pleroma/web/twitter_api/twitter_api.ex21
-rw-r--r--lib/pleroma/web/twitter_api/twitter_api_controller.ex21
-rw-r--r--lib/pleroma/web/twitter_api/views/activity_view.ex17
-rw-r--r--lib/pleroma/web/twitter_api/views/notification_view.ex5
-rw-r--r--lib/pleroma/web/twitter_api/views/user_view.ex26
-rw-r--r--lib/pleroma/web/uploader_controller.ex2
-rw-r--r--lib/pleroma/web/web.ex9
-rw-r--r--lib/pleroma/web/web_finger/web_finger.ex7
-rw-r--r--lib/pleroma/web/websub/websub.ex10
-rw-r--r--lib/pleroma/web/websub/websub_controller.ex6
49 files changed, 451 insertions, 212 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
index 464d39c04..501c8b845 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -3,13 +3,22 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.ActivityPub do
- alias Pleroma.{Activity, Repo, Object, Upload, User, Notification, Instances}
- alias Pleroma.Web.ActivityPub.{Transmogrifier, MRF}
+ alias Pleroma.Activity
+ alias Pleroma.Repo
+ alias Pleroma.Object
+ alias Pleroma.Upload
+ alias Pleroma.User
+ alias Pleroma.Notification
+ alias Pleroma.Instances
+ alias Pleroma.Web.ActivityPub.Transmogrifier
+ alias Pleroma.Web.ActivityPub.MRF
alias Pleroma.Web.WebFinger
alias Pleroma.Web.Federator
alias Pleroma.Web.OStatus
+
import Ecto.Query
import Pleroma.Web.ActivityPub.Utils
+
require Logger
@httpoison Application.get_env(:pleroma, :httpoison)
@@ -19,19 +28,19 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
defp get_recipients(%{"type" => "Announce"} = data) do
to = data["to"] || []
cc = data["cc"] || []
- recipients = to ++ cc
actor = User.get_cached_by_ap_id(data["actor"])
- recipients
- |> Enum.filter(fn recipient ->
- case User.get_cached_by_ap_id(recipient) do
- nil ->
- true
-
- user ->
- User.following?(user, actor)
- end
- end)
+ recipients =
+ (to ++ cc)
+ |> Enum.filter(fn recipient ->
+ case User.get_cached_by_ap_id(recipient) do
+ nil ->
+ true
+
+ user ->
+ User.following?(user, actor)
+ end
+ end)
{recipients, to, cc}
end
@@ -119,7 +128,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
activity.data["object"]
|> Map.get("tag", [])
|> Enum.filter(fn tag -> is_bitstring(tag) end)
- |> Enum.map(fn tag -> Pleroma.Web.Streamer.stream("hashtag:" <> tag, activity) end)
+ |> Enum.each(fn tag -> Pleroma.Web.Streamer.stream("hashtag:" <> tag, activity) end)
if activity.data["object"]["attachment"] != [] do
Pleroma.Web.Streamer.stream("public:media", activity)
diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex
index afc01398f..2bea51311 100644
--- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex
@@ -5,12 +5,15 @@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
use Pleroma.Web, :controller
- alias Pleroma.{Activity, User, Object}
- alias Pleroma.Web.ActivityPub.{ObjectView, UserView}
+ alias Pleroma.Activity
+ alias Pleroma.User
+ alias Pleroma.Object
+ alias Pleroma.Web.ActivityPub.ObjectView
+ alias Pleroma.Web.ActivityPub.UserView
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Relay
- alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.ActivityPub.Transmogrifier
+ alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.Federator
require Logger
diff --git a/lib/pleroma/web/activity_pub/mrf/keyword_policy.ex b/lib/pleroma/web/activity_pub/mrf/keyword_policy.ex
new file mode 100644
index 000000000..ce6d2e529
--- /dev/null
+++ b/lib/pleroma/web/activity_pub/mrf/keyword_policy.ex
@@ -0,0 +1,73 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Web.ActivityPub.MRF.KeywordPolicy do
+ @behaviour Pleroma.Web.ActivityPub.MRF
+ defp string_matches?(string, pattern) when is_binary(pattern) do
+ String.contains?(string, pattern)
+ end
+
+ defp string_matches?(string, pattern) do
+ String.match?(string, pattern)
+ end
+
+ defp check_reject(%{"object" => %{"content" => content}} = message) do
+ if Enum.any?(Pleroma.Config.get([:mrf_keyword, :reject]), fn pattern ->
+ string_matches?(content, pattern)
+ end) do
+ {:reject, nil}
+ else
+ {:ok, message}
+ end
+ end
+
+ defp check_ftl_removal(%{"to" => to, "object" => %{"content" => content}} = message) do
+ if "https://www.w3.org/ns/activitystreams#Public" in to and
+ Enum.any?(Pleroma.Config.get([:mrf_keyword, :federated_timeline_removal]), fn pattern ->
+ string_matches?(content, pattern)
+ end) do
+ to = List.delete(to, "https://www.w3.org/ns/activitystreams#Public")
+ cc = ["https://www.w3.org/ns/activitystreams#Public" | message["cc"] || []]
+
+ message =
+ message
+ |> Map.put("to", to)
+ |> Map.put("cc", cc)
+
+ {:ok, message}
+ else
+ {:ok, message}
+ end
+ end
+
+ defp check_replace(%{"object" => %{"content" => content}} = message) do
+ content =
+ Enum.reduce(Pleroma.Config.get([:mrf_keyword, :replace]), content, fn {pattern, replacement},
+ acc ->
+ String.replace(acc, pattern, replacement)
+ end)
+
+ {:ok, put_in(message["object"]["content"], content)}
+ end
+
+ @impl true
+ def filter(%{"object" => %{"content" => nil}} = message) do
+ {:ok, message}
+ end
+
+ @impl true
+ def filter(%{"type" => "Create", "object" => %{"content" => _content}} = message) do
+ with {:ok, message} <- check_reject(message),
+ {:ok, message} <- check_ftl_removal(message),
+ {:ok, message} <- check_replace(message) do
+ {:ok, message}
+ else
+ _e ->
+ {:reject, nil}
+ end
+ end
+
+ @impl true
+ def filter(message), do: {:ok, message}
+end
diff --git a/lib/pleroma/web/activity_pub/relay.ex b/lib/pleroma/web/activity_pub/relay.ex
index c0a52e349..c496063ea 100644
--- a/lib/pleroma/web/activity_pub/relay.ex
+++ b/lib/pleroma/web/activity_pub/relay.ex
@@ -3,7 +3,9 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.Relay do
- alias Pleroma.{User, Object, Activity}
+ alias Pleroma.User
+ alias Pleroma.Object
+ alias Pleroma.Activity
alias Pleroma.Web.ActivityPub.ActivityPub
require Logger
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
index 7151efdeb..98a2af819 100644
--- a/lib/pleroma/web/activity_pub/transmogrifier.ex
+++ b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -6,9 +6,9 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
@moduledoc """
A module to handle coding from internal to wire ActivityPub and back.
"""
+ alias Pleroma.Activity
alias Pleroma.User
alias Pleroma.Object
- alias Pleroma.Activity
alias Pleroma.Repo
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Utils
diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex
index 83086dcec..e34dd1d41 100644
--- a/lib/pleroma/web/activity_pub/utils.ex
+++ b/lib/pleroma/web/activity_pub/utils.ex
@@ -3,11 +3,19 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.Utils do
- alias Pleroma.{Repo, Web, Object, Activity, User, Notification}
+ alias Pleroma.Repo
+ alias Pleroma.Web
+ alias Pleroma.Object
+ alias Pleroma.Activity
+ alias Pleroma.User
+ alias Pleroma.Notification
alias Pleroma.Web.Router.Helpers
alias Pleroma.Web.Endpoint
- alias Ecto.{Changeset, UUID}
+ alias Ecto.Changeset
+ alias Ecto.UUID
+
import Ecto.Query
+
require Logger
@supported_object_types ["Article", "Note", "Video", "Page"]
@@ -134,14 +142,8 @@ defmodule Pleroma.Web.ActivityPub.Utils do
context = context || generate_id("contexts")
changeset = Object.context_mapping(context)
- case Repo.insert(changeset) do
- {:ok, object} ->
- object
-
- # This should be solved by an upsert, but it seems ecto
- # has problems accessing the constraint inside the jsonb.
- {:error, _} ->
- Object.get_cached_by_ap_id(context)
+ with {:ok, object} <- Object.insert_or_get(changeset) do
+ object
end
end
diff --git a/lib/pleroma/web/activity_pub/views/object_view.ex b/lib/pleroma/web/activity_pub/views/object_view.ex
index 394d82fbc..84fa94e32 100644
--- a/lib/pleroma/web/activity_pub/views/object_view.ex
+++ b/lib/pleroma/web/activity_pub/views/object_view.ex
@@ -4,7 +4,8 @@
defmodule Pleroma.Web.ActivityPub.ObjectView do
use Pleroma.Web, :view
- alias Pleroma.{Object, Activity}
+ alias Pleroma.Activity
+ alias Pleroma.Object
alias Pleroma.Web.ActivityPub.Transmogrifier
def render("object.json", %{object: %Object{} = object}) do
diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex
index b9588bee5..15e6c1f68 100644
--- a/lib/pleroma/web/activity_pub/views/user_view.ex
+++ b/lib/pleroma/web/activity_pub/views/user_view.ex
@@ -4,13 +4,15 @@
defmodule Pleroma.Web.ActivityPub.UserView do
use Pleroma.Web, :view
- alias Pleroma.Web.Salmon
+
alias Pleroma.Web.WebFinger
+ alias Pleroma.Web.Salmon
alias Pleroma.User
alias Pleroma.Repo
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Transmogrifier
alias Pleroma.Web.ActivityPub.Utils
+
import Ecto.Query
# the instance itself is not a Person, but instead an Application
@@ -86,7 +88,7 @@ defmodule Pleroma.Web.ActivityPub.UserView do
query = from(user in query, select: [:ap_id])
following = Repo.all(query)
- collection(following, "#{user.ap_id}/following", page, !user.info.hide_followings)
+ collection(following, "#{user.ap_id}/following", page, !user.info.hide_follows)
|> Map.merge(Utils.make_json_ld_header())
end
@@ -99,7 +101,7 @@ defmodule Pleroma.Web.ActivityPub.UserView do
"id" => "#{user.ap_id}/following",
"type" => "OrderedCollection",
"totalItems" => length(following),
- "first" => collection(following, "#{user.ap_id}/following", 1, !user.info.hide_followings)
+ "first" => collection(following, "#{user.ap_id}/following", 1, !user.info.hide_follows)
}
|> Map.merge(Utils.make_json_ld_header())
end
@@ -239,6 +241,8 @@ defmodule Pleroma.Web.ActivityPub.UserView do
if offset < total do
Map.put(map, "next", "#{iri}?page=#{page + 1}")
+ else
+ map
end
end
end
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex
index 7084da6de..c0d6fb5c4 100644
--- a/lib/pleroma/web/common_api/common_api.ex
+++ b/lib/pleroma/web/common_api/common_api.ex
@@ -3,7 +3,10 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.CommonAPI do
- alias Pleroma.{User, Repo, Activity, Object}
+ alias Pleroma.User
+ alias Pleroma.Repo
+ alias Pleroma.Activity
+ alias Pleroma.Object
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Formatter
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex
index 208677bd7..123107b56 100644
--- a/lib/pleroma/web/common_api/utils.ex
+++ b/lib/pleroma/web/common_api/utils.ex
@@ -5,12 +5,15 @@
defmodule Pleroma.Web.CommonAPI.Utils do
alias Calendar.Strftime
alias Comeonin.Pbkdf2
- alias Pleroma.{Activity, Formatter, Object, Repo}
+ alias Pleroma.Activity
+ alias Pleroma.Formatter
+ alias Pleroma.Object
+ alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Web
- alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.Endpoint
alias Pleroma.Web.MediaProxy
+ alias Pleroma.Web.ActivityPub.Utils
# This is a hack for twidere.
def get_by_id_or_ap_id(id) do
@@ -95,7 +98,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
def make_context(%Activity{data: %{"context" => context}}), do: context
def make_context(_), do: Utils.generate_context_id()
- def maybe_add_attachments(text, _attachments, _no_links = true), do: text
+ def maybe_add_attachments(text, _attachments, true = _no_links), do: text
def maybe_add_attachments(text, attachments, _no_links) do
add_attachments(text, attachments)
diff --git a/lib/pleroma/web/federator/federator.ex b/lib/pleroma/web/federator/federator.ex
index 37100c9e6..7df75aca6 100644
--- a/lib/pleroma/web/federator/federator.ex
+++ b/lib/pleroma/web/federator/federator.ex
@@ -3,16 +3,19 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Federator do
- alias Pleroma.User
alias Pleroma.Activity
- alias Pleroma.Jobs
- alias Pleroma.Web.{WebFinger, Websub, Salmon}
- alias Pleroma.Web.Federator.RetryQueue
+ alias Pleroma.User
+ alias Pleroma.Web.WebFinger
+ alias Pleroma.Web.Websub
+ alias Pleroma.Web.Salmon
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Relay
alias Pleroma.Web.ActivityPub.Transmogrifier
alias Pleroma.Web.ActivityPub.Utils
+ alias Pleroma.Web.Federator.RetryQueue
alias Pleroma.Web.OStatus
+ alias Pleroma.Jobs
+
require Logger
@websub Application.get_env(:pleroma, :websub)
diff --git a/lib/pleroma/web/http_signatures/http_signatures.ex b/lib/pleroma/web/http_signatures/http_signatures.ex
index e81f9e27a..8e2e2a44b 100644
--- a/lib/pleroma/web/http_signatures/http_signatures.ex
+++ b/lib/pleroma/web/http_signatures/http_signatures.ex
@@ -5,8 +5,9 @@
# https://tools.ietf.org/html/draft-cavage-http-signatures-08
defmodule Pleroma.Web.HTTPSignatures do
alias Pleroma.User
- alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.ActivityPub.ActivityPub
+ alias Pleroma.Web.ActivityPub.Utils
+
require Logger
def split_signature(sig) do
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
index 85769c3d7..06f870393 100644
--- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
@@ -4,34 +4,44 @@
defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
use Pleroma.Web, :controller
- alias Pleroma.{Repo, Object, Activity, User, Notification, Stats}
+ alias Pleroma.Activity
+ alias Pleroma.Config
+ alias Pleroma.Filter
+ alias Pleroma.Notification
+ alias Pleroma.Object
+ alias Pleroma.Repo
+ alias Pleroma.Stats
+ alias Pleroma.User
alias Pleroma.Web
-
- alias Pleroma.Web.MastodonAPI.{
- StatusView,
- AccountView,
- MastodonView,
- ListView,
- FilterView,
- PushSubscriptionView
- }
-
- alias Pleroma.Web.ActivityPub.ActivityPub
- alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.CommonAPI
- alias Pleroma.Web.OAuth.{Authorization, Token, App}
alias Pleroma.Web.MediaProxy
+ alias Pleroma.Web.Push
+ alias Push.Subscription
+
+ alias Pleroma.Web.MastodonAPI.AccountView
+ alias Pleroma.Web.MastodonAPI.FilterView
+ alias Pleroma.Web.MastodonAPI.ListView
+ alias Pleroma.Web.MastodonAPI.MastodonView
+ alias Pleroma.Web.MastodonAPI.PushSubscriptionView
+ alias Pleroma.Web.MastodonAPI.StatusView
+ alias Pleroma.Web.ActivityPub.ActivityPub
+ alias Pleroma.Web.ActivityPub.Utils
+ alias Pleroma.Web.OAuth.App
+ alias Pleroma.Web.OAuth.Authorization
+ alias Pleroma.Web.OAuth.Token
import Ecto.Query
require Logger
@httpoison Application.get_env(:pleroma, :httpoison)
+ @local_mastodon_name "Mastodon-Local"
action_fallback(:errors)
def create_app(conn, params) do
- with cs <- App.register_changeset(%App{}, params) |> IO.inspect(),
- {:ok, app} <- Repo.insert(cs) |> IO.inspect() do
+ with cs <- App.register_changeset(%App{}, params),
+ false <- cs.changes[:client_name] == @local_mastodon_name,
+ {:ok, app} <- Repo.insert(cs) do
res = %{
id: app.id |> to_string,
name: app.client_name,
@@ -129,7 +139,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
@mastodon_api_level "2.5.0"
def masto_instance(conn, _params) do
- instance = Pleroma.Config.get(:instance)
+ instance = Config.get(:instance)
response = %{
uri: Web.base_url(),
@@ -225,7 +235,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|> Map.put("user", user)
activities =
- ActivityPub.fetch_activities([user.ap_id | user.following], params)
+ [user.ap_id | user.following]
+ |> ActivityPub.fetch_activities(params)
|> ActivityPub.contain_timeline(user)
|> Enum.reverse()
@@ -238,14 +249,12 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
def public_timeline(%{assigns: %{user: user}} = conn, params) do
local_only = params["local"] in [true, "True", "true", "1"]
- params =
+ activities =
params
|> Map.put("type", ["Create", "Announce"])
|> Map.put("local_only", local_only)
|> Map.put("blocking_user", user)
-
- activities =
- ActivityPub.fetch_public_activities(params)
+ |> ActivityPub.fetch_public_activities()
|> Enum.reverse()
conn
@@ -314,6 +323,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
as: :activity
)
|> Enum.reverse(),
+ # credo:disable-for-previous-line Credo.Check.Refactor.PipeChainStart
descendants:
StatusView.render(
"index.json",
@@ -322,6 +332,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
as: :activity
)
|> Enum.reverse()
+ # credo:disable-for-previous-line Credo.Check.Refactor.PipeChainStart
}
json(conn, result)
@@ -449,9 +460,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
notifications = Notification.for_user(user, params)
result =
- Enum.map(notifications, fn x ->
- render_notification(user, x)
- end)
+ notifications
+ |> Enum.map(fn x -> render_notification(user, x) end)
|> Enum.filter(& &1)
conn
@@ -580,7 +590,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
[]
|> Enum.map(&String.downcase(&1))
- query_params =
+ activities =
params
|> Map.put("type", "Create")
|> Map.put("local_only", local_only)
@@ -588,9 +598,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|> Map.put("tag", tags)
|> Map.put("tag_all", tag_all)
|> Map.put("tag_reject", tag_reject)
-
- activities =
- ActivityPub.fetch_public_activities(query_params)
+ |> ActivityPub.fetch_public_activities()
|> Enum.reverse()
conn
@@ -621,7 +629,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
followers =
cond do
for_user && user.id == for_user.id -> followers
- user.info.hide_followings -> []
+ user.info.hide_follows -> []
true -> followers
end
@@ -690,7 +698,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
{:ok, _activity} <- ActivityPub.follow(follower, followed),
{:ok, follower, followed} <-
User.wait_and_refresh(
- Pleroma.Config.get([:activitypub, :follow_handshake_timeout]),
+ Config.get([:activitypub, :follow_handshake_timeout]),
follower,
followed
) do
@@ -819,7 +827,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
tags_path = Web.base_url() <> "/tag/"
tags =
- String.split(query)
+ query
+ |> String.split()
|> Enum.uniq()
|> Enum.filter(fn tag -> String.starts_with?(tag, "#") end)
|> Enum.map(fn tag -> String.slice(tag, 1..-1) end)
@@ -841,7 +850,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
statuses = status_search(user, query)
tags =
- String.split(query)
+ query
+ |> String.split()
|> Enum.uniq()
|> Enum.filter(fn tag -> String.starts_with?(tag, "#") end)
|> Enum.map(fn tag -> String.slice(tag, 1..-1) end)
@@ -865,14 +875,12 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
end
def favourites(%{assigns: %{user: user}} = conn, params) do
- params =
+ activities =
params
|> Map.put("type", "Create")
|> Map.put("favorited_by", user.ap_id)
|> Map.put("blocking_user", user)
-
- activities =
- ActivityPub.fetch_public_activities(params)
+ |> ActivityPub.fetch_public_activities()
|> Enum.reverse()
conn
@@ -988,12 +996,10 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
# we must filter the following list for the user to avoid leaking statuses the user
# does not actually have permission to see (for more info, peruse security issue #270).
- following_to =
+ activities =
following
|> Enum.filter(fn x -> x in user.following end)
-
- activities =
- ActivityPub.fetch_activities_bounded(following_to, following, params)
+ |> ActivityPub.fetch_activities_bounded(following, params)
|> Enum.reverse()
conn
@@ -1015,7 +1021,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
if user && token do
mastodon_emoji = mastodonized_emoji()
- limit = Pleroma.Config.get([:instance, :limit])
+ limit = Config.get([:instance, :limit])
accounts =
Map.put(%{}, user.id, AccountView.render("account.json", %{user: user, for: user}))
@@ -1039,8 +1045,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
max_toot_chars: limit
},
rights: %{
- delete_others_notice: !!user.info.is_moderator,
- admin: !!user.info.is_admin
+ delete_others_notice: present?(user.info.is_moderator),
+ admin: present?(user.info.is_admin)
},
compose: %{
me: "#{user.id}",
@@ -1154,16 +1160,13 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
end
defp get_or_make_app() do
- with %App{} = app <- Repo.get_by(App, client_name: "Mastodon-Local") do
+ find_attrs = %{client_name: @local_mastodon_name, redirect_uris: "."}
+
+ with %App{} = app <- Repo.get_by(App, find_attrs) do
{:ok, app}
else
_e ->
- cs =
- App.register_changeset(%App{}, %{
- client_name: "Mastodon-Local",
- redirect_uris: ".",
- scopes: "read,write,follow"
- })
+ cs = App.register_changeset(%App{}, Map.put(find_attrs, :scopes, "read,write,follow"))
Repo.insert(cs)
end
@@ -1235,7 +1238,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
end
def get_filters(%{assigns: %{user: user}} = conn, _) do
- filters = Pleroma.Filter.get_filters(user)
+ filters = Filter.get_filters(user)
res = FilterView.render("filters.json", filters: filters)
json(conn, res)
end
@@ -1244,7 +1247,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
%{assigns: %{user: user}} = conn,
%{"phrase" => phrase, "context" => context} = params
) do
- query = %Pleroma.Filter{
+ query = %Filter{
user_id: user.id,
phrase: phrase,
context: context,
@@ -1253,13 +1256,13 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
# expires_at
}
- {:ok, response} = Pleroma.Filter.create(query)
+ {:ok, response} = Filter.create(query)
res = FilterView.render("filter.json", filter: response)
json(conn, res)
end
def get_filter(%{assigns: %{user: user}} = conn, %{"id" => filter_id}) do
- filter = Pleroma.Filter.get(filter_id, user)
+ filter = Filter.get(filter_id, user)
res = FilterView.render("filter.json", filter: filter)
json(conn, res)
end
@@ -1268,7 +1271,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
%{assigns: %{user: user}} = conn,
%{"phrase" => phrase, "context" => context, "id" => filter_id} = params
) do
- query = %Pleroma.Filter{
+ query = %Filter{
user_id: user.id,
filter_id: filter_id,
phrase: phrase,
@@ -1278,32 +1281,32 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
# expires_at
}
- {:ok, response} = Pleroma.Filter.update(query)
+ {:ok, response} = Filter.update(query)
res = FilterView.render("filter.json", filter: response)
json(conn, res)
end
def delete_filter(%{assigns: %{user: user}} = conn, %{"id" => filter_id}) do
- query = %Pleroma.Filter{
+ query = %Filter{
user_id: user.id,
filter_id: filter_id
}
- {:ok, _} = Pleroma.Filter.delete(query)
+ {:ok, _} = Filter.delete(query)
json(conn, %{})
end
def create_push_subscription(%{assigns: %{user: user, token: token}} = conn, params) do
- true = Pleroma.Web.Push.enabled()
- Pleroma.Web.Push.Subscription.delete_if_exists(user, token)
- {:ok, subscription} = Pleroma.Web.Push.Subscription.create(user, token, params)
+ true = Push.enabled()
+ Subscription.delete_if_exists(user, token)
+ {:ok, subscription} = Subscription.create(user, token, params)
view = PushSubscriptionView.render("push_subscription.json", subscription: subscription)
json(conn, view)
end
def get_push_subscription(%{assigns: %{user: user, token: token}} = conn, _params) do
- true = Pleroma.Web.Push.enabled()
- subscription = Pleroma.Web.Push.Subscription.get(user, token)
+ true = Push.enabled()
+ subscription = Subscription.get(user, token)
view = PushSubscriptionView.render("push_subscription.json", subscription: subscription)
json(conn, view)
end
@@ -1312,15 +1315,15 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
%{assigns: %{user: user, token: token}} = conn,
params
) do
- true = Pleroma.Web.Push.enabled()
- {:ok, subscription} = Pleroma.Web.Push.Subscription.update(user, token, params)
+ true = Push.enabled()
+ {:ok, subscription} = Subscription.update(user, token, params)
view = PushSubscriptionView.render("push_subscription.json", subscription: subscription)
json(conn, view)
end
def delete_push_subscription(%{assigns: %{user: user, token: token}} = conn, _params) do
- true = Pleroma.Web.Push.enabled()
- {:ok, _response} = Pleroma.Web.Push.Subscription.delete(user, token)
+ true = Push.enabled()
+ {:ok, _response} = Subscription.delete(user, token)
json(conn, %{})
end
@@ -1331,17 +1334,21 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
end
def suggestions(%{assigns: %{user: user}} = conn, _) do
- suggestions = Pleroma.Config.get(:suggestions)
+ suggestions = Config.get(:suggestions)
if Keyword.get(suggestions, :enabled, false) do
api = Keyword.get(suggestions, :third_party_engine, "")
timeout = Keyword.get(suggestions, :timeout, 5000)
limit = Keyword.get(suggestions, :limit, 23)
- host = Pleroma.Config.get([Pleroma.Web.Endpoint, :url, :host])
+ host = Config.get([Pleroma.Web.Endpoint, :url, :host])
user = user.nickname
- url = String.replace(api, "{{host}}", host) |> String.replace("{{user}}", user)
+
+ url =
+ api
+ |> String.replace("{{host}}", host)
+ |> String.replace("{{user}}", user)
with {:ok, %{status: 200, body: body}} <-
@httpoison.get(
@@ -1354,8 +1361,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
]
),
{:ok, data} <- Jason.decode(body) do
- data2 =
- Enum.slice(data, 0, limit)
+ data =
+ data
+ |> Enum.slice(0, limit)
|> Enum.map(fn x ->
Map.put(
x,
@@ -1374,7 +1382,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
end)
conn
- |> json(data2)
+ |> json(data)
else
e -> Logger.error("Could not retrieve suggestions at fetch #{url}, #{inspect(e)}")
end
@@ -1417,4 +1425,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|> put_status(501)
|> json(%{error: "Can't display this activity"})
end
+
+ defp present?(nil), do: false
+ defp present?(false), do: false
+ defp present?(_), do: true
end
diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex
index 0ba4289da..9df9f14b2 100644
--- a/lib/pleroma/web/mastodon_api/views/account_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/account_view.ex
@@ -4,11 +4,12 @@
defmodule Pleroma.Web.MastodonAPI.AccountView do
use Pleroma.Web, :view
+
+ alias Pleroma.HTML
alias Pleroma.User
- alias Pleroma.Web.MastodonAPI.AccountView
alias Pleroma.Web.CommonAPI.Utils
+ alias Pleroma.Web.MastodonAPI.AccountView
alias Pleroma.Web.MediaProxy
- alias Pleroma.HTML
def render("accounts.json", %{users: users} = opts) do
users
diff --git a/lib/pleroma/web/mastodon_api/views/filter_view.ex b/lib/pleroma/web/mastodon_api/views/filter_view.ex
index 1052a449d..a685bc7b6 100644
--- a/lib/pleroma/web/mastodon_api/views/filter_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/filter_view.ex
@@ -4,8 +4,8 @@
defmodule Pleroma.Web.MastodonAPI.FilterView do
use Pleroma.Web, :view
- alias Pleroma.Web.MastodonAPI.FilterView
alias Pleroma.Web.CommonAPI.Utils
+ alias Pleroma.Web.MastodonAPI.FilterView
def render("filters.json", %{filters: filters} = opts) do
render_many(filters, FilterView, "filter.json", opts)
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index c0e289ef8..f51a2ebb0 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -10,9 +10,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Web.CommonAPI.Utils
- alias Pleroma.Web.MediaProxy
alias Pleroma.Web.MastodonAPI.AccountView
alias Pleroma.Web.MastodonAPI.StatusView
+ alias Pleroma.Web.MediaProxy
# TODO: Add cached version.
defp get_replied_to_activities(activities) do
@@ -182,11 +182,13 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
end
def render("card.json", %{rich_media: rich_media, page_url: page_url}) do
+ page_url_data = URI.parse(page_url)
+
page_url_data =
if rich_media[:url] != nil do
- URI.merge(URI.parse(page_url), URI.parse(rich_media[:url]))
+ URI.merge(page_url_data, URI.parse(rich_media[:url]))
else
- page_url
+ page_url_data
end
page_url = page_url_data |> to_string
diff --git a/lib/pleroma/web/mastodon_api/websocket_handler.ex b/lib/pleroma/web/mastodon_api/websocket_handler.ex
index c0254c8e6..ea75070c4 100644
--- a/lib/pleroma/web/mastodon_api/websocket_handler.ex
+++ b/lib/pleroma/web/mastodon_api/websocket_handler.ex
@@ -6,7 +6,8 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do
require Logger
alias Pleroma.Web.OAuth.Token
- alias Pleroma.{User, Repo}
+ alias Pleroma.Repo
+ alias Pleroma.User
@behaviour :cowboy_websocket_handler
diff --git a/lib/pleroma/web/media_proxy/controller.ex b/lib/pleroma/web/media_proxy/controller.ex
index de79cad73..c0552d89f 100644
--- a/lib/pleroma/web/media_proxy/controller.ex
+++ b/lib/pleroma/web/media_proxy/controller.ex
@@ -4,11 +4,12 @@
defmodule Pleroma.Web.MediaProxy.MediaProxyController do
use Pleroma.Web, :controller
- alias Pleroma.{Web.MediaProxy, ReverseProxy}
+ alias Pleroma.ReverseProxy
+ alias Pleroma.Web.MediaProxy
@default_proxy_opts [max_body_length: 25 * 1_048_576, http: [follow_redirect: true]]
- def remote(conn, params = %{"sig" => sig64, "url" => url64}) do
+ def remote(conn, %{"sig" => sig64, "url" => url64} = params) do
with config <- Pleroma.Config.get([:media_proxy], []),
true <- Keyword.get(config, :enabled, false),
{:ok, url} <- MediaProxy.decode_url(sig64, url64),
diff --git a/lib/pleroma/web/media_proxy/media_proxy.ex b/lib/pleroma/web/media_proxy/media_proxy.ex
index e1eb1472d..1e9da7283 100644
--- a/lib/pleroma/web/media_proxy/media_proxy.ex
+++ b/lib/pleroma/web/media_proxy/media_proxy.ex
@@ -9,7 +9,7 @@ defmodule Pleroma.Web.MediaProxy do
def url(""), do: nil
- def url(url = "/" <> _), do: url
+ def url("/" <> _ = url), do: url
def url(url) do
config = Application.get_env(:pleroma, :media_proxy, [])
diff --git a/lib/pleroma/web/metadata/opengraph.ex b/lib/pleroma/web/metadata/opengraph.ex
index 30333785e..190377767 100644
--- a/lib/pleroma/web/metadata/opengraph.ex
+++ b/lib/pleroma/web/metadata/opengraph.ex
@@ -3,10 +3,12 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Metadata.Providers.OpenGraph do
- alias Pleroma.Web.Metadata.Providers.Provider
+ alias Pleroma.HTML
+ alias Pleroma.Formatter
+ alias Pleroma.User
alias Pleroma.Web.Metadata
- alias Pleroma.{HTML, Formatter, User}
alias Pleroma.Web.MediaProxy
+ alias Pleroma.Web.Metadata.Providers.Provider
@behaviour Provider
diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex
index 21694a5ee..f4867d05b 100644
--- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex
+++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex
@@ -5,10 +5,11 @@
defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
use Pleroma.Web, :controller
+ alias Pleroma.Config
+ alias Pleroma.Repo
alias Pleroma.Stats
+ alias Pleroma.User
alias Pleroma.Web
- alias Pleroma.{User, Repo}
- alias Pleroma.Config
alias Pleroma.Web.ActivityPub.MRF
plug(Pleroma.Web.FederatingPlug)
@@ -32,7 +33,7 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
# returns a nodeinfo 2.0 map, since 2.1 just adds a repository field
# under software.
- def raw_nodeinfo() do
+ def raw_nodeinfo do
instance = Application.get_env(:pleroma, :instance)
media_proxy = Application.get_env(:pleroma, :media_proxy)
suggestions = Application.get_env(:pleroma, :suggestions)
@@ -44,6 +45,33 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
Application.get_env(:pleroma, :mrf_simple)
|> Enum.into(%{})
+ # This horror is needed to convert regex sigils to strings
+ mrf_keyword =
+ Application.get_env(:pleroma, :mrf_keyword, [])
+ |> Enum.map(fn {key, value} ->
+ {key,
+ Enum.map(value, fn
+ {pattern, replacement} ->
+ %{
+ "pattern" =>
+ if not is_binary(pattern) do
+ inspect(pattern)
+ else
+ pattern
+ end,
+ "replacement" => replacement
+ }
+
+ pattern ->
+ if not is_binary(pattern) do
+ inspect(pattern)
+ else
+ pattern
+ end
+ end)}
+ end)
+ |> Enum.into(%{})
+
mrf_policies =
MRF.get_policies()
|> Enum.map(fn policy -> to_string(policy) |> String.split(".") |> List.last() end)
@@ -66,13 +94,12 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
Config.get([:mrf_user_allowlist], [])
|> Enum.into(%{}, fn {k, v} -> {k, length(v)} end)
- mrf_transparency = Keyword.get(instance, :mrf_transparency)
-
federation_response =
- if mrf_transparency do
+ if Keyword.get(instance, :mrf_transparency) do
%{
mrf_policies: mrf_policies,
mrf_simple: mrf_simple,
+ mrf_keyword: mrf_keyword,
mrf_user_allowlist: mrf_user_allowlist,
quarantined_instances: quarantined
}
diff --git a/lib/pleroma/web/oauth/app.ex b/lib/pleroma/web/oauth/app.ex
index 967ac04b5..3e8acde31 100644
--- a/lib/pleroma/web/oauth/app.ex
+++ b/lib/pleroma/web/oauth/app.ex
@@ -4,7 +4,7 @@
defmodule Pleroma.Web.OAuth.App do
use Ecto.Schema
- import Ecto.{Changeset}
+ import Ecto.Changeset
schema "apps" do
field(:client_name, :string)
diff --git a/lib/pleroma/web/oauth/authorization.ex b/lib/pleroma/web/oauth/authorization.ex
index f8c65602d..75c9ab9aa 100644
--- a/lib/pleroma/web/oauth/authorization.ex
+++ b/lib/pleroma/web/oauth/authorization.ex
@@ -5,10 +5,13 @@
defmodule Pleroma.Web.OAuth.Authorization do
use Ecto.Schema
- alias Pleroma.{User, Repo}
- alias Pleroma.Web.OAuth.{Authorization, App}
+ alias Pleroma.User
+ alias Pleroma.Repo
+ alias Pleroma.Web.OAuth.Authorization
+ alias Pleroma.Web.OAuth.App
- import Ecto.{Changeset, Query}
+ import Ecto.Changeset
+ import Ecto.Query
schema "oauth_authorizations" do
field(:token, :string)
diff --git a/lib/pleroma/web/oauth/oauth_controller.ex b/lib/pleroma/web/oauth/oauth_controller.ex
index 4d4e85836..e4d0601f8 100644
--- a/lib/pleroma/web/oauth/oauth_controller.ex
+++ b/lib/pleroma/web/oauth/oauth_controller.ex
@@ -5,8 +5,11 @@
defmodule Pleroma.Web.OAuth.OAuthController do
use Pleroma.Web, :controller
- alias Pleroma.Web.OAuth.{Authorization, Token, App}
- alias Pleroma.{Repo, User}
+ alias Pleroma.Web.OAuth.Authorization
+ alias Pleroma.Web.OAuth.Token
+ alias Pleroma.Web.OAuth.App
+ alias Pleroma.Repo
+ alias Pleroma.User
alias Comeonin.Pbkdf2
plug(:fetch_session)
@@ -37,6 +40,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do
true <- Pbkdf2.checkpw(password, user.password_hash),
{:auth_active, true} <- {:auth_active, User.auth_active?(user)},
%App{} = app <- Repo.get_by(App, client_id: client_id),
+ true <- redirect_uri in String.split(app.redirect_uris),
{:ok, auth} <- Authorization.create_authorization(app, user) do
# Special case: Local MastodonFE.
redirect_uri =
diff --git a/lib/pleroma/web/oauth/token.ex b/lib/pleroma/web/oauth/token.ex
index 4e01b123b..b0bbeeb69 100644
--- a/lib/pleroma/web/oauth/token.ex
+++ b/lib/pleroma/web/oauth/token.ex
@@ -7,8 +7,11 @@ defmodule Pleroma.Web.OAuth.Token do
import Ecto.Query
- alias Pleroma.{User, Repo}
- alias Pleroma.Web.OAuth.{Token, App, Authorization}
+ alias Pleroma.User
+ alias Pleroma.Repo
+ alias Pleroma.Web.OAuth.Token
+ alias Pleroma.Web.OAuth.App
+ alias Pleroma.Web.OAuth.Authorization
schema "oauth_tokens" do
field(:token, :string)
diff --git a/lib/pleroma/web/ostatus/activity_representer.ex b/lib/pleroma/web/ostatus/activity_representer.ex
index 3d41fc708..9e1f24bc4 100644
--- a/lib/pleroma/web/ostatus/activity_representer.ex
+++ b/lib/pleroma/web/ostatus/activity_representer.ex
@@ -3,8 +3,11 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OStatus.ActivityRepresenter do
- alias Pleroma.{Activity, User, Object}
+ alias Pleroma.Activity
+ alias Pleroma.User
+ alias Pleroma.Object
alias Pleroma.Web.OStatus.UserRepresenter
+
require Logger
defp get_href(id) do
diff --git a/lib/pleroma/web/ostatus/feed_representer.ex b/lib/pleroma/web/ostatus/feed_representer.ex
index 934d4042f..025d4731c 100644
--- a/lib/pleroma/web/ostatus/feed_representer.ex
+++ b/lib/pleroma/web/ostatus/feed_representer.ex
@@ -3,10 +3,11 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OStatus.FeedRepresenter do
- alias Pleroma.Web.OStatus
- alias Pleroma.Web.OStatus.{UserRepresenter, ActivityRepresenter}
alias Pleroma.User
+ alias Pleroma.Web.OStatus
alias Pleroma.Web.MediaProxy
+ alias Pleroma.Web.OStatus.ActivityRepresenter
+ alias Pleroma.Web.OStatus.UserRepresenter
def to_simple_form(user, activities, _users) do
most_recent_update =
diff --git a/lib/pleroma/web/ostatus/handlers/follow_handler.ex b/lib/pleroma/web/ostatus/handlers/follow_handler.ex
index becdf2fbf..91ad4bc40 100644
--- a/lib/pleroma/web/ostatus/handlers/follow_handler.ex
+++ b/lib/pleroma/web/ostatus/handlers/follow_handler.ex
@@ -3,7 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OStatus.FollowHandler do
- alias Pleroma.Web.{XML, OStatus}
+ alias Pleroma.Web.XML
+ alias Pleroma.Web.OStatus
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.User
diff --git a/lib/pleroma/web/ostatus/handlers/note_handler.ex b/lib/pleroma/web/ostatus/handlers/note_handler.ex
index c5b3e8d97..c2e585cac 100644
--- a/lib/pleroma/web/ostatus/handlers/note_handler.ex
+++ b/lib/pleroma/web/ostatus/handlers/note_handler.ex
@@ -4,8 +4,10 @@
defmodule Pleroma.Web.OStatus.NoteHandler do
require Logger
- alias Pleroma.Web.{XML, OStatus}
- alias Pleroma.{Object, Activity}
+ alias Pleroma.Web.OStatus
+ alias Pleroma.Web.XML
+ alias Pleroma.Activity
+ alias Pleroma.Object
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.CommonAPI
diff --git a/lib/pleroma/web/ostatus/handlers/unfollow_handler.ex b/lib/pleroma/web/ostatus/handlers/unfollow_handler.ex
index 1c64f3c3d..c9085894d 100644
--- a/lib/pleroma/web/ostatus/handlers/unfollow_handler.ex
+++ b/lib/pleroma/web/ostatus/handlers/unfollow_handler.ex
@@ -3,7 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OStatus.UnfollowHandler do
- alias Pleroma.Web.{XML, OStatus}
+ alias Pleroma.Web.XML
+ alias Pleroma.Web.OStatus
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.User
diff --git a/lib/pleroma/web/ostatus/ostatus.ex b/lib/pleroma/web/ostatus/ostatus.ex
index a20ca17bb..b4f5761ac 100644
--- a/lib/pleroma/web/ostatus/ostatus.ex
+++ b/lib/pleroma/web/ostatus/ostatus.ex
@@ -9,11 +9,19 @@ defmodule Pleroma.Web.OStatus do
import Pleroma.Web.XML
require Logger
- alias Pleroma.{Repo, User, Web, Object, Activity}
+ alias Pleroma.Repo
+ alias Pleroma.User
+ alias Pleroma.Web
+ alias Pleroma.Object
+ alias Pleroma.Activity
alias Pleroma.Web.ActivityPub.ActivityPub
- alias Pleroma.Web.{WebFinger, Websub}
- alias Pleroma.Web.OStatus.{FollowHandler, UnfollowHandler, NoteHandler, DeleteHandler}
alias Pleroma.Web.ActivityPub.Transmogrifier
+ alias Pleroma.Web.WebFinger
+ alias Pleroma.Web.Websub
+ alias Pleroma.Web.OStatus.FollowHandler
+ alias Pleroma.Web.OStatus.UnfollowHandler
+ alias Pleroma.Web.OStatus.NoteHandler
+ alias Pleroma.Web.OStatus.DeleteHandler
def is_representable?(%Activity{data: data}) do
object = Object.normalize(data["object"])
diff --git a/lib/pleroma/web/ostatus/ostatus_controller.ex b/lib/pleroma/web/ostatus/ostatus_controller.ex
index 9ad3d3bd1..bab3da2b0 100644
--- a/lib/pleroma/web/ostatus/ostatus_controller.ex
+++ b/lib/pleroma/web/ostatus/ostatus_controller.ex
@@ -5,13 +5,17 @@
defmodule Pleroma.Web.OStatus.OStatusController do
use Pleroma.Web, :controller
- alias Pleroma.{User, Activity, Object}
- alias Pleroma.Web.OStatus.{FeedRepresenter, ActivityRepresenter}
- alias Pleroma.Web.{OStatus, Federator}
- alias Pleroma.Web.XML
- alias Pleroma.Web.ActivityPub.ObjectView
- alias Pleroma.Web.ActivityPub.ActivityPubController
+ alias Pleroma.Activity
+ alias Pleroma.Object
+ alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
+ alias Pleroma.Web.ActivityPub.ActivityPubController
+ alias Pleroma.Web.ActivityPub.ObjectView
+ alias Pleroma.Web.OStatus.ActivityRepresenter
+ alias Pleroma.Web.OStatus.FeedRepresenter
+ alias Pleroma.Web.Federator
+ alias Pleroma.Web.OStatus
+ alias Pleroma.Web.XML
plug(Pleroma.Web.FederatingPlug when action in [:salmon_incoming])
diff --git a/lib/pleroma/web/push/push.ex b/lib/pleroma/web/push/push.ex
index ffd2aac91..ddd4fe037 100644
--- a/lib/pleroma/web/push/push.ex
+++ b/lib/pleroma/web/push/push.ex
@@ -5,7 +5,8 @@
defmodule Pleroma.Web.Push do
use GenServer
- alias Pleroma.{Repo, User}
+ alias Pleroma.Repo
+ alias Pleroma.User
alias Pleroma.Web.Push.Subscription
require Logger
diff --git a/lib/pleroma/web/push/subscription.ex b/lib/pleroma/web/push/subscription.ex
index bd9d9f3a7..242e30910 100644
--- a/lib/pleroma/web/push/subscription.ex
+++ b/lib/pleroma/web/push/subscription.ex
@@ -4,8 +4,11 @@
defmodule Pleroma.Web.Push.Subscription do
use Ecto.Schema
+
import Ecto.Changeset
- alias Pleroma.{Repo, User}
+
+ alias Pleroma.Repo
+ alias Pleroma.User
alias Pleroma.Web.OAuth.Token
alias Pleroma.Web.Push.Subscription
diff --git a/lib/pleroma/web/rich_media/helpers.ex b/lib/pleroma/web/rich_media/helpers.ex
index 521fa7ee0..abb1cf7f2 100644
--- a/lib/pleroma/web/rich_media/helpers.ex
+++ b/lib/pleroma/web/rich_media/helpers.ex
@@ -3,7 +3,9 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.RichMedia.Helpers do
- alias Pleroma.{Activity, Object, HTML}
+ alias Pleroma.Activity
+ alias Pleroma.Object
+ alias Pleroma.HTML
alias Pleroma.Web.RichMedia.Parser
def fetch_data_for_activity(%Activity{} = activity) do
diff --git a/lib/pleroma/web/salmon/salmon.ex b/lib/pleroma/web/salmon/salmon.ex
index 3db0c07fd..0a69aa1ec 100644
--- a/lib/pleroma/web/salmon/salmon.ex
+++ b/lib/pleroma/web/salmon/salmon.ex
@@ -6,10 +6,12 @@ defmodule Pleroma.Web.Salmon do
@httpoison Application.get_env(:pleroma, :httpoison)
use Bitwise
+
alias Pleroma.Instances
+ alias Pleroma.User
alias Pleroma.Web.XML
alias Pleroma.Web.OStatus.ActivityRepresenter
- alias Pleroma.User
+
require Logger
def decode(salmon) do
diff --git a/lib/pleroma/web/streamer.ex b/lib/pleroma/web/streamer.ex
index 978c77e57..4de7608e4 100644
--- a/lib/pleroma/web/streamer.ex
+++ b/lib/pleroma/web/streamer.ex
@@ -5,7 +5,11 @@
defmodule Pleroma.Web.Streamer do
use GenServer
require Logger
- alias Pleroma.{User, Notification, Activity, Object, Repo}
+ alias Pleroma.User
+ alias Pleroma.Notification
+ alias Pleroma.Activity
+ alias Pleroma.Object
+ alias Pleroma.Repo
alias Pleroma.Web.ActivityPub.ActivityPub
@keepalive_interval :timer.seconds(30)
diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex
index b347faa71..e2fdedb25 100644
--- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex
+++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex
@@ -4,14 +4,19 @@
defmodule Pleroma.Web.TwitterAPI.UtilController do
use Pleroma.Web, :controller
+
require Logger
+
+ alias Comeonin.Pbkdf2
+ alias Pleroma.Emoji
+ alias Pleroma.PasswordResetToken
+ alias Pleroma.User
+ alias Pleroma.Repo
alias Pleroma.Web
+ alias Pleroma.Web.CommonAPI
alias Pleroma.Web.OStatus
alias Pleroma.Web.WebFinger
- alias Pleroma.Web.CommonAPI
- alias Comeonin.Pbkdf2
alias Pleroma.Web.ActivityPub.ActivityPub
- alias Pleroma.{Repo, PasswordResetToken, User, Emoji}
def show_password_reset(conn, %{"token" => token}) do
with %{used: false} = token <- Repo.get_by(PasswordResetToken, %{token: token}),
diff --git a/lib/pleroma/web/twitter_api/representers/activity_representer.ex b/lib/pleroma/web/twitter_api/representers/activity_representer.ex
index c4025cbd7..192ab7334 100644
--- a/lib/pleroma/web/twitter_api/representers/activity_representer.ex
+++ b/lib/pleroma/web/twitter_api/representers/activity_representer.ex
@@ -2,16 +2,20 @@
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
+# FIXME: Remove this module?
# THIS MODULE IS DEPRECATED! DON'T USE IT!
# USE THE Pleroma.Web.TwitterAPI.Views.ActivityView MODULE!
defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
use Pleroma.Web.TwitterAPI.Representers.BaseRepresenter
alias Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter
- alias Pleroma.{Activity, User}
- alias Pleroma.Web.TwitterAPI.{TwitterAPI, UserView, ActivityView}
- alias Pleroma.Web.CommonAPI.Utils
+ alias Pleroma.Activity
alias Pleroma.Formatter
alias Pleroma.HTML
+ alias Pleroma.User
+ alias Pleroma.Web.TwitterAPI.ActivityView
+ alias Pleroma.Web.TwitterAPI.TwitterAPI
+ alias Pleroma.Web.TwitterAPI.UserView
+ alias Pleroma.Web.CommonAPI.Utils
alias Pleroma.Web.MastodonAPI.StatusView
defp user_by_ap_id(user_list, ap_id) do
diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex
index 7d00c01a1..162beb9be 100644
--- a/lib/pleroma/web/twitter_api/twitter_api.ex
+++ b/lib/pleroma/web/twitter_api/twitter_api.ex
@@ -3,8 +3,13 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
- alias Pleroma.{UserInviteToken, User, Activity, Repo, Object}
- alias Pleroma.{UserEmail, Mailer}
+ alias Pleroma.UserInviteToken
+ alias Pleroma.User
+ alias Pleroma.Activity
+ alias Pleroma.Repo
+ alias Pleroma.Object
+ alias Pleroma.UserEmail
+ alias Pleroma.Mailer
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.TwitterAPI.UserView
alias Pleroma.Web.CommonAPI
@@ -305,16 +310,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
else
_e ->
changeset = Object.context_mapping(context)
-
- case Repo.insert(changeset) do
- {:ok, %{id: id}} ->
- id
-
- # This should be solved by an upsert, but it seems ecto
- # has problems accessing the constraint inside the jsonb.
- {:error, _} ->
- Object.get_cached_by_ap_id(context).id
- end
+ {:ok, object} = Object.insert_or_get(changeset)
+ object.id
end
end
diff --git a/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/twitter_api_controller.ex
index 5e3fe9352..c2f0dc2a9 100644
--- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex
+++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex
@@ -7,12 +7,19 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
import Pleroma.Web.ControllerHelper, only: [json_response: 3]
- alias Pleroma.Web.TwitterAPI.{TwitterAPI, UserView, ActivityView, NotificationView}
- alias Pleroma.Web.CommonAPI
- alias Pleroma.{Repo, Activity, Object, User, Notification}
+ alias Ecto.Changeset
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Utils
- alias Ecto.Changeset
+ alias Pleroma.Web.CommonAPI
+ alias Pleroma.Web.TwitterAPI.ActivityView
+ alias Pleroma.Web.TwitterAPI.NotificationView
+ alias Pleroma.Web.TwitterAPI.TwitterAPI
+ alias Pleroma.Web.TwitterAPI.UserView
+ alias Pleroma.Activity
+ alias Pleroma.Object
+ alias Pleroma.Notification
+ alias Pleroma.Repo
+ alias Pleroma.User
require Logger
@@ -24,7 +31,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
conn
|> put_view(UserView)
- |> render("show.json", %{user: user, token: token})
+ |> render("show.json", %{user: user, token: token, for: user})
end
def status_update(%{assigns: %{user: user}} = conn, %{"status" => _} = status_data) do
@@ -523,7 +530,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
friends =
cond do
for_user && user.id == for_user.id -> friends
- user.info.hide_followings -> []
+ user.info.hide_follows -> []
true -> friends
end
@@ -618,7 +625,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
defp build_info_cng(user, params) do
info_params =
- ["no_rich_text", "locked", "hide_followers", "hide_followings"]
+ ["no_rich_text", "locked", "hide_followers", "hide_follows", "show_role"]
|> Enum.reduce(%{}, fn key, res ->
if value = params[key] do
Map.put(res, key, value == "true")
diff --git a/lib/pleroma/web/twitter_api/views/activity_view.ex b/lib/pleroma/web/twitter_api/views/activity_view.ex
index d0d1221c3..661022afa 100644
--- a/lib/pleroma/web/twitter_api/views/activity_view.ex
+++ b/lib/pleroma/web/twitter_api/views/activity_view.ex
@@ -4,19 +4,18 @@
defmodule Pleroma.Web.TwitterAPI.ActivityView do
use Pleroma.Web, :view
- alias Pleroma.Web.CommonAPI.Utils
- alias Pleroma.User
- alias Pleroma.Web.TwitterAPI.UserView
- alias Pleroma.Web.TwitterAPI.ActivityView
- alias Pleroma.Web.TwitterAPI.TwitterAPI
- alias Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter
- alias Pleroma.Web.MastodonAPI.StatusView
alias Pleroma.Activity
+ alias Pleroma.Formatter
alias Pleroma.HTML
alias Pleroma.Object
- alias Pleroma.User
alias Pleroma.Repo
- alias Pleroma.Formatter
+ alias Pleroma.User
+ alias Pleroma.Web.CommonAPI.Utils
+ alias Pleroma.Web.MastodonAPI.StatusView
+ alias Pleroma.Web.TwitterAPI.ActivityView
+ alias Pleroma.Web.TwitterAPI.TwitterAPI
+ alias Pleroma.Web.TwitterAPI.UserView
+ alias Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter
import Ecto.Query
require Logger
diff --git a/lib/pleroma/web/twitter_api/views/notification_view.ex b/lib/pleroma/web/twitter_api/views/notification_view.ex
index d6a1c0a4d..e7c7a7496 100644
--- a/lib/pleroma/web/twitter_api/views/notification_view.ex
+++ b/lib/pleroma/web/twitter_api/views/notification_view.ex
@@ -4,10 +4,11 @@
defmodule Pleroma.Web.TwitterAPI.NotificationView do
use Pleroma.Web, :view
- alias Pleroma.{Notification, User}
+ alias Pleroma.Notification
+ alias Pleroma.User
alias Pleroma.Web.CommonAPI.Utils
- alias Pleroma.Web.TwitterAPI.UserView
alias Pleroma.Web.TwitterAPI.ActivityView
+ alias Pleroma.Web.TwitterAPI.UserView
defp get_user(ap_id, opts) do
cond do
diff --git a/lib/pleroma/web/twitter_api/views/user_view.ex b/lib/pleroma/web/twitter_api/views/user_view.ex
index cd7c4349c..a09450df7 100644
--- a/lib/pleroma/web/twitter_api/views/user_view.ex
+++ b/lib/pleroma/web/twitter_api/views/user_view.ex
@@ -4,11 +4,11 @@
defmodule Pleroma.Web.TwitterAPI.UserView do
use Pleroma.Web, :view
- alias Pleroma.User
alias Pleroma.Formatter
+ alias Pleroma.HTML
+ alias Pleroma.User
alias Pleroma.Web.CommonAPI.Utils
alias Pleroma.Web.MediaProxy
- alias Pleroma.HTML
def render("show.json", %{user: user = %User{}} = assigns) do
render_one(user, Pleroma.Web.TwitterAPI.UserView, "user.json", assigns)
@@ -109,7 +109,7 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
"default_scope" => user.info.default_scope,
"no_rich_text" => user.info.no_rich_text,
"hide_followers" => user.info.hide_followers,
- "hide_followings" => user.info.hide_followings,
+ "hide_follows" => user.info.hide_follows,
"fields" => fields,
# Pleroma extension
@@ -119,6 +119,12 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
}
}
+ data =
+ if(user.info.is_admin || user.info.is_moderator,
+ do: maybe_with_role(data, user, for_user),
+ else: data
+ )
+
if assigns[:token] do
Map.put(data, "token", token_string(assigns[:token]))
else
@@ -126,6 +132,20 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
end
end
+ defp maybe_with_role(data, %User{id: id} = user, %User{id: id}) do
+ Map.merge(data, %{"role" => role(user), "show_role" => user.info.show_role})
+ end
+
+ defp maybe_with_role(data, %User{info: %{show_role: true}} = user, _user) do
+ Map.merge(data, %{"role" => role(user)})
+ end
+
+ defp maybe_with_role(data, _, _), do: data
+
+ defp role(%User{info: %{:is_admin => true}}), do: "admin"
+ defp role(%User{info: %{:is_moderator => true}}), do: "moderator"
+ defp role(_), do: "member"
+
defp image_url(%{"url" => [%{"href" => href} | _]}), do: href
defp image_url(_), do: nil
diff --git a/lib/pleroma/web/uploader_controller.ex b/lib/pleroma/web/uploader_controller.ex
index 6c28d1197..5d8a77346 100644
--- a/lib/pleroma/web/uploader_controller.ex
+++ b/lib/pleroma/web/uploader_controller.ex
@@ -3,7 +3,7 @@ defmodule Pleroma.Web.UploaderController do
alias Pleroma.Uploaders.Uploader
- def callback(conn, params = %{"upload_path" => upload_path}) do
+ def callback(conn, %{"upload_path" => upload_path} = params) do
process_callback(conn, :global.whereis_name({Uploader, upload_path}), params)
end
diff --git a/lib/pleroma/web/web.ex b/lib/pleroma/web/web.ex
index 30558e692..853aa2a87 100644
--- a/lib/pleroma/web/web.ex
+++ b/lib/pleroma/web/web.ex
@@ -24,7 +24,8 @@ defmodule Pleroma.Web do
quote do
use Phoenix.Controller, namespace: Pleroma.Web
import Plug.Conn
- import Pleroma.Web.{Gettext, Router.Helpers}
+ import Pleroma.Web.Gettext
+ import Pleroma.Web.Router.Helpers
end
end
@@ -37,7 +38,9 @@ defmodule Pleroma.Web do
# Import convenience functions from controllers
import Phoenix.Controller, only: [get_csrf_token: 0, get_flash: 2, view_module: 1]
- import Pleroma.Web.{ErrorHelpers, Gettext, Router.Helpers}
+ import Pleroma.Web.ErrorHelpers
+ import Pleroma.Web.Gettext
+ import Pleroma.Web.Router.Helpers
require Logger
@@ -71,6 +74,7 @@ defmodule Pleroma.Web do
def router do
quote do
use Phoenix.Router
+ # credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
import Plug.Conn
import Phoenix.Controller
end
@@ -78,6 +82,7 @@ defmodule Pleroma.Web do
def channel do
quote do
+ # credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
use Phoenix.Channel
import Pleroma.Web.Gettext
end
diff --git a/lib/pleroma/web/web_finger/web_finger.ex b/lib/pleroma/web/web_finger/web_finger.ex
index 0a6338312..5ea5ae48e 100644
--- a/lib/pleroma/web/web_finger/web_finger.ex
+++ b/lib/pleroma/web/web_finger/web_finger.ex
@@ -5,9 +5,12 @@
defmodule Pleroma.Web.WebFinger do
@httpoison Application.get_env(:pleroma, :httpoison)
- alias Pleroma.{User, XmlBuilder}
+ alias Pleroma.User
+ alias Pleroma.XmlBuilder
alias Pleroma.Web
- alias Pleroma.Web.{XML, Salmon, OStatus}
+ alias Pleroma.Web.XML
+ alias Pleroma.Web.Salmon
+ alias Pleroma.Web.OStatus
require Jason
require Logger
diff --git a/lib/pleroma/web/websub/websub.ex b/lib/pleroma/web/websub/websub.ex
index 82845f13d..c00ec0858 100644
--- a/lib/pleroma/web/websub/websub.ex
+++ b/lib/pleroma/web/websub/websub.ex
@@ -4,12 +4,16 @@
defmodule Pleroma.Web.Websub do
alias Ecto.Changeset
- alias Pleroma.Repo
alias Pleroma.Instances
- alias Pleroma.Web.Websub.{WebsubServerSubscription, WebsubClientSubscription}
+ alias Pleroma.Repo
+ alias Pleroma.Web.Websub.WebsubServerSubscription
+ alias Pleroma.Web.Websub.WebsubClientSubscription
alias Pleroma.Web.OStatus.FeedRepresenter
- alias Pleroma.Web.{XML, Endpoint, OStatus, Federator}
+ alias Pleroma.Web.XML
+ alias Pleroma.Web.Endpoint
+ alias Pleroma.Web.OStatus
alias Pleroma.Web.Router.Helpers
+ alias Pleroma.Web.Federator
require Logger
import Ecto.Query
diff --git a/lib/pleroma/web/websub/websub_controller.ex b/lib/pleroma/web/websub/websub_controller.ex
index 41bbc0369..ad40f1b94 100644
--- a/lib/pleroma/web/websub/websub_controller.ex
+++ b/lib/pleroma/web/websub/websub_controller.ex
@@ -5,8 +5,10 @@
defmodule Pleroma.Web.Websub.WebsubController do
use Pleroma.Web, :controller
- alias Pleroma.{Repo, User}
- alias Pleroma.Web.{Websub, Federator}
+ alias Pleroma.Repo
+ alias Pleroma.User
+ alias Pleroma.Web.Websub
+ alias Pleroma.Web.Federator
alias Pleroma.Web.Websub.WebsubClientSubscription
require Logger