gate browser speech recognition setting
This commit is contained in:
parent
56a5f16e5a
commit
c1c0cfe1d5
2 changed files with 7 additions and 0 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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\(\)/);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue