diff --git a/backend/main.py b/backend/main.py index fbae790..4490cbb 100644 --- a/backend/main.py +++ b/backend/main.py @@ -691,7 +691,26 @@ async def favicon(): @app.get("/manifest.json") async def manifest(): - return FileResponse(f"{STATIC_DIR}/manifest.json") + import json as _json + IS_STAGING = os.getenv("STAGING", "false").lower() == "true" + with open(f"{STATIC_DIR}/manifest.json", encoding="utf-8") as f: + data = _json.load(f) + if IS_STAGING: + data["name"] = "Ban Yaro Staging" + data["short_name"] = "BY ⚗️" + data["theme_color"] = "#7c3aed" + data["background_color"] = "#2d1b69" + data["id"] = "/staging" + # Icons mit Staging-Variante überschreiben falls vorhanden + staging_icon = "/icons/icon-192-staging.png" + import os as _os + if _os.path.exists(f"{STATIC_DIR}/icons/icon-192-staging.png"): + data["icons"] = [ + {"src": "/icons/icon-192-staging.png", "sizes": "192x192", "type": "image/png", "purpose": "any maskable"}, + {"src": "/icons/icon-512-staging.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable"}, + ] + from fastapi.responses import JSONResponse + return JSONResponse(content=data, media_type="application/manifest+json") @app.get("/sw.js") async def service_worker(): diff --git a/backend/static/icons/icon-192-staging.png b/backend/static/icons/icon-192-staging.png new file mode 100644 index 0000000..f7eed35 Binary files /dev/null and b/backend/static/icons/icon-192-staging.png differ diff --git a/backend/static/icons/icon-512-staging.png b/backend/static/icons/icon-512-staging.png new file mode 100644 index 0000000..136da91 Binary files /dev/null and b/backend/static/icons/icon-512-staging.png differ