Add enabled check on /translation/languages
This commit is contained in:
parent
bbedbaaf5c
commit
5123b3a5dd
|
@ -21,10 +21,12 @@ defmodule Pleroma.Web.AkkomaAPI.TranslationController do
|
||||||
|
|
||||||
@doc "GET /api/v1/akkoma/translation/languages"
|
@doc "GET /api/v1/akkoma/translation/languages"
|
||||||
def languages(conn, _params) do
|
def languages(conn, _params) do
|
||||||
with {:ok, source_languages, dest_languages} <- get_languages() do
|
with {:enabled, true} <- {:enabled, Pleroma.Config.get([:translator, :enabled])},
|
||||||
|
{:ok, source_languages, dest_languages} <- get_languages() do
|
||||||
conn
|
conn
|
||||||
|> json(%{source: source_languages, target: dest_languages})
|
|> json(%{source: source_languages, target: dest_languages})
|
||||||
else
|
else
|
||||||
|
{:enabled, false} -> json(conn, %{})
|
||||||
e -> IO.inspect(e)
|
e -> IO.inspect(e)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue