From 5e114931f546b142d87739124dd36628283017be Mon Sep 17 00:00:00 2001 From: Phantasm Date: Fri, 9 Jan 2026 11:41:12 +0100 Subject: [PATCH] Move LiveDashboard to /pleroma/live_dashboard --- changelog.d/phoenix-livedashboard-move.change | 1 + docs/administration/dashboards.md | 2 +- lib/pleroma/web/fallback/redirect_controller.ex | 5 +++++ lib/pleroma/web/router.ex | 8 ++++---- test/pleroma/web/fallback_test.exs | 4 ++++ 5 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 changelog.d/phoenix-livedashboard-move.change diff --git a/changelog.d/phoenix-livedashboard-move.change b/changelog.d/phoenix-livedashboard-move.change new file mode 100644 index 0000000000..116b1523ae --- /dev/null +++ b/changelog.d/phoenix-livedashboard-move.change @@ -0,0 +1 @@ +Moved Phoenix LiveDashboard to /pleroma/live_dashboard diff --git a/docs/administration/dashboards.md b/docs/administration/dashboards.md index 8e89876337..b95e0fac0e 100644 --- a/docs/administration/dashboards.md +++ b/docs/administration/dashboards.md @@ -11,7 +11,7 @@ Pleroma comes with two types of backend dashboards viewable to instance administ ## Phoenix LiveDashboard -Instance administrators can access this dashboard at `/phoenix/live_dashboard`, giving a simple overview of software versions including Erlang and Elixir versions, instance uptime and resource consumption. +Instance administrators can access this dashboard at `/pleroma/live_dashboard`, giving a simple overview of software versions including Erlang and Elixir versions, instance uptime and resource consumption. This dashboard gives insights into the current state of the BEAM VM running Pleroma code and database statistics including basic diagnostics. It can be useful for troubleshooting of some issues namely regarding database performance. diff --git a/lib/pleroma/web/fallback/redirect_controller.ex b/lib/pleroma/web/fallback/redirect_controller.ex index 60fc15b9e9..d75a95fb31 100644 --- a/lib/pleroma/web/fallback/redirect_controller.ex +++ b/lib/pleroma/web/fallback/redirect_controller.ex @@ -29,6 +29,11 @@ defmodule Pleroma.Web.Fallback.RedirectController do ) end + def live_dashboard(conn, _params) do + conn + |> redirect(to: "/pleroma/live_dashboard") + end + def redirector(conn, _params, code \\ 200) do {:ok, index_content} = File.read(index_file_path(conn)) diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 37212017d9..b5e184ac19 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -1044,7 +1044,7 @@ defmodule Pleroma.Web.Router do scope "/" do pipe_through([:pleroma_html, :authenticate, :require_admin]) - live_dashboard("/phoenix/live_dashboard", additional_pages: [oban: Oban.LiveDashboard]) + live_dashboard("/pleroma/live_dashboard", additional_pages: [oban: Oban.LiveDashboard]) oban_dashboard("/pleroma/oban") end @@ -1086,15 +1086,15 @@ 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("/*path", RedirectController, :redirector_with_preload) options("/*path", RedirectController, :empty) end - # /pleroma/oban/* needs to get filtered out from api routes for frontend configuration + # /pleroma/{phoenix,oban}/* need to get filtered out from api routes for frontend configuration # to not drop admin overrides for /pleroma/admin. - # Also removing /phoenix since it is not an API route - @non_api_routes ["/phoenix/live_dashboard", "/pleroma/oban"] + @non_api_routes ["/pleroma/live_dashboard", "/pleroma/oban"] def get_api_routes do Phoenix.Router.routes(__MODULE__) diff --git a/test/pleroma/web/fallback_test.exs b/test/pleroma/web/fallback_test.exs index 9184cf8f13..6d0ba3d2a0 100644 --- a/test/pleroma/web/fallback_test.exs +++ b/test/pleroma/web/fallback_test.exs @@ -77,6 +77,10 @@ defmodule Pleroma.Web.FallbackTest do assert redirected_to(get(conn, "/pleroma/admin")) =~ "/pleroma/admin/" end + test "GET /phoenix/live_dashboard -> /pleroma/live_dashboard", %{conn: conn} do + assert redirected_to(get(conn, "/phoenix/live_dashboard")) =~ "/pleroma/live_dashboard" + end + test "OPTIONS /*path", %{conn: conn} do assert conn |> options("/foo")