From e4dd58307a692aaa503fccc9cdf9ebae61293f6f Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Wed, 18 Jul 2018 09:58:59 +0900 Subject: [PATCH] better configuration --- config/config.exs | 8 ++++---- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 4 ++-- lib/pleroma/web/nodeinfo/nodeinfo_controller.ex | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/config/config.exs b/config/config.exs index baaf43c7c..c0a75b786 100644 --- a/config/config.exs +++ b/config/config.exs @@ -95,10 +95,10 @@ config :pleroma, :gopher, ip: {0, 0, 0, 0}, port: 9999 -config :pleroma, :suggestions, third_party_engine: false -# config :pleroma, :suggestions, -# third_party_engine: -# "http://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-suggestions-api.cgi?{{host}}+{{user}}" +config :pleroma, :suggestions, + enabled: false, + third_party_engine: + "http://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-suggestions-api.cgi?{{host}}+{{user}}" # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. 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) } }