|
|
|
@ -430,6 +430,36 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def handle_incoming(
|
|
|
|
|
%{"type" => "Listen", "object" => %{"type" => "Audio"} = object} = data,
|
|
|
|
|
options
|
|
|
|
|
) do
|
|
|
|
|
actor = Containment.get_actor(data)
|
|
|
|
|
|
|
|
|
|
data =
|
|
|
|
|
Map.put(data, "actor", actor)
|
|
|
|
|
|> fix_addressing
|
|
|
|
|
|
|
|
|
|
with {:ok, %User{} = user} <- User.get_or_fetch_by_ap_id(data["actor"]) do
|
|
|
|
|
options = Keyword.put(options, :depth, (options[:depth] || 0) + 1)
|
|
|
|
|
object = fix_object(object, options)
|
|
|
|
|
|
|
|
|
|
params = %{
|
|
|
|
|
to: data["to"],
|
|
|
|
|
object: object,
|
|
|
|
|
actor: user,
|
|
|
|
|
context: nil,
|
|
|
|
|
local: false,
|
|
|
|
|
published: data["published"],
|
|
|
|
|
additional: Map.take(data, ["cc", "id"])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ActivityPub.listen(params)
|
|
|
|
|
else
|
|
|
|
|
_e -> :error
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def handle_incoming(
|
|
|
|
|
%{"type" => "Follow", "object" => followed, "actor" => follower, "id" => id} = data,
|
|
|
|
|
_options
|
|
|
|
@ -765,7 +795,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|
|
|
|
# internal -> Mastodon
|
|
|
|
|
# """
|
|
|
|
|
|
|
|
|
|
def prepare_outgoing(%{"type" => "Create", "object" => object_id} = data) do
|
|
|
|
|
def prepare_outgoing(%{"type" => activity_type, "object" => object_id} = data)
|
|
|
|
|
when activity_type in ["Create", "Listen"] do
|
|
|
|
|
object =
|
|
|
|
|
object_id
|
|
|
|
|
|> Object.normalize()
|
|
|
|
|