relay: move to /relay endpoint from / due to webapp issues

This commit is contained in:
William Pitcock 2018-08-06 08:13:05 +00:00
parent 2b628f2341
commit e49131bb72
2 changed files with 11 additions and 6 deletions

View File

@ -638,16 +638,18 @@ def get_or_fetch_by_ap_id(ap_id) do
end
def get_or_create_instance_user do
if user = get_by_ap_id(Pleroma.Web.Endpoint.url()) do
relay_uri = "#{Pleroma.Web.Endpoint.url()}/relay"
if user = get_by_ap_id(relay_uri) do
user
else
changes =
%User{}
|> cast(%{}, [:ap_id, :nickname, :local])
|> put_change(:ap_id, Pleroma.Web.Endpoint.url())
|> put_change(:ap_id, relay_uri)
|> put_change(:nickname, nil)
|> put_change(:local, true)
|> put_change(:follower_address, Pleroma.Web.Endpoint.url() <> "/relay/followers")
|> put_change(:follower_address, relay_uri <> "/followers")
{:ok, user} = Repo.insert(changes)
user

View File

@ -283,6 +283,10 @@ def user_fetcher(username) do
get("/externalprofile/show", TwitterAPI.Controller, :external_profile)
end
pipeline :ap_relay do
plug(:accepts, ["activity+json"])
end
pipeline :ostatus do
plug(:accepts, ["xml", "atom", "html", "activity+json"])
end
@ -319,9 +323,8 @@ def user_fetcher(username) do
end
if @federating do
scope "/", Pleroma.Web.ActivityPub do
# XXX: not really ostatus either
pipe_through(:ostatus)
scope "/relay", Pleroma.Web.ActivityPub do
pipe_through(:ap_relay)
get("/", ActivityPubController, :relay)
end