disable express static caching to resolve stale UI on app updates

This commit is contained in:
2026-08-28 16:57:17 -07:00
parent d774bed69b
commit 547eb59709

28
main.js
View File

@@ -61,6 +61,9 @@ window.open = function(url) {
</script></head>`
);
res.set('Content-Type', 'text/html');
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
res.set('Expires', '-1');
res.set('Pragma', 'no-cache');
res.send(injected);
});
};
@@ -281,8 +284,16 @@ async function start() {
res.sendStatus(200);
});
playerExpressApp.use(sameTabNavMiddleware(playerDir));
playerExpressApp.use(express.static(playerDir, { maxAge: '1d', etag: true }));
playerExpressApp.get('*', (req, res) => { res.sendFile(path.join(playerDir, 'index.html')); });
playerExpressApp.use(express.static(playerDir, {
etag: false,
setHeaders: (res) => {
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
}
}));
playerExpressApp.get('*', (req, res) => {
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
res.sendFile(path.join(playerDir, 'index.html'));
});
playerExpressServer = playerExpressApp.listen(3001, '127.0.0.1');
debugLog("Player Express running on 3001");
@@ -305,9 +316,18 @@ async function start() {
sendToTauri('tauri-cmd', { cmd: req.params.cmd, url: req.query.url, window: req.query.window });
res.sendStatus(200);
});
expressApp.use(sameTabNavMiddleware(frontendDir));
expressApp.use(express.static(frontendDir, { maxAge: '1d', etag: true }));
expressApp.get('*', (req, res) => { res.sendFile(path.join(frontendDir, 'index.html')); });
expressApp.use(express.static(frontendDir, {
etag: false,
setHeaders: (res) => {
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
}
}));
expressApp.get('*', (req, res) => {
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
res.sendFile(path.join(frontendDir, 'index.html'));
});
const FRONTEND_PORT = 4890;
expressApp.use('/build', express.static(path.join(__dirname, 'build')));