From 421187dbfa4b7b5fe5e758666055ef417202110c Mon Sep 17 00:00:00 2001 From: Phantasm Date: Thu, 8 Jan 2026 00:28:29 +0100 Subject: [PATCH] Remove /pleroma/oban and /phoenix/live_dashboard from API routes This is needed to prevent admin frontend overrides from misbehaving when overriding AdminFE located at /pleroma/admin, since API routes are interpreted as the first portion of their full path, ie: /api/v1/pleroma/admin -> /api --- lib/pleroma/web/router.ex | 6 ++++++ test/pleroma/web/plugs/frontend_static_plug_test.exs | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 43b74c357..df1812bd5 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -1092,9 +1092,15 @@ defmodule Pleroma.Web.Router do options("/*path", RedirectController, :empty) end + # /pleroma/oban/* needs 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"] + def get_api_routes do Phoenix.Router.routes(__MODULE__) |> Enum.reject(fn r -> r.plug == Pleroma.Web.Fallback.RedirectController end) + |> Enum.reject(fn r -> String.starts_with?(r.path, @non_api_routes) end) |> Enum.map(fn r -> r.path |> String.split("/", trim: true) diff --git a/test/pleroma/web/plugs/frontend_static_plug_test.exs b/test/pleroma/web/plugs/frontend_static_plug_test.exs index cbe200738..e1e331c06 100644 --- a/test/pleroma/web/plugs/frontend_static_plug_test.exs +++ b/test/pleroma/web/plugs/frontend_static_plug_test.exs @@ -106,7 +106,6 @@ defmodule Pleroma.Web.Plugs.FrontendStaticPlugTest do "manifest.json", "auth", "proxy", - "phoenix", "test", "user_exists", "check_password"