from __future__ import annotations from quart import make_response, Blueprint from shared.browser.app.authz import require_admin from shared.browser.app.utils.htmx import is_htmx_request def register(): bp = Blueprint("page_admin", __name__) @bp.get("/") @require_admin async def admin(**kwargs): from shared.sexp.page import get_template_context from sexp.sexp_components import render_page_admin_page, render_page_admin_oob tctx = await get_template_context() if not is_htmx_request(): html = await render_page_admin_page(tctx) else: html = await render_page_admin_oob(tctx) return await make_response(html) return bp