logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 8e1f32e71560c4b36ccbdc3ecf8de8386928305a
parent 19be32a74e758baf7eb8c738ba0f11de7cb7eb6e
Author: lain <lain@soykaf.club>
Date:   Mon, 21 Dec 2020 17:13:52 +0000

Merge branch 'develop' into 'develop'

WebFinger: add subscribe_address in return data of JSON responses

See merge request pleroma/pleroma!3206

Diffstat:

Mlib/pleroma/web/web_finger.ex3+++
Mtest/pleroma/web/web_finger_test.exs3++-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git 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 diff --git 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