Feature: Staging-Icon — lila Badge, BY ⚗️ Homescreen-Name, eigenes Manifest
This commit is contained in:
parent
27d847ce31
commit
2e7ce5f248
3 changed files with 20 additions and 1 deletions
|
|
@ -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():
|
||||
|
|
|
|||
BIN
backend/static/icons/icon-192-staging.png
Normal file
BIN
backend/static/icons/icon-192-staging.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
BIN
backend/static/icons/icon-512-staging.png
Normal file
BIN
backend/static/icons/icon-512-staging.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 348 KiB |
Loading…
Add table
Add a link
Reference in a new issue