fix: client-server time desync
This commit is contained in:
@@ -82,7 +82,13 @@ function watchAccount(onPing) {
|
||||
buf = lines.pop() ?? '';
|
||||
for (const line of lines) {
|
||||
if (line.startsWith('data: ')) {
|
||||
try { onPing(JSON.parse(line.slice(6))); } catch {}
|
||||
try {
|
||||
const ping = JSON.parse(line.slice(6));
|
||||
if (ping.checked_at && new Date(ping.checked_at).getTime() > Date.now()) {
|
||||
ping.checked_at = new Date().toISOString();
|
||||
}
|
||||
onPing(ping);
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user