The v2.5.2 Disney+ page-API integration leaked blob-relative <video> time into force sync, seeks, and heartbeats when the page-API bridge had no fresh data, so force sync on Disney+ appeared broken. - getSyncCurrentTime/getSyncDuration now refuse native values on Disney+ (return null/0) so stale bridge data degrades to a clean no-op instead of broadcasting garbage to peers. The get_current_time handler and episode/lobby/hcmIsLive paths are routed through the same accessor. - Validate FORCE_SYNC_PREPARE/SEEK payloads as finite before relaying; the internal coercion no longer treats '' as 0. - Stop double-routing FORCE_SYNC_PREPARE from the popup path (the generic popup route now covers only play/pause/seek). - popup force-sync: exclude null/empty peer times from the jump-to-others median (Number(null)===0 was dragging the target to 0), guard against NaN end-to-end, clear the dangling reset timer on failure, and retry without re-injecting when the content script responds but the Disney+ bridge has not yet delivered a finite time. - hcmIsLive skips the native-duration live signal on Disney+ only, preserving YouTube/Twitch Infinity-duration live detection. Disney-specific logic remains strictly gated to disneyplus.com; no Netflix/YouTube/Twitch/generic path is affected.
Development Scripts
This directory contains utility scripts for the KoalaSync development workflow.
build-extension.cjs
The primary build tool for KoalaSync. This Node.js script automates two critical tasks:
- Protocol Synchronization: Copies the "Single Source of Truth" constants (
shared/constants.js) and the domain blacklist (shared/blacklist.js) from the root/shareddirectory into theextension/shared/directory. - Content Script Injection: Injects protocol constants directly into
content.jsusing marker-based replacement. This is necessary becausecontent.jsexecutes synchronously and cannot use ES module imports. - Artifact Generation: Compiles the extension into browser-specific bundles for Chrome and Firefox, located in the
dist/directory.
Usage
From the repository root, run:
node scripts/build-extension.cjs
Why this script exists
KoalaSync uses Vanilla JS in the extension to maintain zero runtime dependencies and maximum privacy. Since we don't use a bundler (like Webpack or Vite) inside the extension, this script serves as our lightweight "pre-build" step to ensure that the protocol constants remain synchronized between the extension and the relay server.
Content Injection Markers
The build script uses marker comments in content.js to locate and replace constant blocks:
| Marker Pair | Injected Value | Source |
|---|---|---|
SHARED_EVENTS_INJECT_START / END |
The full EVENTS object |
shared/constants.js |
SHARED_HEARTBEAT_INJECT_START / END |
HEARTBEAT_INTERVAL value |
shared/constants.js |
⚠️ Do NOT remove or modify these marker comments in
content.js. They are required for the build script to function. If the markers are missing, the build will fail with a clear error message.