diff --git a/public_html/index.html b/public_html/index.html index a54b84a..d920156 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -885,10 +885,15 @@ let faceLoopId = null; let lastFaceSeen = 0; let autoMicCooldown = 0; let faceApiReady = false; +let lastActivity = Date.now(); +const IDLE_RELOAD_MS = 5 * 60 * 1000; // 5 min inactivity → full reload const FACE_MODEL_URL = 'https://cdn.jsdelivr.net/gh/justadudewhohacks/face-api.js@0.22.2/weights'; // ── INIT ───────────────────────────────────────────────────────────── -window.addEventListener('load', () => { +window.addEventListener("load", () => { + ["mousemove","keydown","touchstart","click"].forEach(e => + window.addEventListener(e, () => { lastActivity = Date.now(); }, {passive:true}) + ); updateClock(); setInterval(updateClock, 1000); initVoice(); @@ -954,6 +959,7 @@ function showApp(name, greeting) { // Start data refresh refreshAll(); refreshTimer = setInterval(refreshAll, 10000); // every 10s + setInterval(() => { if (Date.now() - lastActivity > IDLE_RELOAD_MS) location.reload(); }, 30000); loadNetwork(); loadHA(); checkAgentStatus();