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
This commit is contained in:
parent
ac6ec02725
commit
421187dbfa
2 changed files with 6 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ defmodule Pleroma.Web.Plugs.FrontendStaticPlugTest do
|
|||
"manifest.json",
|
||||
"auth",
|
||||
"proxy",
|
||||
"phoenix",
|
||||
"test",
|
||||
"user_exists",
|
||||
"check_password"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue