logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 3037d2780c735846bc82994f620c970b104362a7
parent d3b27d45a9115c04d4e469d1a9dc372ff8576d52
Author: Ekaterina Vaartis <vaartis@kotobank.ch>
Date:   Thu, 30 Mar 2023 11:16:40 +0300

Also list frontends that are not in the config file

Diffstat:

Mlib/pleroma/web/admin_api/controllers/frontend_controller.ex13+++++++++++--
1 file 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 @@ -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