Fix isolation headers for Piper worker
Build and publish frontend / publish (push) Successful in 53s
Build and publish frontend / publish (push) Successful in 53s
This commit is contained in:
@@ -15,6 +15,9 @@ server {
|
|||||||
application/javascript js;
|
application/javascript js;
|
||||||
}
|
}
|
||||||
add_header Cache-Control "public, max-age=31536000, immutable" always;
|
add_header Cache-Control "public, max-age=31536000, immutable" always;
|
||||||
|
add_header Cross-Origin-Opener-Policy "same-origin" always;
|
||||||
|
add_header Cross-Origin-Embedder-Policy "require-corp" always;
|
||||||
|
add_header Cross-Origin-Resource-Policy "same-origin" always;
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-1
@@ -20,7 +20,19 @@ function getWorker() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
worker.onerror = event => {
|
worker.onerror = event => {
|
||||||
const error = new Error(event.message || 'Piper-arbetaren kunde inte startas.');
|
const details = [event.message, event.filename && `${event.filename}:${event.lineno || 0}:${event.colno || 0}`]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(' — ');
|
||||||
|
const error = new Error(details
|
||||||
|
? `Piper-arbetaren kunde inte startas: ${details}`
|
||||||
|
: 'Piper-arbetaren kunde inte startas.');
|
||||||
|
for (const request of pending.values()) request.reject(error);
|
||||||
|
pending.clear();
|
||||||
|
worker?.terminate();
|
||||||
|
worker = null;
|
||||||
|
};
|
||||||
|
worker.onmessageerror = () => {
|
||||||
|
const error = new Error('Piper-arbetaren skickade ett oläsbart svar.');
|
||||||
for (const request of pending.values()) request.reject(error);
|
for (const request of pending.values()) request.reject(error);
|
||||||
pending.clear();
|
pending.clear();
|
||||||
worker?.terminate();
|
worker?.terminate();
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ grep -q '<script src="/voice.js?v=__FRONTEND_VERSION__"></script>' index.html
|
|||||||
grep -q '<script src="/piper-runtime.js?v=__FRONTEND_VERSION__"></script>' index.html
|
grep -q '<script src="/piper-runtime.js?v=__FRONTEND_VERSION__"></script>' index.html
|
||||||
grep -q 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0' nginx/default.conf
|
grep -q 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0' nginx/default.conf
|
||||||
grep -q 'Cross-Origin-Embedder-Policy "require-corp"' nginx/default.conf
|
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;' nginx/default.conf
|
||||||
grep -q "request('/version')" index.html
|
grep -q "request('/version')" index.html
|
||||||
grep -Fq "credentials: 'same-origin'" index.html
|
grep -Fq "credentials: 'same-origin'" index.html
|
||||||
@@ -43,6 +45,7 @@ grep -q 'Piper' piper-runtime.js
|
|||||||
grep -q 'sv_SE-nst-medium' piper-worker.js
|
grep -q 'sv_SE-nst-medium' piper-worker.js
|
||||||
grep -q 'new Worker(workerUrl)' piper-runtime.js
|
grep -q 'new Worker(workerUrl)' piper-runtime.js
|
||||||
grep -q 'worker.js?v=' piper-runtime.js
|
grep -q 'worker.js?v=' piper-runtime.js
|
||||||
|
grep -q 'worker.onmessageerror' piper-runtime.js
|
||||||
grep -q "SpeechRecognition || win.webkitSpeechRecognition" voice.js
|
grep -q "SpeechRecognition || win.webkitSpeechRecognition" voice.js
|
||||||
grep -q "submitMessage(text, 'voice')" index.html
|
grep -q "submitMessage(text, 'voice')" index.html
|
||||||
grep -q 'Spelets repliker läses alltid upp' index.html
|
grep -q 'Spelets repliker läses alltid upp' index.html
|
||||||
|
|||||||
Reference in New Issue
Block a user