From 28c72c76dd9b923f3e62a6ba7574ff949d76aee0 Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Fri, 4 Sep 2026 12:57:53 +0200 Subject: [PATCH] refactor: scope voice sources --- CHANGELOG.md | 2 ++ VERSION | 2 +- docs/ARCHITECTURE.md | 1 + static/index.html | 16 ++++++++-------- static/js/voice-sources.js | 19 +++++++++++++++++++ 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00b4b7b..2c5198b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi ## [Unreleased] ### Changed +- **Voice-source namespace migration.** Source URL management, filtering, source metadata normalization, and library + import helpers now use a private scope with explicit compatibility exports and a `window.TTVC.voiceSources` API. - **Voice-clone namespace migration.** Clone audio loading/upload, microphone monitoring, design presets, and voice-design actions now use a private scope with explicit compatibility exports and a `window.TTVC.voiceClone` API. - **TTS preview namespace migration.** Backend voice selection, Fish emotion tags, preview synthesis, stream fallback, diff --git a/VERSION b/VERSION index 68f8db5..082a2e6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.24.76 +1.24.77 diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index cb93f71..48626e9 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -66,6 +66,7 @@ Done incrementally as global-scope ordered files (no ES-module change needed) - ✅ Settings state and backend configuration use a private scope with live compatibility accessors and a namespace API. - ✅ TTS preview and performance-history helpers use a private scope with explicit preview/history compatibility exports. - ✅ Voice-clone audio, recording, and design controls use a private scope with explicit compatibility exports. +- ✅ Voice-source discovery and import helpers use a private scope with explicit source-list/import compatibility exports. - ✅ `static/css/resource-diagnostics.css` — isolated Performance/resource diagnostic panel styles. - ✅ `static/css/background-jobs.css` — isolated background-job history and retry-panel styles. - ✅ `static/css/voice-design.css` — isolated Voice Design form, samples, and preview-match styles. diff --git a/static/index.html b/static/index.html index 91b2a0a..5da5b53 100644 --- a/static/index.html +++ b/static/index.html @@ -10,7 +10,7 @@ - + @@ -27,12 +27,12 @@ - - - - - - + + + + + + @@ -397,7 +397,7 @@ window.toggleNavTree = function(treeId, chevronId) { - + diff --git a/static/js/voice-sources.js b/static/js/voice-sources.js index 4ec577c..eb97f7e 100644 --- a/static/js/voice-sources.js +++ b/static/js/voice-sources.js @@ -1,4 +1,6 @@ // -- Get voices --------------------------------------------------------------- + +(function (root) { const DEFAULT_VOICE_SOURCE_URLS = [ 'https://aiartes.com/voiceai', 'https://sample-files.com/downloads/audio/wav/voice-sample.wav', @@ -297,3 +299,20 @@ $('getvoices-list')?.addEventListener('click', async e => { toast('Source URL copied', 'success'); }); +Object.assign(root, { + DEFAULT_VOICE_SOURCE_URLS, VOICE_SOURCE_STORAGE_KEY, _voiceSourcePayload, _voiceSourceItems, + sourceTextareaValueFromDefaults, initGetVoiceSourcesEditor, getEditableVoiceSourceUrls, + getVoiceSourceItems, voiceSourceSearchText, setOptions, renderGetVoices, loadGetVoices, + SOURCE_LANGUAGE_CODES, sourceLanguageCode, sourceGenderCode, suggestedVoiceIdFromSourceName, + setLibAddSourcePreview, getSourceVoiceInLibrary, +}); +root.TTVC = root.TTVC || {}; +root.TTVC.voiceSources = root.TTVC.voiceSources || {}; +Object.assign(root.TTVC.voiceSources, { + list: getVoiceSourceItems, + load: loadGetVoices, + import: getSourceVoiceInLibrary, + sourceLanguageCode, + sourceGenderCode, +}); +})(window);