1
0
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:
Amateur Audio Dude
2025-04-23 22:21:46 +10:00
committed by GitHub
parent 9984011e12
commit aa2e3a2f16
2 changed files with 10 additions and 2 deletions

View File

@@ -129,6 +129,8 @@ function fetchBannedAS(callback) {
});
}
const recentBannedIps = new Map(); // Store clientIp -> timestamp
function processConnection(clientIp, locationInfo, currentUsers, ws, callback) {
const options = { year: "numeric", month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit" };
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))) {
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");
}

View File

@@ -466,8 +466,6 @@ function initCanvas() {
if ((isAndroid || isIOS || isIPadOS) && (document.hidden || !document.hasFocus())) return;
const sig = parsedData.sig;
if (signalBuffer.length > 0 && signalBuffer[signalBuffer.length - 1] === sig) return; // skip if data hasn't changed
signalBuffer.push(sig);
if (signalBuffer.length > 8) signalBuffer.shift();