This commit is contained in:
sebseb7
2025-12-21 01:06:59 +01:00
parent bef70e4709
commit 6944111f84
9 changed files with 309 additions and 18 deletions

View File

@@ -232,7 +232,7 @@ app.get('/api/history', (req, res) => {
}
const stmt = db.prepare(`
SELECT timestamp, temp_c, humidity, vpd, fan_speed, on_speed
SELECT timestamp || 'Z' as timestamp, temp_c, humidity, vpd, fan_speed, on_speed
FROM readings
WHERE dev_name = ? AND port = ? AND timestamp >= datetime('now', ?)
ORDER BY timestamp ASC
@@ -252,6 +252,12 @@ app.get('/api/history', (req, res) => {
const devMiddleware = webpackDevMiddleware(compiler, {
publicPath: '/',
writeToDisk: false,
headers: (req, res, context) => {
// Set cache headers for hashed bundle files (immutable)
if (req.url && req.url.match(/\.[a-f0-9]{8,}\.(js|css)$/i)) {
res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
}
}
});
app.use(devMiddleware);