You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-26 22:13:53 +01:00
hotfix for graph lag
This commit is contained in:
committed by
GitHub
parent
9984011e12
commit
aa2e3a2f16
@@ -129,6 +129,8 @@ function fetchBannedAS(callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const recentBannedIps = new Map(); // Store clientIp -> timestamp
|
||||||
|
|
||||||
function processConnection(clientIp, locationInfo, currentUsers, ws, callback) {
|
function processConnection(clientIp, locationInfo, currentUsers, ws, callback) {
|
||||||
const options = { year: "numeric", month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit" };
|
const options = { year: "numeric", month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit" };
|
||||||
const connectionTime = new Date().toLocaleString([], options);
|
const connectionTime = new Date().toLocaleString([], options);
|
||||||
@@ -140,6 +142,14 @@ function processConnection(clientIp, locationInfo, currentUsers, ws, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bannedAS.some((as) => locationInfo.as?.includes(as))) {
|
if (bannedAS.some((as) => locationInfo.as?.includes(as))) {
|
||||||
|
const now = Date.now();
|
||||||
|
const lastSeen = recentBannedIps.get(normalizedClientIp) || 0;
|
||||||
|
|
||||||
|
if (now - lastSeen > 300 * 1000) {
|
||||||
|
consoleCmd.logWarn(`Banned AS list client kicked (${normalizedClientIp})`);
|
||||||
|
recentBannedIps.set(normalizedClientIp, now);
|
||||||
|
}
|
||||||
|
|
||||||
return callback("User banned");
|
return callback("User banned");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -466,8 +466,6 @@ function initCanvas() {
|
|||||||
if ((isAndroid || isIOS || isIPadOS) && (document.hidden || !document.hasFocus())) return;
|
if ((isAndroid || isIOS || isIPadOS) && (document.hidden || !document.hasFocus())) return;
|
||||||
|
|
||||||
const sig = parsedData.sig;
|
const sig = parsedData.sig;
|
||||||
if (signalBuffer.length > 0 && signalBuffer[signalBuffer.length - 1] === sig) return; // skip if data hasn't changed
|
|
||||||
|
|
||||||
signalBuffer.push(sig);
|
signalBuffer.push(sig);
|
||||||
if (signalBuffer.length > 8) signalBuffer.shift();
|
if (signalBuffer.length > 8) signalBuffer.shift();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user