webfinger: expose the application/ld+json link alongside the older application/activi...
[akkoma] / lib / pleroma / web / web_finger / web_finger.ex
index 9fe3b2ca17f58727fb81631b6bd740f903108146..241dfb4c8f84bfca356dccdf28d046d8bb332397 100644 (file)
@@ -86,6 +86,7 @@ defmodule Pleroma.Web.WebFinger do
           "href" => "data:application/magic-public-key,#{magic_key}"
         },
         %{"rel" => "self", "type" => "application/activity+json", "href" => user.ap_id},
+        %{"rel" => "self", "type" => "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"", "href" => user.ap_id},
         %{
           "rel" => "http://ostatus.org/schema/1.0/subscribe",
           "template" => OStatus.remote_follow_path()
@@ -117,6 +118,7 @@ defmodule Pleroma.Web.WebFinger do
         {:Link,
          %{rel: "magic-public-key", href: "data:application/magic-public-key,#{magic_key}"}},
         {:Link, %{rel: "self", type: "application/activity+json", href: user.ap_id}},
+        {:Link, %{rel: "self", type: "application/ld+json; profile="https://www.w3.org/ns/activitystreams"", href: user.ap_id}},
         {:Link,
          %{rel: "http://ostatus.org/schema/1.0/subscribe", template: OStatus.remote_follow_path()}}
       ]
@@ -239,13 +241,14 @@ defmodule Pleroma.Web.WebFinger do
           URI.parse(account).host
       end
 
-    case find_lrdd_template(domain) do
-      {:ok, template} ->
-        address = String.replace(template, "{uri}", URI.encode(account))
+    address =
+      case find_lrdd_template(domain) do
+        {:ok, template} ->
+          String.replace(template, "{uri}", URI.encode(account))
 
-      _ ->
-        address = "http://#{domain}/.well-known/webfinger?resource=acct:#{account}"
-    end
+        _ ->
+          "http://#{domain}/.well-known/webfinger?resource=acct:#{account}"
+      end
 
     with response <-
            @httpoison.get(