activitypub: refactor relay concerns into new relay module
This commit is contained in:
parent
00e890264c
commit
b7ca7f282a
|
@ -3,6 +3,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
alias Pleroma.{User, Object}
|
alias Pleroma.{User, Object}
|
||||||
alias Pleroma.Web.ActivityPub.{ObjectView, UserView}
|
alias Pleroma.Web.ActivityPub.{ObjectView, UserView}
|
||||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||||
|
alias Pleroma.Web.ActivityPub.Relay
|
||||||
alias Pleroma.Web.Federator
|
alias Pleroma.Web.Federator
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
@ -108,7 +109,7 @@ def inbox(conn, params) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def relay(conn, params) do
|
def relay(conn, params) do
|
||||||
with %User{} = user <- User.get_or_create_instance_user(),
|
with %User{} = user <- Relay.get_actor(),
|
||||||
{:ok, user} <- Pleroma.Web.WebFinger.ensure_keys_present(user) do
|
{:ok, user} <- Pleroma.Web.WebFinger.ensure_keys_present(user) do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_header("content-type", "application/activity+json")
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
defmodule Pleroma.Web.ActivityPub.Relay do
|
||||||
|
alias Pleroma.User
|
||||||
|
|
||||||
|
def get_actor do
|
||||||
|
User.get_or_create_instance_user()
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue