mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-07-26 12:08:15 +00:00
55c2d4ed0d
Adds a new toggleable feature that detects episode transitions via mediaTitle mutation (loadeddata/MutationObserver), pauses the video, and waits for all room peers to load the same episode before executing a coordinated Force Sync play at 0:00. Protocol: - Add EPISODE_LOBBY and EPISODE_READY events to shared/constants.js - Add EPISODE_LOBBY_TIMEOUT (60s) constant - Relay both new events in server/index.js Content Script (content.js): - Layered detection: loadeddata + MutationObserver src-change + heartbeat - Debounced onEpisodeTransition() sends signal ONLY; no eager pause - PAUSE_FOR_LOBBY handler pauses only after background confirms feature enabled - startLobbyPoll() polls title match without premature pause for non-initiators - checkAndReportLobbyReady() pauses and sends EPISODE_READY_LOCAL on match - CONTENT_BOOT recovery for re-injection after hard navigation Background (background.js): - Episode lobby state persisted in chrome.storage.session with recovery - EPISODE_CHANGED: checks setting, creates lobby, sends PAUSE_FOR_LOBBY to tab - EPISODE_LOBBY/READY server event handlers with dedup logic - 60s timeout cancels lobby (Option B) with Chrome failure notification - Peer departure handled: removes from readyPeers, re-checks completion - executeEpisodeLobby() reuses existing Force Sync pipeline at targetTime 0.0 - Lobby cleared on LEAVE_ROOM; status exposed in GET_STATUS Popup: - Auto-Sync Next Episode toggle in Settings tab (default: off, opt-in) - Episode Lobby status card in Sync tab with peer readiness display - LOBBY_UPDATE message handler for real-time UI updates Bumps APP_VERSION and manifest to 1.2.0
KoalaSync Chrome Extension
A Manifest V3 Chrome Extension for synchronized video playback across any website.
Key Features
- Manifest V3: Optimized Service Worker architecture with session persistence.
- Pure Vanilla JS: No external dependencies or heavy libraries.
- Smart Peer IDs: Hexadecimal IDs combined with customizable Usernames for easy identification.
- Dual Heartbeat: Advanced session tracking (Background) and video synchronization (Content) to prevent ghost sessions.
- Live Diagnostics: Built-in "Dev" tab for real-time video state debugging (ReadyState, CurrentTime, etc.).
Tab Overview
- Room: Manage connections, view active peers, and share invitation links.
- Sync: Control video playback (Play/Pause/Force Sync) and view recent activity.
- Settings: Customize your Username and toggle domain-based Noise Filtering.
- Dev: Monitor connection status and view real-time video element metadata for debugging.
Privacy & Permissions
KoalaSync requires <all_urls> permission to detect and interact with video elements (<video>) on websites.
- No Browsing History: We do not track or store your browsing history.
- State Management: Sensitive data (Room Passwords) is stored locally using
chrome.storage. - Zero Telemetry: No analytics or external tracking scripts.
Installation
- Sync Protocol: Run
./scripts/sync-constants.sh(macOS/Linux) orscripts\sync-constants.bat(Windows) from the root. - Open Chrome and go to
chrome://extensions/. - Enable Developer mode (top right).
- Click Load unpacked and select the
extensionfolder.
Development
If you modify shared/constants.js, you must synchronize the changes across the extension and server:
- Windows: Run
scripts\sync-constants.bat - Linux/macOS: Run
scripts/sync-constants.sh