X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fakkoma_api%2Fcontrollers%2Ffrontend_switcher.ex;fp=lib%2Fpleroma%2Fweb%2Fakkoma_api%2Fcontrollers%2Ffrontend_switcher.ex;h=2095db4b5742d7910d090a268762d1a021201c61;hb=de64c6c54aaacc4123031f2e3d5bfb9fc9c517fe;hp=0000000000000000000000000000000000000000;hpb=643b8c5f152bb71ef11074edd4a78f1405f360da;p=akkoma diff --git a/lib/pleroma/web/akkoma_api/controllers/frontend_switcher.ex b/lib/pleroma/web/akkoma_api/controllers/frontend_switcher.ex new file mode 100644 index 000000000..2095db4b5 --- /dev/null +++ b/lib/pleroma/web/akkoma_api/controllers/frontend_switcher.ex @@ -0,0 +1,20 @@ +defmodule Pleroma.Web.AkkomaAPI.FrontendSwitcherController do + use Pleroma.Web, :controller + alias Pleroma.Config + + @doc "GET /akkoma/frontend" + def switch(conn, _params) do + pickable = Config.get([:frontends, :pickable], []) + + conn + |> put_view(Pleroma.Web.AkkomaAPI.FrontendSwitcherView) + |> render("switch.html", choices: pickable) + end + + @doc "POST /akkoma/frontend" + def do_switch(conn, params) do + conn + |> put_resp_cookie("preferred_frontend", params["frontend"]) + |> html("") + end +end