From 3e2e9ed7a561af50d7e914bb4afb918feb6c494a Mon Sep 17 00:00:00 2001 From: MacBook Date: Tue, 21 Apr 2026 08:46:28 +0200 Subject: [PATCH] feat: production-ready release v1.0.0 - Integrated 'Koala-Bridge' for seamless web-to-extension communication. - Implemented dedicated, minimalist invitation page (join.html). - Added brute-force protection and RAM-cleanup to the relay server. - Removed external fonts and trackers from the landing page (Privacy First). - Unified header/footer design across all website pages. - Added MIT License and comprehensive legal documentation (Impressum/Datenschutz). --- LICENSE | 21 +++++++ extension/background.js | 31 +++++++++++ extension/bridge.js | 31 +++++++++++ extension/manifest.json | 5 ++ extension/popup.html | 12 +++- extension/popup.js | 96 +++++++++++++++++++++++++++++++- server/index.js | 55 ++++++++++++++++++- shared/constants.js | 7 ++- website/README.md | 51 +++++++++++++++++ website/app.js | 116 +++++++++++++++++++++++++++++++++++++++ website/datenschutz.html | 88 +++++++++++++++++++++++++++++ website/impressum.html | 91 ++++++++++++++++++++++++++++++ website/index.html | 8 ++- website/join.html | 62 +++++++++++++++++++++ website/style.css | 95 +++++++++++++++++++++++++++++++- 15 files changed, 757 insertions(+), 12 deletions(-) create mode 100644 LICENSE create mode 100644 extension/bridge.js create mode 100644 website/README.md create mode 100644 website/datenschutz.html create mode 100644 website/impressum.html create mode 100644 website/join.html diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ba83bcc --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Shik3i + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/extension/background.js b/extension/background.js index 366b741..eac563b 100644 --- a/extension/background.js +++ b/extension/background.js @@ -191,9 +191,30 @@ function handleServerEvent(event, data) { currentRoom = data; addLog(`Joined Room: ${data.roomId}`, 'success'); chrome.runtime.sendMessage({ type: 'PEER_UPDATE', peers: data.peers }).catch(() => {}); + // Inform Website Bridge + chrome.tabs.query({}, (tabs) => { + tabs.forEach(tab => { + chrome.tabs.sendMessage(tab.id, { type: 'JOIN_STATUS', success: true, message: 'Joined' }).catch(() => {}); + }); + }); + break; + case EVENTS.ROOM_LIST: + chrome.runtime.sendMessage({ type: 'ROOM_LIST', rooms: data.rooms }).catch(() => {}); break; case EVENTS.ERROR: addLog(`Server Error: ${data.message}`, 'error'); + chrome.notifications.create({ + type: 'basic', + iconUrl: 'icons/icon128.png', + title: 'KoalaSync Error', + message: data.message + }); + // Inform Website Bridge + chrome.tabs.query({}, (tabs) => { + tabs.forEach(tab => { + chrome.tabs.sendMessage(tab.id, { type: 'JOIN_STATUS', success: false, message: data.message }).catch(() => {}); + }); + }); break; case EVENTS.PLAY: case EVENTS.PAUSE: @@ -327,6 +348,16 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { sendResponse(logs); } else if (message.type === 'GET_HISTORY') { sendResponse(history); + } else if (message.type === 'GET_ROOM_LIST') { + if (socket && socket.readyState === WebSocket.OPEN) { + socket.send(`42${JSON.stringify([EVENTS.GET_ROOMS])}`); + } + } else if (message.type === 'WEB_JOIN_REQUEST') { + const { roomId, password } = message; + chrome.storage.sync.set({ roomId, password }, () => { + connect(); + // We wait for status update in handleServerEvent + }); } else if (message.type === 'CONTENT_EVENT') { if (sender.tab) { currentTabId = sender.tab.id; diff --git a/extension/bridge.js b/extension/bridge.js new file mode 100644 index 0000000..ca8a8ef --- /dev/null +++ b/extension/bridge.js @@ -0,0 +1,31 @@ +/** + * KoalaSync Bridge Script + * Injected into koalasync.shik3i.net to facilitate communication between + * the landing page and the extension. + */ + +// 1. Signal presence to the website +document.documentElement.dataset.koalasyncInstalled = 'true'; + +// 2. Listen for Join Requests from the Website +window.addEventListener('KOALASYNC_JOIN_REQUEST', (e) => { + const { roomId, password } = e.detail; + chrome.runtime.sendMessage({ + type: 'WEB_JOIN_REQUEST', + roomId, + password + }); +}); + +// 3. Listen for Status Updates from the Extension and relay to Website +chrome.runtime.onMessage.addListener((msg) => { + if (msg.type === 'JOIN_STATUS') { + const event = new CustomEvent('KOALASYNC_STATUS', { + detail: { + success: msg.success, + message: msg.message + } + }); + window.dispatchEvent(event); + } +}); diff --git a/extension/manifest.json b/extension/manifest.json index a733c7d..302c6be 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -35,6 +35,11 @@ ], "run_at": "document_idle", "all_frames": false + }, + { + "matches": ["https://koalasync.shik3i.net/*"], + "js": ["bridge.js"], + "run_at": "document_start" } ], "icons": { diff --git a/extension/popup.html b/extension/popup.html index ab47434..20c97fe 100644 --- a/extension/popup.html +++ b/extension/popup.html @@ -222,7 +222,17 @@ - + + + + +
+ + +
+
+
Refreshing...
+