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 Relay Server
A high-performance Node.js relay server for synchronized video playback.
Key Features
- Zero-Persistence: No database. All state is held in RAM.
- Privacy First: No tracking, no logging of user data.
- WebSocket Only: High performance with minimal overhead.
Setup
Environment
Copy .env.example to .env and configure your settings.
PORT=3000
MAX_ROOMS=100
MAX_PEERS_PER_ROOM=20
MIN_VERSION=1.0.0
Docker (Recommended)
The server is designed to run in a Docker container.
# Build from the repository root
docker build -t koala-sync-server -f server/Dockerfile .
Manual Setup
cd server
npm install
npm start
Security
- Rate Limiting: IP-based connection limits and socket-based event limits.
- Token Handshake: Requires a valid token defined in
shared/constants.js. - In-Memory: Rooms are automatically pruned after 2 hours of inactivity.