diff --git a/extension/background.js b/extension/background.js index 4b6c80d..a379eec 100644 --- a/extension/background.js +++ b/extension/background.js @@ -976,6 +976,10 @@ async function routeToContent(action, payload) { const actionTimestamp = payload?.actionTimestamp || Date.now(); const commandSenderId = payload?.senderId || null; + _routeToContentInternal(tabId, action, payload, actionTimestamp, commandSenderId, 0); +} + +function _routeToContentInternal(tabId, action, payload, actionTimestamp, commandSenderId, retries) { chrome.tabs.sendMessage(tabId, { type: 'SERVER_COMMAND', action, @@ -983,12 +987,18 @@ async function routeToContent(action, payload) { actionTimestamp, commandSenderId }).catch(err => { + if (retries >= 3) { + addLog(`Content Script not responding in tab ${tabId} after ${retries} retries`, 'warn'); + currentTabId = null; + updateBadgeStatus(); + return; + } if (err.message.includes('Receiving end does not exist') || err.message.includes('Extension context invalidated')) { chrome.scripting.executeScript({ target: { tabId }, files: ['content.js'] }).then(() => { - setTimeout(() => routeToContent(action, payload), 500); + setTimeout(() => _routeToContentInternal(tabId, action, payload, actionTimestamp, commandSenderId, retries + 1), 500); }).catch(_err => { addLog(`Auto-reinject failed for tab ${tabId}`, 'warn'); }); diff --git a/extension/manifest.base.json b/extension/manifest.base.json index b655783..7a181af 100644 --- a/extension/manifest.base.json +++ b/extension/manifest.base.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "KoalaSync", - "version": "1.8.10", + "version": "1.9.0", "description": "Synchronize video playback on YouTube, Netflix, Emby, Jellyfin, and any HTML5 site in real-time with friends.", "permissions": [ "storage", diff --git a/package.json b/package.json index d5a4c27..a7a57b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "koalasync", - "version": "1.8.10", + "version": "1.9.0", "description": "KoalaSync Build Scripts", "private": true, "scripts": { diff --git a/server/index.js b/server/index.js index 7ff1861..ba4c217 100644 --- a/server/index.js +++ b/server/index.js @@ -342,6 +342,11 @@ io.on('connection', (socket) => { } } + if (!room) { + socket.emit(EVENTS.ERROR, { message: "Join error" }); + return; + } + if (!createdByMe) { if (room.passwordHash) { if (!password || !(await bcrypt.compare(password, room.passwordHash))) { diff --git a/shared/constants.js b/shared/constants.js index 361133f..b924d70 100644 --- a/shared/constants.js +++ b/shared/constants.js @@ -7,7 +7,7 @@ */ export const PROTOCOL_VERSION = "1.0.0"; -export const APP_VERSION = "1.8.6"; +export const APP_VERSION = "1.9.0"; export const OFFICIAL_SERVER_URL = 'wss://syncserver.koalastuff.net'; export const OFFICIAL_LANDING_PAGE_URL = 'https://sync.koalastuff.net';