shim renders app shell

This commit is contained in:
Abel Luck 2026-03-30 14:16:15 +02:00
parent c210168d65
commit 51728a5401
3 changed files with 53 additions and 5 deletions

View file

@ -81,12 +81,16 @@ DEFAULT_PANGEA_MAX_ARTICLES = "10"
DEFAULT_PANGEA_OLDEST_ARTICLE = "3"
def _render_shim_page(*, stylesheet_href: str, datastar_src: str) -> tuple[str, str]:
def _render_shim_page(
*, stylesheet_href: str, datastar_src: str, current_path: str
) -> tuple[str, str]:
head = (
h.title["Republisher Admin UI"],
h.link(rel="stylesheet", href=stylesheet_href),
)
body = str(shim_page(datastar_src=datastar_src, head=head))
body = str(
shim_page(datastar_src=datastar_src, current_path=current_path, head=head)
)
etag = hashlib.sha256(body.encode("utf-8")).hexdigest()
return body, etag
@ -116,6 +120,7 @@ def create_app() -> Quart:
body, etag = _render_shim_page(
stylesheet_href=url_for("static", filename="app.css"),
datastar_src=url_for("static", filename="datastar@1.0.0-RC.8.js"),
current_path=request.path,
)
if request.if_none_match.contains(etag):
response = Response(status=304)