Prevent caching of store status updates

This commit is contained in:
chris 2025-12-26 12:58:46 -05:00
parent a3b8593133
commit 7c42800245
2 changed files with 2 additions and 2 deletions

View File

@ -63,7 +63,7 @@ app.use('/api', apiRouter);
const staticCacheOptions = { const staticCacheOptions = {
maxAge: process.env.NODE_ENV === 'production' ? '30d' : 0, maxAge: process.env.NODE_ENV === 'production' ? '30d' : 0,
setHeaders: (res, filePath) => { setHeaders: (res, filePath) => {
if (filePath.endsWith('.html')) { if (filePath.endsWith('.html') || filePath.endsWith('update.json')) {
res.setHeader('Cache-Control', 'no-store'); res.setHeader('Cache-Control', 'no-store');
} else if (/\.(js|css|svg|ico|png|jpg|jpeg|webp|avif|woff2?)$/i.test(filePath)) { } else if (/\.(js|css|svg|ico|png|jpg|jpeg|webp|avif|woff2?)$/i.test(filePath)) {
res.setHeader('Cache-Control', 'public, max-age=2592000, immutable'); res.setHeader('Cache-Control', 'public, max-age=2592000, immutable');

View File

@ -35,7 +35,7 @@ document.addEventListener('DOMContentLoaded', () => {
} }
} }
fetch('/update.json') fetch(`/update.json?ts=${Date.now()}`, { cache: 'no-store' })
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
const update = data[0]; const update = data[0];