webfinger: interpret application/ld+json links as an alternate to application/activity+json
This commit is contained in:
parent
cce5a9cb1c
commit
d1f6ecf607
1 changed files with 11 additions and 0 deletions
|
@ -166,6 +166,14 @@ defp webfinger_from_xml(doc) do
|
||||||
doc
|
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 = %{
|
data = %{
|
||||||
"magic_key" => magic_key,
|
"magic_key" => magic_key,
|
||||||
"topic" => topic,
|
"topic" => topic,
|
||||||
|
@ -185,6 +193,9 @@ defp webfinger_from_json(doc) do
|
||||||
{"application/activity+json", "self"} ->
|
{"application/activity+json", "self"} ->
|
||||||
Map.put(data, "ap_id", link["href"])
|
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"} ->
|
{_, "magic-public-key"} ->
|
||||||
"data:application/magic-public-key," <> magic_key = link["href"]
|
"data:application/magic-public-key," <> magic_key = link["href"]
|
||||||
Map.put(data, "magic_key", magic_key)
|
Map.put(data, "magic_key", magic_key)
|
||||||
|
|
Loading…
Reference in a new issue