republisher/repub/web/admin/pages/settings.py
Abel Luck e4a5246ab3
All checks were successful
buildbot/nix-eval Build done.
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
Add publisher dashboard routes
2026-06-02 10:18:59 +02:00

26 lines
869 B
Python

from __future__ import annotations
from collections.abc import Awaitable, Callable
from typing import Any
from datastar_py.quart import DatastarResponse
from quart import Quart, Response
from repub.web.app import _page_patch_response, _shim_page_response, render_settings
RouteGuard = Callable[[Callable[..., Awaitable[Any]]], Callable[..., Awaitable[Any]]]
def register_settings_routes(app: Quart, *, admin_required: RouteGuard) -> None:
@app.get("/admin/settings")
@admin_required
async def admin_settings_home() -> Response:
return _shim_page_response(
current_path="/admin/settings",
static_prefix="/admin",
)
@app.post("/admin/settings")
@admin_required
async def admin_settings_patch() -> DatastarResponse:
return await _page_patch_response(app, lambda _tab_id: render_settings(app))