baustelle-pwa/manifest.webmanifest
Eduard Wisch 7c9563ec90
All checks were successful
Deploy baustelle-pwa / deploy (push) Successful in 1s
feat: PWA Cache-Busting via filemtime (claude-db #201) — kein manuelles Hochzählen mehr
Das bisherige 'CACHE = baustelle-vN' Pattern erforderte, dass ich bei
jeder Änderung drei Stellen synchron halte (sw.js, index.html ?v=,
manifest). Eddy hat klargestellt dass das nicht akzeptabel ist.

Fix nach KB #201 Pattern (referenz: dolibarr.stundenzettel v2.2.0):

1. index.html → index.php
   PHP berechnet bei jedem Request filemtime() von app.css, app.js,
   lib/*.js, manifest.webmanifest. Die mtimes kommen automatisch
   beim Deploy (rsync preserviert sie default) und werden als ?v=
   an alle Asset-URLs gehängt.

2. sw.js liest Version aus eigener URL-Query:
   const SW_VERSION = (new URL(self.location.href)).searchParams.get('v')
   const CACHE = 'baustelle-' + SW_VERSION
   activate() löscht alle caches die mit 'baustelle-' anfangen aber
   nicht der aktuelle sind.

3. Client-Registration mit Auto-Update:
   - setInterval 60s reg.update()
   - visibilitychange-Listener für Tab-Fokus
   - updatefound → SKIP_WAITING postMessage
   - controllerchange → einmaliger location.reload

4. SHELL pre-cache enthält nur statische Dateien (index.php, share.html,
   icons). CSS/JS werden beim ersten fetch dynamisch gecached — so
   gibt es keinen Mix zwischen alten und neuen ?v= Versionen.

5. manifest.webmanifest start_url auf /custom/baustelle/index.php

Ergebnis: Ich deploye → mtime ändert sich → neue URLs → Browser holt
frische Files → SW aktiviert automatisch beim nächsten Tab-Fokus.
Nie wieder manuelles Hochzählen.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
[deploy]
2026-04-09 01:26:26 +02:00

35 lines
1.4 KiB
JSON

{
"name": "Baustelle — Bericht-Doku",
"short_name": "Baustelle",
"description": "Mobile Doku für Baustellen — Fotos, Sprachnotizen, Skizzen",
"id": "/custom/baustelle/",
"start_url": "/custom/baustelle/index.php",
"scope": "/custom/baustelle/",
"display": "standalone",
"orientation": "portrait",
"background_color": "#1a1a1f",
"theme_color": "#1a1a1f",
"lang": "de",
"dir": "ltr",
"categories": ["productivity", "business", "utilities"],
"icons": [
{ "src": "icons/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any" },
{ "src": "icons/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any" },
{ "src": "icons/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "maskable" },
{ "src": "icons/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" }
],
"share_target": {
"action": "https://awl.data-it-solution.de/custom/baustelle/share.html",
"method": "POST",
"enctype": "multipart/form-data",
"params": {
"title": "title",
"text": "text",
"url": "url",
"files": [
{ "name": "photos", "accept": ["image/jpeg", "image/png", "image/webp", "image/*"] },
{ "name": "file", "accept": ["image/jpeg", "image/png", "image/webp", "image/*"] }
]
}
}
}