feat: catalogue des layouts accessible dans la web app (/layouts)

This commit is contained in:
2026-07-16 08:26:53 +02:00
parent bcb5e6d191
commit 2d06f95978
3 changed files with 21 additions and 3 deletions
+17
View File
@@ -427,6 +427,22 @@ async def download(request):
"presentationml.presentation")
async def layouts_gallery(request):
"""Catalogue des layouts — l'index.html généré par build_gallery.py,
servi tel quel (toujours à jour après une régénération)."""
guard = require_login(request)
if guard:
return guard
page = BASE / "index.html"
if not page.exists():
return HTMLResponse(
'<p style="font-family:sans-serif;margin:40px">Galerie '
'absente — lancer <code>python3 build_gallery.py</code> '
'sur le NAS.</p>', status_code=404)
return FileResponse(str(page), media_type="text/html",
headers={"Cache-Control": "no-store"})
async def health(request):
return JSONResponse({"status": "ok", "server": "webapp-sliding",
"version": "1.0.0"})
@@ -448,6 +464,7 @@ app = Starlette(routes=[
Route("/p/{slug}/revise", revise, methods=["POST"]),
Route("/p/{slug}/previews/{name}", preview_png, methods=["GET"]),
Route("/p/{slug}/download", download, methods=["GET"]),
Route("/layouts", layouts_gallery, methods=["GET"]),
Route("/health", health, methods=["GET"]),
Mount("/static", StaticFiles(directory=str(BASE / "static")),
name="static"),