relay: move to /relay endpoint from / due to webapp issues
This commit is contained in:
parent
2b628f2341
commit
e49131bb72
|
@ -638,16 +638,18 @@ def get_or_fetch_by_ap_id(ap_id) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_or_create_instance_user do
|
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
|
user
|
||||||
else
|
else
|
||||||
changes =
|
changes =
|
||||||
%User{}
|
%User{}
|
||||||
|> cast(%{}, [:ap_id, :nickname, :local])
|
|> 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(:nickname, nil)
|
||||||
|> put_change(:local, true)
|
|> 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)
|
{:ok, user} = Repo.insert(changes)
|
||||||
user
|
user
|
||||||
|
|
|
@ -283,6 +283,10 @@ def user_fetcher(username) do
|
||||||
get("/externalprofile/show", TwitterAPI.Controller, :external_profile)
|
get("/externalprofile/show", TwitterAPI.Controller, :external_profile)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
pipeline :ap_relay do
|
||||||
|
plug(:accepts, ["activity+json"])
|
||||||
|
end
|
||||||
|
|
||||||
pipeline :ostatus do
|
pipeline :ostatus do
|
||||||
plug(:accepts, ["xml", "atom", "html", "activity+json"])
|
plug(:accepts, ["xml", "atom", "html", "activity+json"])
|
||||||
end
|
end
|
||||||
|
@ -319,9 +323,8 @@ def user_fetcher(username) do
|
||||||
end
|
end
|
||||||
|
|
||||||
if @federating do
|
if @federating do
|
||||||
scope "/", Pleroma.Web.ActivityPub do
|
scope "/relay", Pleroma.Web.ActivityPub do
|
||||||
# XXX: not really ostatus either
|
pipe_through(:ap_relay)
|
||||||
pipe_through(:ostatus)
|
|
||||||
get("/", ActivityPubController, :relay)
|
get("/", ActivityPubController, :relay)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue