mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
ui fixes
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -11,7 +11,7 @@
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" />
|
||||
<title>Multi Roomba Rover</title>
|
||||
<script type="module" crossorigin src="/assets/index-COFUfdDa.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-256lFfdi.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-lg9md4T4.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -22,8 +22,11 @@ logger.info('Discord invite loaded:', discordInvite ? 'present' : 'not configure
|
||||
logger.info('Ko-fi link loaded:', kofiLink ? 'present' : 'not configured');
|
||||
|
||||
const ACTIVITY_SYNC_COOLDOWN_MS = 3000;
|
||||
const NIGHT_VISION_SYNC_COOLDOWN_MS = 1000;
|
||||
let lastActivitySync = 0;
|
||||
let pendingActivitySync = null;
|
||||
let lastNightVisionSync = 0;
|
||||
let pendingNightVisionSync = null;
|
||||
|
||||
function buildUserEntry(socket) {
|
||||
if (!socket) return null;
|
||||
@@ -103,10 +106,35 @@ modeEvents.on('change', () => {
|
||||
});
|
||||
|
||||
managerEvents.on('rover', () => {
|
||||
if (pendingNightVisionSync) {
|
||||
clearTimeout(pendingNightVisionSync);
|
||||
pendingNightVisionSync = null;
|
||||
}
|
||||
logger.info('Rover roster change; syncing all clients');
|
||||
syncAll();
|
||||
});
|
||||
|
||||
managerEvents.on('rover', (event = {}) => {
|
||||
if (event.action !== 'nightVision') return;
|
||||
const now = Date.now();
|
||||
const elapsed = now - lastNightVisionSync;
|
||||
if (elapsed >= NIGHT_VISION_SYNC_COOLDOWN_MS) {
|
||||
lastNightVisionSync = now;
|
||||
logger.info('Night vision update; syncing all clients (immediate)');
|
||||
syncAll();
|
||||
return;
|
||||
}
|
||||
if (!pendingNightVisionSync) {
|
||||
const delay = NIGHT_VISION_SYNC_COOLDOWN_MS - elapsed;
|
||||
pendingNightVisionSync = setTimeout(() => {
|
||||
lastNightVisionSync = Date.now();
|
||||
pendingNightVisionSync = null;
|
||||
logger.info('Night vision update; syncing all clients (delayed)');
|
||||
syncAll();
|
||||
}, delay);
|
||||
}
|
||||
});
|
||||
|
||||
managerEvents.on('lock', ({ roverId, locked }) => {
|
||||
logger.info('Rover lock change', roverId, locked);
|
||||
syncAll();
|
||||
|
||||
Reference in New Issue
Block a user