Merge branch 'phnt/oban-web' into 'develop'
Add Oban Web and upgrade LiveView, plug See merge request pleroma/pleroma!4422
This commit is contained in:
commit
9fcf918e1c
9 changed files with 73 additions and 5 deletions
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
defmodule Pleroma.Web.Router do
|
||||
use Pleroma.Web, :router
|
||||
import Phoenix.LiveDashboard.Router
|
||||
import Oban.Web.Router
|
||||
|
||||
pipeline :accepts_html do
|
||||
plug(:accepts, ["html"])
|
||||
|
|
@ -1043,7 +1044,8 @@ 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
|
||||
|
||||
# Test-only routes needed to test action dispatching and plug chain execution
|
||||
|
|
@ -1084,14 +1086,20 @@ 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/{phoenix,oban}/* need to get filtered out from api routes for frontend configuration
|
||||
# to not drop admin overrides for /pleroma/admin.
|
||||
@non_api_routes ["/pleroma/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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue