Skip to content

v2.0.3

Choose a tag to compare

@github-actions github-actions released this 01 Mar 18:44
· 299 commits to main since this release

Fixed

  • Reliable fetch-interceptor injection. The interceptor is now injected via an ISOLATED-world document_start content script (spotify-inject.content.ts) that inserts a <script src="chrome-extension://..."> tag pointing to fetchInterceptor.js. Spotify's CSP explicitly whitelists the extension's chrome-extension:// origin in script-src, so the injection is CSP-compliant. Because the source file is bundled inside the extension package (no network round-trip), it loads significantly faster than Spotify's own service-worker–cached scripts and reliably wins the race. An earlier attempt using world: 'MAIN' manifest registration and script.textContent inline injection were both investigated and ruled out due to a Chromium bug with world: 'MAIN' on Service Worker–cached sites and Spotify's 'unsafe-inline' CSP restriction respectively.
  • Flash of original lyrics on song switch. The previous preloadedCacheEntry mechanism started an async browser.storage.local.get() on song change, then expected the result to be available when the synchronous syncSetup() ran milliseconds later. The storage promise always arrived too late, causing a cache miss and a visible flash of original lyrics. Replaced with a synchronous in-memory runtimeCache Map that saveSongCache populates immediately after every API round-trip. syncSetup now reads from this Map with zero latency.
  • MutationObserver batch-ordering race. Spotify can emit the aria-label attribute mutation (song key change) and lyrics-line childList mutations in the same observer batch, in any order. If lyrics nodes arrived first, syncSetup looked up the wrong (previous) song key in the runtime cache. Split the observer callback into two explicit passes — Pass 1 processes all attribute mutations (song key update), Pass 2 processes all childList mutations (lyrics injection) — ensuring onSongChange always completes before syncSetup reads songKey.
  • Gap between shimmer ending and translated lyrics appearing. setLoadingState(false) was called before applyLinesToDOM, briefly exposing raw original lyrics after the shimmer stopped. Reversed the call order: DOM text is now updated while .sly-loading is still active (text content is hidden via -webkit-text-fill-color: transparent), then the shimmer is removed, revealing already-correct text in a single paint frame.
  • Stale data-sly-original attributes in Scenario A. When applyNativeOverride rewrote DOM lines with native-script text, the data-sly-original attributes were not updated, leaving the extension's snapshot and the DOM permanently out of sync. Attributes are now updated alongside el.textContent.
  • Double-fetch race condition. syncSetup and trySetup could both reach autoSwitchIfNeeded() for the same song and fire duplicate PROCESS IPC requests. A pollId guard now cancels the rAF chain after syncSetup handles a cache hit, preventing the redundant call.
  • characterData: true observer overhead. The lyricsObserver was observing text-node mutations, firing on every karaoke highlight tick. Dropped characterData: true — childList: true alone is sufficient to detect Spotify overwriting the extension's injected text.
  • Firefox LRU cache eviction. getBytesInUse is not available in Firefox, causing evictIfNeeded to silently fail and the cache to grow without bound. Added a count-based LRU fallback that triggers when the total entry count exceeds a threshold, compatible with both Chrome and Firefox.
  • Google Translate romanization-block detection. The heuristic for identifying Google Translate's dt=rm output block was too narrow and could drop the last translated line of a chunk. Tightened the detection condition.
  • Odia language support. Added 'or' to INDIAN_LANGUAGE_CODES in the fetch interceptor so Odia songs served with romanized fallbacks correctly trigger native-script restoration.
  • Musixmatch token invalidation. On a 401/402 response from Musixmatch, _tokenExpiry was not reset to 0, so the stale token would be reused until its original TTL expired. Now resets to 0 immediately so the next call fetches a fresh token.

Added

  • Tamil romanization via tamil-romanizer. Tamil is now romanized locally using the tamil-romanizer library (practical phonetic output: zh, th, aa digraphs) instead of Google Translate's dt=rm (ISO 15919 diacritics). Romanization and translation now run in parallel, matching the pattern used for Japanese, Korean, Chinese, and other scripts. A 'tamil': 'ta' entry is also added to the native-language fast-path so translation is skipped when the user's target language is already Tamil.
  • Odia (or) added to the list of supported Indian-language scripts for native-script restoration.

Testing & Pipeline

  • Hybrid Testing Suite. Replaced legacy, brittle E2E frameworks with a rigorous hybrid workflow. Core mathematical logic (background chunking scripts) and Preact UI interactions are covered by a highly-concurrent vitest unit/component testing suite running in isolation.
  • Static Security Audit. Added strict abstract syntax tree checks (security.test.ts) that analyze the WXT compilation manifest to algorithmically guarantee the absence of broad host permissions (<all_urls>) or heavy capabilities (webRequestBlocking), preventing security regressions before they build.

Changed

  • Custom Settings UI Modal. Replaced the brittle native browser extension window.confirm() popup calls with a fully synthesized, custom Preact modal overlay matching the Spotify design system. This resolves a known Firefox squishing bug where native alerts render restricted inside the 400x500 popup frame rather than full screen.
  • fetchInterceptor.js remains in public/ and is registered under web_accessible_resources; injected via spotify-inject.content.ts using <script src> at document_start.
  • CHUNK_DELAY_MS annotated with a rationale comment explaining the empirical rate-limit basis.
  • Synchronized NON_LATIN_SCRIPT_RE in index.ts with detectScript() ranges in background.ts via a maintenance comment.
  • Removed duplicate .wxt entry from .gitignore.
  • README rewritten. Replaced the developer-first, superlative-heavy original with a user-first document: plain description, screenshots up front, accurate romanization coverage table (Tamil now listed as local), and a clean developer setup section.


Full Changelog: v2.0.2...v2.0.3