From bcb1a825d38d0ee13cfa923b49dad67c86239e93 Mon Sep 17 00:00:00 2001 From: Smittix Date: Tue, 6 Jan 2026 22:33:38 +0000 Subject: [PATCH] Prevent duplicate signal hits in Listening Post MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added duplicate detection to addSignalHit(): - Tracks recent signals by frequency in a Map - Ignores same frequency within 5 seconds - Auto-cleans entries older than 30 seconds 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- templates/index.html | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/templates/index.html b/templates/index.html index 7959e17..cb8cbef 100644 --- a/templates/index.html +++ b/templates/index.html @@ -8666,10 +8666,32 @@ ).join(''); } + // Track recent signal hits to prevent duplicates + let recentSignalHits = new Map(); // frequency -> timestamp + function addSignalHit(data) { const tbody = document.getElementById('scannerHitsBody'); - const now = new Date(); - const timestamp = now.toLocaleTimeString(); + const now = Date.now(); + const freqKey = data.frequency.toFixed(3); + + // Check for duplicate - same frequency within last 5 seconds + if (recentSignalHits.has(freqKey)) { + const lastHit = recentSignalHits.get(freqKey); + if (now - lastHit < 5000) { + // Duplicate, skip + return; + } + } + recentSignalHits.set(freqKey, now); + + // Clean up old entries (older than 30 seconds) + for (const [freq, time] of recentSignalHits) { + if (now - time > 30000) { + recentSignalHits.delete(freq); + } + } + + const timestamp = new Date().toLocaleTimeString(); // Remove "no signals" placeholder if present if (tbody.innerHTML.includes('No signals detected')) {