PWA-Reload sauber: nur bei App-Oeffnen oder Dashboard-Klick, niemals bei Eingaben; version.txt im Build, SW v4, Carousel 4 Icons, Kalender ohne Komma

This commit is contained in:
2026-06-02 22:14:02 +02:00
parent d85a837f4d
commit 9e57f7a567
5 changed files with 100 additions and 60 deletions

View File

@@ -78,7 +78,9 @@ app.get('/manifest.json', (_req, res) => {
app.get('/sw.js', (_req, res) => {
res.setHeader('Content-Type', 'application/javascript');
res.setHeader('Service-Worker-Allowed', '/');
res.setHeader('Cache-Control', 'no-cache');
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate');
res.setHeader('Pragma', 'no-cache');
res.setHeader('Expires', '0');
res.sendFile(path.join(PUBLIC, 'sw.js'));
});
@@ -88,12 +90,6 @@ app.use(express.static(PUBLIC, {
if (filePath.match(/\.(js|css)$/) && !filePath.includes('sw.js')) {
res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
}
// index.html niemals cachen auch nicht über express.static
if (filePath.endsWith('index.html')) {
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate');
res.setHeader('Pragma', 'no-cache');
res.setHeader('Expires', '0');
}
}
}));
@@ -101,7 +97,6 @@ app.use(express.static(PUBLIC, {
app.get('*', (_req, res) => {
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate');
res.setHeader('Pragma', 'no-cache');
res.setHeader('Expires', '0');
res.sendFile(path.join(PUBLIC, 'index.html'));
});