FrontendController: Return error on installation error.
[akkoma] / lib / pleroma / web / admin_api / controllers / frontend_controller.ex
index 59c69aba114819b0e5c96e77e53484753e68f15d..fac3522b83fef3bc2576eb859a66a234947db909 100644 (file)
@@ -7,7 +7,6 @@ defmodule Pleroma.Web.AdminAPI.FrontendController do
 
   alias Pleroma.Config
   alias Pleroma.Web.Plugs.OAuthScopesPlug
-  alias Pleroma.Workers.FrontendInstallerWorker
 
   plug(Pleroma.Web.ApiSpec.CastAndValidate)
   plug(OAuthScopesPlug, %{scopes: ["write"], admin: true} when action == :install)
@@ -30,9 +29,9 @@ defmodule Pleroma.Web.AdminAPI.FrontendController do
   end
 
   def install(%{body_params: params} = conn, _params) do
-    FrontendInstallerWorker.install(params.name, Map.delete(params, :name))
-
-    index(conn, %{})
+    with :ok <- Pleroma.Frontend.install(params.name, Map.delete(params, :name)) do
+      index(conn, %{})
+    end
   end
 
   defp installed do