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:
parent
1c685ea41a
commit
699a7e57e8
4 changed files with 19 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue