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
+1 -1
View File
@@ -614,7 +614,7 @@ footer{padding:50px 60px;background:var(--navy);color:rgba(255,255,255,.6);font-
</div></div>
</section>
<footer>
Généré automatiquement depuis layouts_v2.yaml · 09/07/2026 · 31 layouts
Généré automatiquement depuis layouts_v2.yaml · 13/07/2026 · 31 layouts
</footer>
</body>
</html>
+3 -2
View File
@@ -4,15 +4,16 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sliding — {% block title %}{% endblock %}</title>
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
<link rel="stylesheet" href="/static/style.css">
<script src="https://unpkg.com/htmx.org@1.9.12"></script>
</head>
<body>
<header>
<a class="brand" href="/">SLIDING <span>· Pernod Ricard</span></a>
<nav><a href="/logout">Déconnexion</a></nav>
<nav><a href="/layouts" target="_blank">Catalogue des layouts</a> · <a href="/logout">Déconnexion</a></nav>
</header>
<main>{% block content %}{% endblock %}</main>
<div id="busy" class="htmx-indicator">Le NAS travaille…</div>
<div id="busy" class="htmx-indicator">L'agent travaille…</div>
</body>
</html>
+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"),