feat: TurboSu initial release - racing telemetry dashboard

This commit is contained in:
Yei.J. (AskaEth)
2026-07-25 15:23:40 +08:00
commit d61bb61a83
61 changed files with 5270 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
const Topbar = {
_statusEl: null,
init() {
this._statusEl = document.getElementById('connection-status');
document.getElementById('theme-toggle').addEventListener('click', () => {
Theme.toggle();
});
WS.on('status', (status) => {
this._statusEl.className = `status-indicator ${status}`;
this._statusEl.querySelector('.status-text').textContent =
status === 'connected' ? '已连接' :
status === 'error' ? '连接错误' : '未连接';
});
setInterval(() => this._refreshStatus(), 5000);
},
async _refreshStatus() {
try {
const status = await API.getStatus();
const wsStatus = status.ws_clients > 0 ? 'connected' : 'disconnected';
this._statusEl.className = `status-indicator ${wsStatus}`;
this._statusEl.querySelector('.status-text').textContent =
wsStatus === 'connected' ? `已连接 (${status.ws_clients})` : '未连接';
} catch (e) {}
}
};
window.Topbar = Topbar;