diff --git a/public/js/app.js b/public/js/app.js index 3d3249a..c4de0c0 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -894,6 +894,7 @@ function exportToNextcloud(elementId, docType) { } function createSpeechRecognition() { + if (window.WebSpeechRecognition && !window.WebSpeechRecognition.isEnabled()) return null; if (!(window.SpeechRecognition || window.webkitSpeechRecognition)) return null; var SR = window.SpeechRecognition || window.webkitSpeechRecognition; var rec = new SR(); diff --git a/test/transcription-memory-policy.test.js b/test/transcription-memory-policy.test.js index b6ff599..a76f7b6 100644 --- a/test/transcription-memory-policy.test.js +++ b/test/transcription-memory-policy.test.js @@ -56,3 +56,9 @@ test('browser Whisper is removed from public runtime and user settings', () => { const server = read('server.js'); assert.doesNotMatch(server, /wasm-unsafe-eval|unsafe-eval|huggingface\.co|cdn-lfs|transformers/); }); + +test('browser speech recognition is gated by explicit user setting', () => { + const app = read('public/js/app.js'); + const speechFactory = app.match(/function createSpeechRecognition\(\) \{[\s\S]*?\n\}/)[0]; + assert.match(speechFactory, /window\.WebSpeechRecognition && !window\.WebSpeechRecognition\.isEnabled\(\)/); +});