From f944f8157ac078aef5edda64059a5d6d3837bf53 Mon Sep 17 00:00:00 2001 From: hakabahitoyo Date: Sat, 14 Jul 2018 00:21:38 +0900 Subject: /api/v1/suggestions endpoint --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 5 +++++ lib/pleroma/web/router.ex | 2 ++ 2 files changed, 7 insertions(+) (limited to 'lib') diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 09e6b0b59..0184d52c8 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1070,4 +1070,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do |> put_status(500) |> json("Something went wrong") end + + def suggestions(conn, _) do + conn + |> json("SUGGESTIONS!") + end end diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 34652cdde..f1c08c681 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -140,6 +140,8 @@ defmodule Pleroma.Web.Router do get("/domain_blocks", MastodonAPIController, :domain_blocks) post("/domain_blocks", MastodonAPIController, :block_domain) delete("/domain_blocks", MastodonAPIController, :unblock_domain) + + get("/suggestions", MastodonAPIController, :suggestions) end scope "/api/web", Pleroma.Web.MastodonAPI do -- cgit v1.2.3 From 4a21c1b343c3f62d78da1651ed490daf4dde5d97 Mon Sep 17 00:00:00 2001 From: hakabahitoyo Date: Sat, 14 Jul 2018 00:44:18 +0900 Subject: mock /api/v1/suggestions --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 0184d52c8..0f50eba84 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1071,8 +1071,12 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do |> json("Something went wrong") end - def suggestions(conn, _) do + def suggestions(%{assigns: %{user: user}} = conn, _) do + res = %{ + host: (String.replace Web.base_url(), "https://", ""), + user: user.nickname + } conn - |> json("SUGGESTIONS!") + |> json(res) end end -- cgit v1.2.3 From 3812b627ca546287e20a55cd49544a36eefffa0b Mon Sep 17 00:00:00 2001 From: hakabahitoyo Date: Sat, 14 Jul 2018 00:52:23 +0900 Subject: better mock /api/v1/suggestions --- .../web/mastodon_api/mastodon_api_controller.ex | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 0f50eba84..fb334352d 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1072,10 +1072,20 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do end def suggestions(%{assigns: %{user: user}} = conn, _) do - res = %{ - host: (String.replace Web.base_url(), "https://", ""), - user: user.nickname - } + res = [ + %{ + username: "vaginaplant", + acct: "vaginaplant@3.distsn.org", + display_name: "Hakaba Hitoyo", + note: "Recommendation Fairness Warrior", + avatar: "https://3.distsn.org/media/1c0cbe9d-8b87-496f-b964-1af8116b8f67/D38B0A8B021DC5565D06CF40EBB744E4B7CF8F7F16347094F9CD469348DCC267.jpeg", + avatar_static: "https://3.distsn.org/media/1c0cbe9d-8b87-496f-b964-1af8116b8f67/D38B0A8B021DC5565D06CF40EBB744E4B7CF8F7F16347094F9CD469348DCC267.jpeg" + }, + %{ + username: user.nickname, + acct: user.nickname <> "@" <> (String.replace Web.base_url(), "https://", "") + } + ] conn |> json(res) end -- cgit v1.2.3 From eb0afda3a72aa08a991e25b05c98ae798655f413 Mon Sep 17 00:00:00 2001 From: hakabahitoyo Date: Sat, 14 Jul 2018 10:04:37 +0900 Subject: http access to third party user recommendation --- .../web/mastodon_api/mastodon_api_controller.ex | 30 ++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index fb334352d..4f48a141b 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -11,6 +11,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do import Ecto.Query require Logger + @httpoison Application.get_env(:pleroma, :httpoison) + action_fallback(:errors) def create_app(conn, params) do @@ -1072,21 +1074,17 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do end def suggestions(%{assigns: %{user: user}} = conn, _) do - res = [ - %{ - username: "vaginaplant", - acct: "vaginaplant@3.distsn.org", - display_name: "Hakaba Hitoyo", - note: "Recommendation Fairness Warrior", - avatar: "https://3.distsn.org/media/1c0cbe9d-8b87-496f-b964-1af8116b8f67/D38B0A8B021DC5565D06CF40EBB744E4B7CF8F7F16347094F9CD469348DCC267.jpeg", - avatar_static: "https://3.distsn.org/media/1c0cbe9d-8b87-496f-b964-1af8116b8f67/D38B0A8B021DC5565D06CF40EBB744E4B7CF8F7F16347094F9CD469348DCC267.jpeg" - }, - %{ - username: user.nickname, - acct: user.nickname <> "@" <> (String.replace Web.base_url(), "https://", "") - } - ] - conn - |> json(res) + host = String.replace Web.base_url(), "https://", "" + user = user.nickname + api = "http://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-filtered-api.cgi?{{host}}+{{user}}" + url = String.replace(api, "{{host}}", host) |> String.replace("{{user}}", user) + with {:ok, %{status_code: 200, body: body}} <- + @httpoison.get(url), + {:ok, data} <- Jason.decode(body) do + conn + |> json(data) + else + e -> Logger.error("Could not decode user at fetch #{url}, #{inspect(e)}") + end end end -- cgit v1.2.3 From 127882a5d51d8243eae44ad7ed73bf6010804760 Mon Sep 17 00:00:00 2001 From: hakabahitoyo Date: Sat, 14 Jul 2018 11:41:09 +0900 Subject: configurable --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 4f48a141b..fd60db3d6 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1073,10 +1073,12 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do |> json("Something went wrong") end + @suggestions Application.get_env(:pleroma, :suggestions) + def suggestions(%{assigns: %{user: user}} = conn, _) do host = String.replace Web.base_url(), "https://", "" user = user.nickname - api = "http://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-filtered-api.cgi?{{host}}+{{user}}" + api = Keyword.get(@suggestions, :third_party_engine, "") url = String.replace(api, "{{host}}", host) |> String.replace("{{user}}", user) with {:ok, %{status_code: 200, body: body}} <- @httpoison.get(url), -- cgit v1.2.3 From 2eeaf01627efb2a13d73f4cde764d3cb1fef3e98 Mon Sep 17 00:00:00 2001 From: hakabahitoyo Date: Sat, 14 Jul 2018 14:03:30 +0900 Subject: id field --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index fd60db3d6..d87a6cb19 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1081,10 +1081,13 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do api = Keyword.get(@suggestions, :third_party_engine, "") url = String.replace(api, "{{host}}", host) |> String.replace("{{user}}", user) with {:ok, %{status_code: 200, body: body}} <- - @httpoison.get(url), + @httpoison.get(url, [], [timeout: 300000, recv_timeout: 300000]), {:ok, data} <- Jason.decode(body) do + data2 = Enum.slice(data, 0, 40) |> Enum.map(fn(x) -> + Map.put(x, "id", User.get_or_fetch(x["acct"]).id) + end) conn - |> json(data) + |> json(data2) else e -> Logger.error("Could not decode user at fetch #{url}, #{inspect(e)}") end -- cgit v1.2.3 From e7c580828c109247de11624bae8c7286b02441e5 Mon Sep 17 00:00:00 2001 From: hakabahitoyo Date: Sun, 15 Jul 2018 20:36:26 +0900 Subject: format --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index d87a6cb19..e397b911d 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1076,16 +1076,20 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do @suggestions Application.get_env(:pleroma, :suggestions) def suggestions(%{assigns: %{user: user}} = conn, _) do - host = String.replace Web.base_url(), "https://", "" + host = String.replace(Web.base_url(), "https://", "") user = user.nickname api = Keyword.get(@suggestions, :third_party_engine, "") url = String.replace(api, "{{host}}", host) |> String.replace("{{user}}", user) + with {:ok, %{status_code: 200, body: body}} <- - @httpoison.get(url, [], [timeout: 300000, recv_timeout: 300000]), + @httpoison.get(url, [], timeout: 300_000, recv_timeout: 300_000), {:ok, data} <- Jason.decode(body) do - data2 = Enum.slice(data, 0, 40) |> Enum.map(fn(x) -> - Map.put(x, "id", User.get_or_fetch(x["acct"]).id) - end) + data2 = + Enum.slice(data, 0, 40) + |> Enum.map(fn x -> + Map.put(x, "id", User.get_or_fetch(x["acct"]).id) + end) + conn |> json(data2) else -- cgit v1.2.3 From df3233e7e798563afe4b5a937b0bdd13e101973b Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Tue, 17 Jul 2018 13:20:58 +0900 Subject: improve getting host name --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index e397b911d..2f8139fe6 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1076,7 +1076,11 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do @suggestions Application.get_env(:pleroma, :suggestions) def suggestions(%{assigns: %{user: user}} = conn, _) do - host = String.replace(Web.base_url(), "https://", "") + host = + Application.get_env(:pleroma, Pleroma.Web.Endpoint) + |> Keyword.get(:url) + |> Keyword.get(:host) + user = user.nickname api = Keyword.get(@suggestions, :third_party_engine, "") url = String.replace(api, "{{host}}", host) |> String.replace("{{user}}", user) -- cgit v1.2.3 From d76f0d87bebd655bcbc4259a47a4ee8fd4f00887 Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Tue, 17 Jul 2018 16:45:18 +0900 Subject: do nothing if configuration is skipped --- .../web/mastodon_api/mastodon_api_controller.ex | 45 ++++++++++++---------- 1 file changed, 25 insertions(+), 20 deletions(-) (limited to 'lib') diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 2f8139fe6..ac8f794e9 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1076,28 +1076,33 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do @suggestions Application.get_env(:pleroma, :suggestions) def suggestions(%{assigns: %{user: user}} = conn, _) do - host = - Application.get_env(:pleroma, Pleroma.Web.Endpoint) - |> Keyword.get(:url) - |> Keyword.get(:host) - - user = user.nickname - api = Keyword.get(@suggestions, :third_party_engine, "") - url = String.replace(api, "{{host}}", host) |> String.replace("{{user}}", user) - - with {:ok, %{status_code: 200, body: body}} <- - @httpoison.get(url, [], timeout: 300_000, recv_timeout: 300_000), - {:ok, data} <- Jason.decode(body) do - data2 = - Enum.slice(data, 0, 40) - |> Enum.map(fn x -> - Map.put(x, "id", User.get_or_fetch(x["acct"]).id) - end) + api = Keyword.get(@suggestions, :third_party_engine, false) + + if api do + host = + Application.get_env(:pleroma, Pleroma.Web.Endpoint) + |> Keyword.get(:url) + |> Keyword.get(:host) + + user = user.nickname + url = String.replace(api, "{{host}}", host) |> String.replace("{{user}}", user) + + with {:ok, %{status_code: 200, body: body}} <- + @httpoison.get(url, [], timeout: 300_000, recv_timeout: 300_000), + {:ok, data} <- Jason.decode(body) do + data2 = + Enum.slice(data, 0, 40) + |> Enum.map(fn x -> + Map.put(x, "id", User.get_or_fetch(x["acct"]).id) + end) - conn - |> json(data2) + conn + |> json(data2) + else + e -> Logger.error("Could not decode user at fetch #{url}, #{inspect(e)}") + end else - e -> Logger.error("Could not decode user at fetch #{url}, #{inspect(e)}") + json(conn, []) end end end -- cgit v1.2.3 From 2b7b1b3e6b276e1db7e610d46298f74a0f0c70f1 Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Tue, 17 Jul 2018 16:56:30 +0900 Subject: add suggestionsThirdPartyEngine into /nodeinfo/2.0.json --- lib/pleroma/web/nodeinfo/nodeinfo_controller.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex index 12aca4a10..77401c554 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex @@ -21,6 +21,7 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do def nodeinfo(conn, %{"version" => "2.0"}) do instance = Application.get_env(:pleroma, :instance) media_proxy = Application.get_env(:pleroma, :media_proxy) + suggestions = Application.get_env(:pleroma, :suggestions) stats = Stats.get_stats() response = %{ @@ -43,7 +44,8 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do }, metadata: %{ nodeName: Keyword.get(instance, :name), - mediaProxy: Keyword.get(media_proxy, :enabled) + mediaProxy: Keyword.get(media_proxy, :enabled), + suggestionsThirdPartyEngine: Keyword.get(@suggestions, :third_party_engine, false) } } -- cgit v1.2.3 From 8ff336e02a5a4861ba856b3d10e57cb44f1f3a45 Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Tue, 17 Jul 2018 17:00:14 +0900 Subject: debug --- lib/pleroma/web/nodeinfo/nodeinfo_controller.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex index 77401c554..5f7d6e86e 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex @@ -45,7 +45,7 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do metadata: %{ nodeName: Keyword.get(instance, :name), mediaProxy: Keyword.get(media_proxy, :enabled), - suggestionsThirdPartyEngine: Keyword.get(@suggestions, :third_party_engine, false) + suggestionsThirdPartyEngine: Keyword.get(suggestions, :third_party_engine, false) } } -- cgit v1.2.3 From 5b4a21317de6a32001699b33964c7eaeb4f0bec8 Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Tue, 17 Jul 2018 17:29:18 +0900 Subject: correct error message --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index ac8f794e9..2ad6521cc 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1099,7 +1099,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do conn |> json(data2) else - e -> Logger.error("Could not decode user at fetch #{url}, #{inspect(e)}") + e -> Logger.error("Could not retrieve suggestions at fetch #{url}, #{inspect(e)}") end else json(conn, []) -- cgit v1.2.3 From e4dd58307a692aaa503fccc9cdf9ebae61293f6f Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Wed, 18 Jul 2018 09:58:59 +0900 Subject: better configuration --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 4 ++-- lib/pleroma/web/nodeinfo/nodeinfo_controller.ex | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 2ad6521cc..5b79f9600 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1076,9 +1076,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do @suggestions Application.get_env(:pleroma, :suggestions) def suggestions(%{assigns: %{user: user}} = conn, _) do - api = Keyword.get(@suggestions, :third_party_engine, false) + if Keyword.get(@suggestions, :enabled, false) do + api = Keyword.get(@suggestions, :third_party_engine, false) - if api do host = Application.get_env(:pleroma, Pleroma.Web.Endpoint) |> Keyword.get(:url) diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex index 5f7d6e86e..e80e63f27 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex @@ -45,6 +45,7 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do metadata: %{ nodeName: Keyword.get(instance, :name), mediaProxy: Keyword.get(media_proxy, :enabled), + suggestions: Keyword.get(suggestions, :enabled, false), suggestionsThirdPartyEngine: Keyword.get(suggestions, :third_party_engine, false) } } -- cgit v1.2.3 From b12d17d2ce270e0d964f599efd4f16fba95b17ce Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Wed, 18 Jul 2018 13:36:20 +0900 Subject: configurable timeout --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 5 +++-- lib/pleroma/web/nodeinfo/nodeinfo_controller.ex | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 5b79f9600..396f11a70 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1077,7 +1077,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do def suggestions(%{assigns: %{user: user}} = conn, _) do if Keyword.get(@suggestions, :enabled, false) do - api = Keyword.get(@suggestions, :third_party_engine, false) + api = Keyword.get(@suggestions, :third_party_engine, "") + timeout = Keyword.get(@suggestions, :timeout, 5000) host = Application.get_env(:pleroma, Pleroma.Web.Endpoint) @@ -1088,7 +1089,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do url = String.replace(api, "{{host}}", host) |> String.replace("{{user}}", user) with {:ok, %{status_code: 200, body: body}} <- - @httpoison.get(url, [], timeout: 300_000, recv_timeout: 300_000), + @httpoison.get(url, [], timeout: timeout, recv_timeout: timeout), {:ok, data} <- Jason.decode(body) do data2 = Enum.slice(data, 0, 40) diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex index e80e63f27..42d322f89 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex @@ -45,8 +45,11 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do metadata: %{ nodeName: Keyword.get(instance, :name), mediaProxy: Keyword.get(media_proxy, :enabled), - suggestions: Keyword.get(suggestions, :enabled, false), - suggestionsThirdPartyEngine: Keyword.get(suggestions, :third_party_engine, false) + suggestions: %{ + enabled: Keyword.get(suggestions, :enabled, false), + thirdPartyEngine: Keyword.get(suggestions, :third_party_engine, ""), + timeout: Keyword.get(suggestions, :timeout, 5000) + } } } -- cgit v1.2.3 From f72cfada1ad5cf7ca398ceddf4f70b3b192310ca Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Thu, 2 Aug 2018 18:03:35 +0900 Subject: add suggestions/web config --- lib/pleroma/web/nodeinfo/nodeinfo_controller.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex index f9a6d9c25..2fab60274 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex @@ -50,7 +50,8 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do suggestions: %{ enabled: Keyword.get(suggestions, :enabled, false), thirdPartyEngine: Keyword.get(suggestions, :third_party_engine, ""), - timeout: Keyword.get(suggestions, :timeout, 5000) + timeout: Keyword.get(suggestions, :timeout, 5000), + web: Keyword.get(suggestions, :web, "") } } } -- cgit v1.2.3