Also list frontends that are not in the config file
This commit is contained in:
parent
d3b27d45a9
commit
3037d2780c
@ -18,15 +18,24 @@ defmodule Pleroma.Web.AdminAPI.FrontendController do
|
||||
def index(conn, _params) do
|
||||
installed = installed()
|
||||
|
||||
# FIrst get frontends from config,
|
||||
# then add frontends that are installed but not in the config
|
||||
frontends =
|
||||
[:frontends, :available]
|
||||
|> Config.get([])
|
||||
Config.get([:frontends, :available], [])
|
||||
|> Enum.map(fn {name, desc} ->
|
||||
desc
|
||||
|> Map.put("installed", name in installed)
|
||||
|> Map.put("installed_refs", installed_refs(name))
|
||||
end)
|
||||
|
||||
frontends =
|
||||
frontends ++
|
||||
(installed
|
||||
|> Enum.filter(fn n -> not Enum.any?(frontends, fn f -> f["name"] == n end) end)
|
||||
|> Enum.map(fn name ->
|
||||
%{"name" => name, "installed" => true, "installed_refs" => installed_refs(name)}
|
||||
end))
|
||||
|
||||
render(conn, "index.json", frontends: frontends)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user