Repository navigation
v2.0.3
Fixed
- Reliable fetch-interceptor injection. The interceptor is now injected via an ISOLATED-world
document_startcontent script (spotify-inject.content.ts) that inserts a<script src="chrome-extension://...">tag pointing tofetchInterceptor.js. Spotify's CSP explicitly whitelists the extension'schrome-extension://origin inscript-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 usingworld: 'MAIN'manifest registration andscript.textContentinline injection were both investigated and ruled out due to a Chromium bug withworld: 'MAIN'on Service Worker–cached sites and Spotify's'unsafe-inline'CSP restriction respectively. - Flash of original lyrics on song switch. The previous
preloadedCacheEntrymechanism started an asyncbrowser.storage.local.get()on song change, then expected the result to be available when the synchronoussyncSetup()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-memoryruntimeCacheMap thatsaveSongCachepopulates immediately after every API round-trip.syncSetupnow reads from this Map with zero latency. - MutationObserver batch-ordering race. Spotify can emit the
aria-labelattribute mutation (song key change) andlyrics-linechildList mutations in the same observer batch, in any order. If lyrics nodes arrived first,syncSetuplooked 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) — ensuringonSongChangealways completes beforesyncSetupreadssongKey. - Gap between shimmer ending and translated lyrics appearing.
setLoadingState(false)was called beforeapplyLinesToDOM, briefly exposing raw original lyrics after the shimmer stopped. Reversed the call order: DOM text is now updated while.sly-loadingis 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-originalattributes in Scenario A. WhenapplyNativeOverriderewrote DOM lines with native-script text, thedata-sly-originalattributes were not updated, leaving the extension's snapshot and the DOM permanently out of sync. Attributes are now updated alongsideel.textContent. - Double-fetch race condition.
syncSetupandtrySetupcould both reachautoSwitchIfNeeded()for the same song and fire duplicatePROCESSIPC requests. ApollIdguard now cancels the rAF chain aftersyncSetuphandles a cache hit, preventing the redundant call. characterData: trueobserver overhead. ThelyricsObserverwas observing text-node mutations, firing on every karaoke highlight tick. DroppedcharacterData: true—childList: truealone is sufficient to detect Spotify overwriting the extension's injected text.- Firefox LRU cache eviction.
getBytesInUseis not available in Firefox, causingevictIfNeededto 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=rmoutput block was too narrow and could drop the last translated line of a chunk. Tightened the detection condition. - Odia language support. Added
'or'toINDIAN_LANGUAGE_CODESin 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,
_tokenExpirywas not reset to0, so the stale token would be reused until its original TTL expired. Now resets to0immediately so the next call fetches a fresh token.
Added
- Tamil romanization via
tamil-romanizer. Tamil is now romanized locally using thetamil-romanizerlibrary (practical phonetic output:zh,th,aadigraphs) instead of Google Translate'sdt=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
vitestunit/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.jsremains inpublic/and is registered underweb_accessible_resources; injected viaspotify-inject.content.tsusing<script src>atdocument_start.CHUNK_DELAY_MSannotated with a rationale comment explaining the empirical rate-limit basis.- Synchronized
NON_LATIN_SCRIPT_REinindex.tswithdetectScript()ranges inbackground.tsvia a maintenance comment. - Removed duplicate
.wxtentry 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