mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-01 06:14:07 +00:00
21 lines
572 B
Elixir
21 lines
572 B
Elixir
|
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("<meta http-equiv=\"refresh\" content=\"0; url=/\">")
|
||
|
end
|
||
|
end
|