diff --git a/main.js b/main.js index 88c0f87..e0a6402 100644 --- a/main.js +++ b/main.js @@ -61,6 +61,9 @@ window.open = function(url) { ` ); 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')));