diff options
author | William Pitcock <nenolod@dereferenced.org> | 2018-05-19 05:46:13 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2018-05-19 01:28:12 -0500 |
commit | d1f6ecf607954e725e72b8e91be5f969eebe997f (patch) | |
tree | cc1e5836b337fa644a05ab16593d37658db3490e /lib | |
parent | cce5a9cb1ce0555277d11004bcedc9e7460f4ed8 (diff) | |
download | pleroma-d1f6ecf607954e725e72b8e91be5f969eebe997f.tar.gz |
webfinger: interpret application/ld+json links as an alternate to application/activity+json
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/web_finger/web_finger.ex | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/pleroma/web/web_finger/web_finger.ex b/lib/pleroma/web/web_finger/web_finger.ex index 241dfb4c8..b955bc43f 100644 --- a/lib/pleroma/web/web_finger/web_finger.ex +++ b/lib/pleroma/web/web_finger/web_finger.ex @@ -166,6 +166,14 @@ defmodule Pleroma.Web.WebFinger do doc ) + if ap_id == nil do + ap_id = + XML.string_from_xpath( + ~s{//Link[@rel="self" and @type="application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""]/@href}, + doc + ) + end + data = %{ "magic_key" => magic_key, "topic" => topic, @@ -185,6 +193,9 @@ defmodule Pleroma.Web.WebFinger do {"application/activity+json", "self"} -> Map.put(data, "ap_id", link["href"]) + {"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"", "self"} -> + Map.put(data, "ap_id", link["href"]) + {_, "magic-public-key"} -> "data:application/magic-public-key," <> magic_key = link["href"] Map.put(data, "magic_key", magic_key) |