Fix nodeinfo handling
This commit is contained in:
parent
ba9d35a904
commit
118d6dcdf4
@ -182,6 +182,7 @@ keeping it in cache for #{div(cache_ms, 1000)}s")
|
|||||||
|> Tesla.get!()
|
|> Tesla.get!()
|
||||||
|> Map.get(:body)
|
|> Map.get(:body)
|
||||||
|> Jason.decode!()
|
|> Jason.decode!()
|
||||||
|
|> Map.get("links")
|
||||||
|> List.last()
|
|> List.last()
|
||||||
|> Map.get("href")
|
|> Map.get("href")
|
||||||
# Get the actual nodeinfo address and fetch it
|
# Get the actual nodeinfo address and fetch it
|
||||||
|
@ -41,7 +41,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiAPIControllerTest do
|
|||||||
|
|
||||||
mock(fn
|
mock(fn
|
||||||
%{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
|
%{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"} ->
|
%{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
|
||||||
json(%{metadata: %{features: ["shareable_emoji_packs"]}})
|
json(%{metadata: %{features: ["shareable_emoji_packs"]}})
|
||||||
@ -77,13 +77,13 @@ defmodule Pleroma.Web.PleromaAPI.EmojiAPIControllerTest do
|
|||||||
|
|
||||||
mock(fn
|
mock(fn
|
||||||
%{method: :get, url: "https://old-instance/.well-known/nodeinfo"} ->
|
%{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"} ->
|
%{method: :get, url: "https://old-instance/nodeinfo/2.1.json"} ->
|
||||||
json(%{metadata: %{features: []}})
|
json(%{metadata: %{features: []}})
|
||||||
|
|
||||||
%{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
|
%{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"} ->
|
%{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
|
||||||
json(%{metadata: %{features: ["shareable_emoji_packs"]}})
|
json(%{metadata: %{features: ["shareable_emoji_packs"]}})
|
||||||
|
Loading…
Reference in New Issue
Block a user