configurable
authorhakabahitoyo <hakabahitoyo@example.com>
Sat, 14 Jul 2018 02:41:09 +0000 (11:41 +0900)
committerhakabahitoyo <hakabahitoyo@example.com>
Sat, 14 Jul 2018 02:41:09 +0000 (11:41 +0900)
config/config.exs
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex

index 0616fe4fb19d48a5ad288749c42af5a0fb64e49e..9299d0dc662b5ec9213a76c27f1139126e056f92 100644 (file)
@@ -95,6 +95,9 @@ config :pleroma, :gopher,
   ip: {0, 0, 0, 0},
   port: 9999
 
+config :pleroma, :suggestions,
+  third_party_engine: "http://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-filtered-api.cgi?{{host}}+{{user}}"
+
 # Import environment specific config. This must remain at the bottom
 # of this file so it overrides the configuration defined above.
 import_config "#{Mix.env()}.exs"
index 4f48a141b6da6c3876e0d48eb208a4b6f803a218..fd60db3d6ac5c2416f7ab1f05e0726487657b7f7 100644 (file)
@@ -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),