# KoalaSync Browser Extension This directory contains the Manifest V3 browser extension for Chrome and Firefox. It owns the popup UI, background service worker, content-script video control, invitation bridge, audio processing, and all browser-local settings. ## Where You Are - `manifest.base.json` is the source manifest. The build script creates browser-specific `manifest.json` files in `dist/chrome/` and `dist/firefox/`. - `background.js` is the long-lived coordinator: WebSocket client, room state, host-control authority, heartbeat, reconnects, tab selection, and content-script injection. - `content.js` runs in the selected video tab. It detects video state, applies remote play/pause/seek, handles episode transitions, and applies local audio processing. - `popup.html` and `popup.js` implement the visible extension UI. - `extension/shared/` is generated by `npm run build:extension` from the root `shared/` directory. Do not edit it directly. ## Key Features - **Manifest V3**: Service-worker architecture with session persistence and explicit keep-alive handling. - **Pure Vanilla JS**: No extension runtime dependencies and no bundler inside `extension/`. - **On-Demand Connection**: The service worker connects only while the user intends to be in a room. - **Host Control & Co-Hosts**: Hosts can switch a room into `host-only` mode and grant controller rights to trusted peers. - **Episode Auto-Sync**: Title/episode changes can open a lobby so peers resume together once everyone is ready. - **Smart Matching & Title Privacy**: Matching video tabs are highlighted, while tab/media title sharing can be reduced or disabled. - **Audio Processing**: Optional local compressor settings live in the dedicated audio options page. - **Status Diagnostics**: The Status tab exposes connection state, ping, video debug data, action history, and copyable logs. - **Dynamic i18n**: 15 languages are supported: `en`, `de`, `fr`, `es`, `it`, `nl`, `pl`, `pt`, `pt-BR`, `tr`, `ru`, `ja`, `ko`, `zh`, and `uk`. ## Tab Overview 1. **Room**: Select official/custom server, create or join rooms, view peers, share invite links, and manage Host Control when supported by the relay. 2. **Sync**: Select the video tab, send play/pause/seek/force-sync actions, and view episode lobby state. 3. **Settings**: Configure username, title sharing, noise filtering, auto episode sync, notifications, language, and audio options. 4. **Status**: Inspect connection state, latency, video debug info, history, and logs for bug reports. 5. **Dev**: Hidden developer-only controls shown for the `KoalaDev` username. ## Privacy & Permissions KoalaSync requires `` host permission so it can detect and control `