const REFRESH_INTERVAL = 30; let _countdownTimer = null; function _startRefreshCountdown() { if (_countdownTimer) clearInterval(_countdownTimer); let secs = REFRESH_INTERVAL; const el = document.getElementById('lastRefresh'); const update = () => { const t = new Date().toLocaleTimeString(); el.textContent = `Updated ${t} — next in ${secs}s`; if (secs <= 0) secs = REFRESH_INTERVAL; else secs--; }; update(); _countdownTimer = setInterval(update, 1000); } loadDashboard(); loadShares(); loadUsers(); loadGroups(); setInterval(() => { loadDashboard(); loadShares(); loadUsers(); loadGroups(); }, REFRESH_INTERVAL * 1000);