summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEkaterina Vaartis <vaartis@kotobank.ch>2023-03-30 11:16:40 +0300
committerEkaterina Vaartis <vaartis@kotobank.ch>2023-03-30 11:16:40 +0300
commit3037d2780c735846bc82994f620c970b104362a7 (patch)
treec1b0078a347e242f508601747b01c40ce874aa21 /lib
parentd3b27d45a9115c04d4e469d1a9dc372ff8576d52 (diff)
downloadpleroma-3037d2780c735846bc82994f620c970b104362a7.tar.gz
pleroma-3037d2780c735846bc82994f620c970b104362a7.zip
Also list frontends that are not in the config file
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/admin_api/controllers/frontend_controller.ex13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/pleroma/web/admin_api/controllers/frontend_controller.ex b/lib/pleroma/web/admin_api/controllers/frontend_controller.ex
index 145c1fa4a..9e2ed4aac 100644
--- a/lib/pleroma/web/admin_api/controllers/frontend_controller.ex
+++ b/lib/pleroma/web/admin_api/controllers/frontend_controller.ex
@@ -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