This commit is contained in:
+12
-5
@@ -64,10 +64,16 @@ await mkdir(join(assetRoot, 'piper'), {recursive: true});
|
||||
for (const file of voiceFiles) await downloadVoiceFile(file);
|
||||
await cp(join(root, 'PIPER_VOICE_NOTICES.txt'), join(assetRoot, 'voices', 'ATTRIBUTION.txt'));
|
||||
|
||||
const wasmFiles = (await readdir(onnxSource))
|
||||
.filter(name => name.endsWith('.wasm'));
|
||||
if (wasmFiles.length === 0) throw new Error('ONNX Runtime WebAssembly files are missing');
|
||||
for (const file of wasmFiles) {
|
||||
const onnxRuntimeFiles = (await readdir(onnxSource))
|
||||
.filter(name => name.endsWith('.wasm') || name.endsWith('.mjs'));
|
||||
const requiredOnnxRuntimeFiles = [
|
||||
'ort-wasm-simd-threaded.wasm',
|
||||
'ort-wasm-simd-threaded.mjs',
|
||||
];
|
||||
for (const file of requiredOnnxRuntimeFiles) {
|
||||
if (!onnxRuntimeFiles.includes(file)) throw new Error(`Missing ONNX Runtime asset: ${file}`);
|
||||
}
|
||||
for (const file of onnxRuntimeFiles) {
|
||||
await cp(join(onnxSource, file), join(assetRoot, 'onnx', file));
|
||||
}
|
||||
for (const file of [piperWasm, piperData]) {
|
||||
@@ -106,7 +112,8 @@ for (const file of voiceFiles) {
|
||||
}
|
||||
const workerBundle = await (await import('node:fs/promises')).readFile(join(assetRoot, 'piper-worker.js'), 'utf8');
|
||||
if (!workerBundle.includes('https://huggingface.co/diffusionstudio/piper-voices/resolve/main/') ||
|
||||
!workerBundle.includes('/tts/piper-wasm-v1/voices/')) {
|
||||
!workerBundle.includes('/tts/piper-wasm-v1/voices/') ||
|
||||
!workerBundle.includes('/tts/piper-wasm-v1/onnx/')) {
|
||||
throw new Error('The Piper worker is missing its same-origin model download route.');
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ grep -q 'Cross-Origin-Embedder-Policy "require-corp"' nginx/default.conf
|
||||
grep -q 'add_header Cross-Origin-Embedder-Policy "require-corp" always;' nginx/default.conf
|
||||
grep -q 'add_header Cross-Origin-Resource-Policy "same-origin" always;' nginx/default.conf
|
||||
grep -q 'application/javascript js;' nginx/default.conf
|
||||
grep -q 'application/javascript js mjs;' nginx/default.conf
|
||||
grep -q "request('/version')" index.html
|
||||
grep -Fq "credentials: 'same-origin'" index.html
|
||||
grep -q 'id="dialogue" aria-label="Dialoghistorik" role="log" aria-live="polite"' index.html
|
||||
@@ -47,6 +48,9 @@ grep -q 'new Worker(workerUrl)' piper-runtime.js
|
||||
grep -q 'worker.js?v=' piper-runtime.js
|
||||
grep -q 'worker.onmessageerror' piper-runtime.js
|
||||
grep -q 'localPiperModelUrl' piper-worker.js
|
||||
grep -q 'createOnnxWasmPaths(self.location.origin)' piper-worker.js
|
||||
grep -q 'ort-wasm-simd-threaded.mjs' scripts/build-piper.mjs
|
||||
grep -q 'ort-wasm-simd-threaded.wasm' scripts/build-piper.mjs
|
||||
grep -q 'PIPER_MODEL_ORIGIN' piper-model-routing.mjs
|
||||
grep -q '/tts/piper-wasm-v1/voices/' piper-model-routing.mjs
|
||||
grep -q 'same-origin.*voice' README.md
|
||||
|
||||
Reference in New Issue
Block a user