Optimize frontend rendering, CSS, and backend history caching

This commit is contained in:
2026-07-04 23:14:47 +02:00
parent b888d3d3fb
commit d157d34fca
5 changed files with 88 additions and 48 deletions
+7 -2
View File
@@ -82,17 +82,22 @@ console.log(`[startup] Listening on: http://0.0.0.0:${PORT}`);
// History helpers
// ──────────────────────────────────────────────────────────────────────────────
let historyCache = null;
async function readHistory() {
if (historyCache !== null) return historyCache;
try {
const raw = await readFile(HISTORY_FILE, 'utf-8');
const parsed = JSON.parse(raw);
return Array.isArray(parsed) ? parsed : [];
historyCache = Array.isArray(parsed) ? parsed : [];
} catch {
return [];
historyCache = [];
}
return historyCache;
}
async function writeHistory(entries) {
historyCache = entries;
await writeFile(HISTORY_FILE, JSON.stringify(entries, null, 2), 'utf-8');
}