better configuration
authorHakaba Hitoyo <hakabahitoyo@example.com>
Wed, 18 Jul 2018 00:58:59 +0000 (09:58 +0900)
committerHakaba Hitoyo <hakabahitoyo@example.com>
Wed, 18 Jul 2018 00:58:59 +0000 (09:58 +0900)
config/config.exs
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
lib/pleroma/web/nodeinfo/nodeinfo_controller.ex

index baaf43c7c6532b6eedabdf93969b9aff94c5c18b..c0a75b78607c67c55ba321cdcb290ab9c8e05ba4 100644 (file)
@@ -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.
index 2ad6521cc32597a96862f8577922bb5598a1fb81..5b79f9600f7a3d632ccca78c73626cdb7bd73a4e 100644 (file)
@@ -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)
index 5f7d6e86ee9f205f2b94d6bac40018c5de0a8e6d..e80e63f27a3d114427bc5efaee5b9b3034652f35 100644 (file)
@@ -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)
       }
     }