projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '1501-include-unlisted-posts-in-user-feed' into 'develop'
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
activity_pub_controller.ex
diff --git
a/lib/pleroma/web/activity_pub/activity_pub_controller.ex
b/lib/pleroma/web/activity_pub/activity_pub_controller.ex
index a909516beea6405c302d8a8ed1d2d2ed77e8eb2a..28727d619ea3d9180ecb811cf4ca6f0db2186103 100644
(file)
--- a/
lib/pleroma/web/activity_pub/activity_pub_controller.ex
+++ b/
lib/pleroma/web/activity_pub/activity_pub_controller.ex
@@
-21,6
+21,7
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
alias Pleroma.Web.ActivityPub.UserView
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.ActivityPub.Visibility
alias Pleroma.Web.ActivityPub.UserView
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.ActivityPub.Visibility
+ alias Pleroma.Web.Endpoint
alias Pleroma.Web.FederatingPlug
alias Pleroma.Web.Federator
alias Pleroma.Web.FederatingPlug
alias Pleroma.Web.Federator
@@
-37,9
+38,10
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
[unless_func: &FederatingPlug.federating?/1] when action not in @federating_only_actions
)
[unless_func: &FederatingPlug.federating?/1] when action not in @federating_only_actions
)
+ # Note: :following and :followers must be served even without authentication (as via :api)
plug(
EnsureAuthenticatedPlug
plug(
EnsureAuthenticatedPlug
- when action in [:read_inbox, :update_outbox, :whoami, :upload_media
, :following, :followers
]
+ when action in [:read_inbox, :update_outbox, :whoami, :upload_media]
)
plug(
)
plug(
@@
-74,8
+76,8
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
end
end
end
end
- def object(conn,
%{"uuid" => uuid}
) do
- with ap_id <-
o_status_url(conn, :object, uuid)
,
+ def object(conn,
_
) do
+ with ap_id <-
Endpoint.url() <> conn.request_path
,
%Object{} = object <- Object.get_cached_by_ap_id(ap_id),
{_, true} <- {:public?, Visibility.is_public?(object)} do
conn
%Object{} = object <- Object.get_cached_by_ap_id(ap_id),
{_, true} <- {:public?, Visibility.is_public?(object)} do
conn
@@
-100,8
+102,8
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
conn
end
conn
end
- def activity(conn,
%{"uuid" => uuid}
) do
- with ap_id <-
o_status_url(conn, :activity, uuid)
,
+ def activity(conn,
_params
) do
+ with ap_id <-
Endpoint.url() <> conn.request_path
,
%Activity{} = activity <- Activity.normalize(ap_id),
{_, true} <- {:public?, Visibility.is_public?(activity)} do
conn
%Activity{} = activity <- Activity.normalize(ap_id),
{_, true} <- {:public?, Visibility.is_public?(activity)} do
conn
@@
-395,7
+397,10
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|> json(err)
end
|> json(err)
end
- defp handle_user_activity(%User{} = user, %{"type" => "Create"} = params) do
+ defp handle_user_activity(
+ %User{} = user,
+ %{"type" => "Create", "object" => %{"type" => "Note"}} = params
+ ) do
object =
params["object"]
|> Map.merge(Map.take(params, ["to", "cc"]))
object =
params["object"]
|> Map.merge(Map.take(params, ["to", "cc"]))
@@
-414,7
+419,8
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
defp handle_user_activity(%User{} = user, %{"type" => "Delete"} = params) do
with %Object{} = object <- Object.normalize(params["object"]),
true <- user.is_moderator || user.ap_id == object.data["actor"],
defp handle_user_activity(%User{} = user, %{"type" => "Delete"} = params) do
with %Object{} = object <- Object.normalize(params["object"]),
true <- user.is_moderator || user.ap_id == object.data["actor"],
- {:ok, delete} <- ActivityPub.delete(object) do
+ {:ok, delete_data, _} <- Builder.delete(user, object.data["id"]),
+ {:ok, delete, _} <- Pipeline.common_pipeline(delete_data, local: true) do
{:ok, delete}
else
_ -> {:error, dgettext("errors", "Can't delete object")}
{:ok, delete}
else
_ -> {:error, dgettext("errors", "Can't delete object")}