From cd9f26911b10a2fa0cd2edde02f276785514888d Mon Sep 17 00:00:00 2001 From: Ulas Date: Wed, 1 Apr 2026 09:07:57 +0200 Subject: [PATCH] fix: improve PWA manifest and SW cache for Android standalone mode - Add id field and display_override to manifest.json for reliable Chrome Android PWA recognition - Serve manifest.json with application/manifest+json MIME type - Add /i18n.js and locale files to SW app shell cache (were missing) - Bump SW cache version to v21 Co-Authored-By: Claude Sonnet 4.6 --- public/manifest.json | 2 ++ public/sw.js | 9 ++++++--- server/index.js | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/public/manifest.json b/public/manifest.json index b3006bc..48b08d8 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -2,9 +2,11 @@ "name": "Oikos Familienplaner", "short_name": "Oikos", "description": "Selbstgehosteter Familienplaner", + "id": "/", "start_url": "/", "scope": "/", "display": "standalone", + "display_override": ["standalone", "minimal-ui"], "orientation": "portrait-primary", "theme_color": "#007AFF", "background_color": "#F5F5F7", diff --git a/public/sw.js b/public/sw.js index fcce436..8efa454 100644 --- a/public/sw.js +++ b/public/sw.js @@ -12,9 +12,9 @@ * API: Immer Netzwerk (kein Caching von Nutzerdaten) */ -const SHELL_CACHE = 'oikos-shell-v20'; -const PAGES_CACHE = 'oikos-pages-v20'; -const ASSETS_CACHE = 'oikos-assets-v20'; +const SHELL_CACHE = 'oikos-shell-v21'; +const PAGES_CACHE = 'oikos-pages-v21'; +const ASSETS_CACHE = 'oikos-assets-v21'; const ALL_CACHES = [SHELL_CACHE, PAGES_CACHE, ASSETS_CACHE]; // App-Shell: sofort benötigt für ersten Render @@ -23,7 +23,10 @@ const APP_SHELL = [ '/index.html', '/api.js', '/router.js', + '/i18n.js', '/rrule-ui.js', + '/locales/de.json', + '/locales/en.json', '/sw-register.js', '/lucide.min.js', '/styles/tokens.css', diff --git a/server/index.js b/server/index.js index 57b7356..eae7b25 100644 --- a/server/index.js +++ b/server/index.js @@ -112,6 +112,10 @@ app.use(express.static(path.join(__dirname, '..', 'public'), { // HTML, JS, CSS, JSON, manifest, sw — immer revalidieren res.setHeader('Cache-Control', 'no-cache, must-revalidate'); } + // manifest.json: korrekter MIME-Type für PWA-Erkennung durch Chrome/Android + if (filePath.endsWith('manifest.json')) { + res.setHeader('Content-Type', 'application/manifest+json; charset=utf-8'); + } }, }));