|
|
@ -1148,6 +1148,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|
|
|
if Keyword.get(@suggestions, :enabled, false) do
|
|
|
|
if Keyword.get(@suggestions, :enabled, false) do
|
|
|
|
api = Keyword.get(@suggestions, :third_party_engine, "")
|
|
|
|
api = Keyword.get(@suggestions, :third_party_engine, "")
|
|
|
|
timeout = Keyword.get(@suggestions, :timeout, 5000)
|
|
|
|
timeout = Keyword.get(@suggestions, :timeout, 5000)
|
|
|
|
|
|
|
|
limit = Keyword.get(@suggestions, :limit, 23)
|
|
|
|
|
|
|
|
|
|
|
|
host =
|
|
|
|
host =
|
|
|
|
Application.get_env(:pleroma, Pleroma.Web.Endpoint)
|
|
|
|
Application.get_env(:pleroma, Pleroma.Web.Endpoint)
|
|
|
@ -1161,7 +1162,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|
|
|
@httpoison.get(url, [], timeout: timeout, recv_timeout: timeout),
|
|
|
|
@httpoison.get(url, [], timeout: timeout, recv_timeout: timeout),
|
|
|
|
{:ok, data} <- Jason.decode(body) do
|
|
|
|
{:ok, data} <- Jason.decode(body) do
|
|
|
|
data2 =
|
|
|
|
data2 =
|
|
|
|
Enum.slice(data, 0, 40)
|
|
|
|
Enum.slice(data, 0, limit)
|
|
|
|
|> Enum.map(fn x ->
|
|
|
|
|> Enum.map(fn x ->
|
|
|
|
Map.put(
|
|
|
|
Map.put(
|
|
|
|
x,
|
|
|
|
x,
|
|
|
|