fix: serverInfo page shows data immediately on load

Eliminated redundant serverinfo RCON polling from the serverInfo page.
It now subscribes to the header's serverinfo-update CustomEvent instead.

Key changes:
- app.js: cache last serverinfo in window._lastServerInfo and dispatch
  serverinfo-update event so pages can pick up data immediately
- serverInfo.js: replaced setInterval-based polling with event listener
  plus immediate _lastServerInfo cache check, eliminating the initial
  blank page state and duplicate RCON requests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-06-13 18:20:55 +02:00
co-authored by Copilot
parent 27d67f73aa
commit b9364119da
2 changed files with 10 additions and 19 deletions
+4
View File
@@ -46,6 +46,10 @@
document.getElementById('header-players').innerHTML = '<i class="bi bi-people-fill"></i> ' + formatNumber(data.Players) + '/' + formatNumber(data.MaxPlayers);
document.getElementById('header-fps').innerHTML = '<i class="bi bi-speedometer2"></i> ' + formatNumber(data.Framerate) + 'fps';
document.getElementById('header-entities').innerHTML = '<i class="bi bi-boxes"></i> ' + formatNumber(data.EntityCount);
// Cache for late-arriving pages (e.g. serverInfo) and broadcast to listeners
window._lastServerInfo = data;
document.dispatchEvent(new CustomEvent('serverinfo-update', { detail: data }));
});
}