Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk 2025-11-29 15:53:10 +01:00
commit cc51ee8662
3 changed files with 10 additions and 9 deletions

View file

@ -9,7 +9,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaFrontendSettingsOperation do
apply(__MODULE__, operation, []) apply(__MODULE__, operation, [])
end end
def available_frontends_operation() do def available_frontends_operation do
%Operation{ %Operation{
tags: ["Preferred frontends"], tags: ["Preferred frontends"],
summary: "Frontend settings profiles", summary: "Frontend settings profiles",
@ -27,7 +27,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaFrontendSettingsOperation do
} }
end end
def update_preferred_frontend_operation() do def update_preferred_frontend_operation do
%Operation{ %Operation{
tags: ["Preferred frontends"], tags: ["Preferred frontends"],
summary: "Update preferred frontend setting", summary: "Update preferred frontend setting",
@ -50,10 +50,13 @@ defmodule Pleroma.Web.ApiSpec.PleromaFrontendSettingsOperation do
), ),
responses: %{ responses: %{
200 => 200 =>
Operation.response("Frontends", "application/json", %Schema{ Operation.response("Preferred frontend", "application/json", %Schema{
type: :array, type: :object,
items: %Schema{ properties: %{
type: :string frontend_name: %Schema{
type: :string,
description: "Frontend name"
}
} }
}) })
} }

View file

@ -15,6 +15,6 @@ defmodule Pleroma.Web.FrontendSwitcher.FrontendSwitcherController do
def do_switch(conn, params) do def do_switch(conn, params) do
conn conn
|> put_resp_cookie("preferred_frontend", params["frontend"]) |> put_resp_cookie("preferred_frontend", params["frontend"])
|> html("<meta http-equiv=\"refresh\" content=\"0; url=/\">") |> html(~s(<meta http-equiv="refresh" content="0; url=/">))
end end
end end

View file

@ -1,8 +1,6 @@
defmodule Pleroma.Web.PleromaAPI.FrontendSettingsControllerTest do defmodule Pleroma.Web.PleromaAPI.FrontendSettingsControllerTest do
use Pleroma.Web.ConnCase, async: false use Pleroma.Web.ConnCase, async: false
import Pleroma.Factory
describe "PUT /api/v1/pleroma/preferred_frontend" do describe "PUT /api/v1/pleroma/preferred_frontend" do
test "sets a cookie with selected frontend" do test "sets a cookie with selected frontend" do
%{conn: conn} = oauth_access(["read"]) %{conn: conn} = oauth_access(["read"])