configurable
This commit is contained in:
parent
eb0afda3a7
commit
127882a5d5
2 changed files with 6 additions and 1 deletions
|
@ -95,6 +95,9 @@
|
||||||
ip: {0, 0, 0, 0},
|
ip: {0, 0, 0, 0},
|
||||||
port: 9999
|
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
|
# Import environment specific config. This must remain at the bottom
|
||||||
# of this file so it overrides the configuration defined above.
|
# of this file so it overrides the configuration defined above.
|
||||||
import_config "#{Mix.env()}.exs"
|
import_config "#{Mix.env()}.exs"
|
||||||
|
|
|
@ -1073,10 +1073,12 @@ def errors(conn, _) do
|
||||||
|> json("Something went wrong")
|
|> json("Something went wrong")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@suggestions Application.get_env(:pleroma, :suggestions)
|
||||||
|
|
||||||
def suggestions(%{assigns: %{user: user}} = conn, _) do
|
def suggestions(%{assigns: %{user: user}} = conn, _) do
|
||||||
host = String.replace Web.base_url(), "https://", ""
|
host = String.replace Web.base_url(), "https://", ""
|
||||||
user = user.nickname
|
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)
|
url = String.replace(api, "{{host}}", host) |> String.replace("{{user}}", user)
|
||||||
with {:ok, %{status_code: 200, body: body}} <-
|
with {:ok, %{status_code: 200, body: body}} <-
|
||||||
@httpoison.get(url),
|
@httpoison.get(url),
|
||||||
|
|
Loading…
Reference in a new issue