From 83cd7f2b5f269adf53b66b851fcea187cb914e28 Mon Sep 17 00:00:00 2001 From: FiveYellowMice Date: Fri, 18 Dec 2020 13:48:38 +0000 Subject: [PATCH 1/3] WebFinger: add subscribe_address in return data of JSON responses --- lib/pleroma/web/web_finger.ex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/pleroma/web/web_finger.ex b/lib/pleroma/web/web_finger.ex index 6629f5356..ca200588a 100644 --- a/lib/pleroma/web/web_finger.ex +++ b/lib/pleroma/web/web_finger.ex @@ -116,6 +116,9 @@ defmodule Pleroma.Web.WebFinger do {"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"", "self"} -> Map.put(data, "ap_id", link["href"]) + {nil, "http://ostatus.org/schema/1.0/subscribe"} -> + Map.put(data, "subscribe_address", link["template"]) + _ -> Logger.debug("Unhandled type: #{inspect(link["type"])}") data From 509f82e4d626bcaea0535bc5be28b5e5d067a37b Mon Sep 17 00:00:00 2001 From: Kaizhe Huang Date: Sat, 19 Dec 2020 22:11:47 +1100 Subject: [PATCH 2/3] Add test for subscribe_address in JSON WebFinger response --- test/pleroma/web/web_finger_test.exs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/pleroma/web/web_finger_test.exs b/test/pleroma/web/web_finger_test.exs index 96fc0bbaa..19f33a975 100644 --- a/test/pleroma/web/web_finger_test.exs +++ b/test/pleroma/web/web_finger_test.exs @@ -56,12 +56,13 @@ defmodule Pleroma.Web.WebFingerTest do {:ok, _data} = WebFinger.finger(user) end - test "returns the ActivityPub actor URI for an ActivityPub user with the ld+json mimetype" do + test "returns the ActivityPub actor URI and subscribe address for an ActivityPub user with the ld+json mimetype" do user = "kaniini@gerzilla.de" {:ok, data} = WebFinger.finger(user) assert data["ap_id"] == "https://gerzilla.de/channel/kaniini" + assert data["subscribe_address"] == "https://gerzilla.de/follow?f=&url={uri}" end test "it work for AP-only user" do From fb02241580e095a7481c2e8e7ff0e5f6dc535c72 Mon Sep 17 00:00:00 2001 From: Kaizhe Huang Date: Mon, 21 Dec 2020 00:54:15 +1100 Subject: [PATCH 3/3] Fix trailing whitespaces in lib/pleroma/web/web_finger.ex --- lib/pleroma/web/web_finger.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/web_finger.ex b/lib/pleroma/web/web_finger.ex index ca200588a..2e39ae048 100644 --- a/lib/pleroma/web/web_finger.ex +++ b/lib/pleroma/web/web_finger.ex @@ -116,7 +116,7 @@ defmodule Pleroma.Web.WebFinger do {"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"", "self"} -> Map.put(data, "ap_id", link["href"]) - {nil, "http://ostatus.org/schema/1.0/subscribe"} -> + {nil, "http://ostatus.org/schema/1.0/subscribe"} -> Map.put(data, "subscribe_address", link["template"]) _ ->