From 5067b8e5410b95e6197fcd325291fcecb3a0da61 Mon Sep 17 00:00:00 2001 From: Timo <6156589+Shik3i@users.noreply.github.com> Date: Mon, 25 May 2026 02:24:50 +0200 Subject: [PATCH] fix(extension): exclude own tab from smart match and send immediate heartbeat after injection --- extension/content.js | 3 +++ extension/popup.js | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/extension/content.js b/extension/content.js index e0f30ad..4e05c1c 100644 --- a/extension/content.js +++ b/extension/content.js @@ -577,6 +577,9 @@ setupListeners(); schedulePeriodicHeartbeat(); + // Immediate heartbeat on injection — populate peer data without waiting 15s + setTimeout(() => sendHeartbeat(), 300); + // Episode Auto-Sync: Boot recovery — check if background has an active lobby chrome.runtime.sendMessage({ type: 'CONTENT_BOOT' }, (res) => { if (res && res.lobbyActive && res.expectedTitle) { diff --git a/extension/popup.js b/extension/popup.js index c7b5a50..000e7d5 100644 --- a/extension/popup.js +++ b/extension/popup.js @@ -431,8 +431,11 @@ async function populateTabs(providedPeers = null, providedTargetTabId = null) { option.value = tab.id; const title = (tab.title || 'Loading...'); - // Smart Matching Logic - const peerTitles = peerIds.map(p => p.tabTitle).filter(t => t && t.length > 3); + // Smart Matching Logic — exclude own tabTitle to prevent self-match + const peerTitles = peerIds + .filter(p => (typeof p === 'object' ? p.peerId : p) !== localPeerId) + .map(p => (typeof p === 'object' ? p.tabTitle : null)) + .filter(t => t && t.length > 3); const isMatch = peerTitles.some(pt => { const t1 = title.toLowerCase(); const t2 = pt.toLowerCase();