forked from AkkomaGang/akkoma
Fix nodeinfo handling
This commit is contained in:
parent
ba9d35a904
commit
118d6dcdf4
2 changed files with 4 additions and 3 deletions
|
@ -182,6 +182,7 @@ defp shareable_packs_available(address) do
|
||||||
|> 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 @@ test "listing remote packs" 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 @@ test "downloading shared & unshared packs from another instance via download_fro
|
||||||
|
|
||||||
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 a new issue