improve getting host name
authorHakaba Hitoyo <hakabahitoyo@example.com>
Tue, 17 Jul 2018 04:20:58 +0000 (13:20 +0900)
committerHakaba Hitoyo <hakabahitoyo@example.com>
Tue, 17 Jul 2018 04:20:58 +0000 (13:20 +0900)
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex

index e397b911de1ec08728390d1ef9dc22ede81580d2..2f8139fe6d9fa78d82385ac9b9d5f057c3afc440 100644 (file)
@@ -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)