Fix LiveDashboard redirect not working when user added a path segment

/phoenix/live_dashboard -> /pleroma/live_dashboard would work

/phoenix/live_dashboard/ecto_stats -> /pleroma/live_dashboard/ecto_stats
would not work and instead reply with FE.
This commit is contained in:
Phantasm 2026-02-16 17:04:00 +01:00
commit 699a7e57e8
No known key found for this signature in database
GPG key ID: 2669E588BCC634C8
4 changed files with 19 additions and 3 deletions

View file

@ -29,9 +29,18 @@ defmodule Pleroma.Web.Fallback.RedirectController do
)
end
def live_dashboard(conn, _params) do
def live_dashboard(conn, %{"path" => path}) do
query_params = conn.query_string
redirect_path =
if query_params == "" do
"/pleroma/live_dashboard/#{path}"
else
"/pleroma/live_dashboard/#{path}?#{query_params}"
end
conn
|> redirect(to: "/pleroma/live_dashboard")
|> redirect(to: redirect_path)
end
def redirector(conn, _params, code \\ 200) do

View file

@ -1088,7 +1088,7 @@ defmodule Pleroma.Web.Router do
get("/:maybe_nickname_or_id", RedirectController, :redirector_with_meta)
match(:*, "/api/pleroma/*path", LegacyPleromaApiRerouterPlug, [])
get("/api/*path", RedirectController, :api_not_implemented)
get("/phoenix/live_dashboard", RedirectController, :live_dashboard)
get("/phoenix/live_dashboard/*path", RedirectController, :live_dashboard)
get("/*path", RedirectController, :redirector_with_preload)
options("/*path", RedirectController, :empty)