diff --git a/app/factory.py b/app/factory.py index 293bc10..51fbe97 100644 --- a/app/factory.py +++ b/app/factory.py @@ -84,6 +84,23 @@ def create_app() -> FastAPI: return FileResponse(favicon_path) return FileResponse(settings.base_dir / "favicon.ico") + @app.get("/manifest.json", include_in_schema=False) + async def manifest(): + """Serve le Web App Manifest pour la PWA.""" + return FileResponse( + settings.base_dir / "static" / "manifest.json", + media_type="application/manifest+json", + ) + + @app.get("/sw.js", include_in_schema=False) + async def service_worker(): + """Serve le Service Worker à la racine pour un scope maximal.""" + return FileResponse( + settings.base_dir / "static" / "sw.js", + media_type="application/javascript", + headers={"Service-Worker-Allowed": "/"}, + ) + @app.get("/api", response_class=HTMLResponse) async def api_home(): """Page d'accueil de l'API.""" diff --git a/app/index.html b/app/index.html index 3a9d511..5138f5f 100644 --- a/app/index.html +++ b/app/index.html @@ -10,6 +10,13 @@ + + + + + + +