mirror of
https://gitlab.com/vyla-entertainment/home.git
synced 2026-11-13 13:47:21 -05:00
disable express static caching to resolve stale UI on app updates
This commit is contained in:
28
main.js
28
main.js
@@ -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')));
|
||||
|
||||
Reference in New Issue
Block a user