Fix nodeinfo handling
authorEkaterina Vaartis <vaartis@cock.li>
Tue, 24 Sep 2019 16:38:05 +0000 (19:38 +0300)
committerEkaterina Vaartis <vaartis@cock.li>
Wed, 25 Sep 2019 10:32:19 +0000 (12:32 +0200)
lib/pleroma/web/pleroma_api/controllers/emoji_api_controller.ex
test/web/pleroma_api/emoji_api_controller_test.exs

index cf5a086feece30072b962ab2b1a58ca6e679a060..545ad80c9b88d27beee0ea65d4a7abe50c76b992 100644 (file)
@@ -182,6 +182,7 @@ keeping it in cache for #{div(cache_ms, 1000)}s")
     |> Tesla.get!()
     |> Map.get(:body)
     |> Jason.decode!()
+    |> Map.get("links")
     |> List.last()
     |> Map.get("href")
     # Get the actual nodeinfo address and fetch it
index 166a0201dc844d4d86cf76b4910d0a94fc0b031b..93a507a01e38f67e7e022e55b885a54453f1335f 100644 (file)
@@ -41,7 +41,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiAPIControllerTest do
 
     mock(fn
       %{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
-        json([%{href: "https://example.com/nodeinfo/2.1.json"}])
+        json(%{links: [%{href: "https://example.com/nodeinfo/2.1.json"}]})
 
       %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
         json(%{metadata: %{features: ["shareable_emoji_packs"]}})
@@ -77,13 +77,13 @@ defmodule Pleroma.Web.PleromaAPI.EmojiAPIControllerTest do
 
     mock(fn
       %{method: :get, url: "https://old-instance/.well-known/nodeinfo"} ->
-        json([%{href: "https://old-instance/nodeinfo/2.1.json"}])
+        json(%{links: [%{href: "https://old-instance/nodeinfo/2.1.json"}]})
 
       %{method: :get, url: "https://old-instance/nodeinfo/2.1.json"} ->
         json(%{metadata: %{features: []}})
 
       %{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
-        json([%{href: "https://example.com/nodeinfo/2.1.json"}])
+        json(%{links: [%{href: "https://example.com/nodeinfo/2.1.json"}]})
 
       %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
         json(%{metadata: %{features: ["shareable_emoji_packs"]}})