From e49131bb7212ba5d1b79fc20c83223325a2e98c4 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 6 Aug 2018 08:13:05 +0000 Subject: [PATCH] relay: move to /relay endpoint from / due to webapp issues --- lib/pleroma/user.ex | 8 +++++--- lib/pleroma/web/router.ex | 9 ++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 327eb3ea3..8d8c53dfc 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -638,16 +638,18 @@ defmodule Pleroma.User 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 diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 3cb996262..48c3fb9a5 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -283,6 +283,10 @@ defmodule Pleroma.Web.Router 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 @@ defmodule Pleroma.Web.Router 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 -- 2.45.2