onlinemodus fix failed
This commit is contained in:
@@ -72,7 +72,14 @@ app.delete(/^\/db\/(.*)\.json$/, (req, res) => {
|
||||
});
|
||||
|
||||
// --- static game (same origin: no CORS, no mixed content) ------------------------------------------
|
||||
app.use(express.static(path.join(__dirname, '..', 'game')));
|
||||
app.use(express.static(path.join(__dirname, '..', 'game'), {
|
||||
etag: true,
|
||||
setHeaders(res, p) {
|
||||
// images / fonts / audio rarely change -> cache hard (fast re-renders, no re-fetch flicker)
|
||||
if (/\.(png|jpe?g|webp|gif|svg|woff2?|ttf|otf|mp3|ogg|wav|m4a)$/i.test(p)) res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
|
||||
else res.setHeader('Cache-Control', 'no-cache'); // code/html: revalidate so deploys show up
|
||||
},
|
||||
}));
|
||||
|
||||
const PORT = process.env.PORT || 8080;
|
||||
app.listen(PORT, () => console.log('Robot Clash server on :' + PORT));
|
||||
|
||||
Reference in New Issue
Block a user