Add a web app manifest and an install-only service worker (no offline caching: live state always comes from the server and hashed asset names change every build), registered from the WASM bundle. The worker must live at the site root for its scope to cover the app, and Granian only serves /static and /assets, so tavolo/static.py answers /manifest.webmanifest and /sw.js from STATIC_DIR with the content types browsers require; index.html gains the manifest link, icons, theme-color and Apple standalone meta tags. Icons are committed under web/assets/icons/ with vector sources and a make-icons.sh regeneration script, mirroring the card art workflow.
17 lines
740 B
Bash
Executable File
17 lines
740 B
Bash
Executable File
#!/bin/sh
|
|
# Regenerate the PWA icon PNGs from the vector sources in assets/icons/.
|
|
# The PNGs are committed (like the card art) because the Docker builder has
|
|
# no SVG rasterizer; run this only after editing icon.svg or
|
|
# icon-maskable.svg. Requires rsvg-convert (librsvg).
|
|
set -eu
|
|
|
|
ICONS="$(dirname "$0")/assets/icons"
|
|
|
|
rsvg-convert -w 192 -h 192 "$ICONS/icon.svg" -o "$ICONS/icon-192.png"
|
|
rsvg-convert -w 512 -h 512 "$ICONS/icon.svg" -o "$ICONS/icon-512.png"
|
|
rsvg-convert -w 512 -h 512 "$ICONS/icon-maskable.svg" -o "$ICONS/icon-maskable-512.png"
|
|
# iOS masks the home-screen icon itself; a full-bleed square is expected.
|
|
rsvg-convert -w 180 -h 180 "$ICONS/icon-maskable.svg" -o "$ICONS/apple-touch-icon.png"
|
|
|
|
echo "icons ready in $ICONS"
|