}
});
-keyfileInput.addEventListener('click', event => {
+const browseKey = function(event) {
dialog.showOpenDialog(
{properties: ['openFile'], title: 'Select Google Api key file'},
configureModel.apiKeyfile = files[0];
}
);
-});
+}
/*
* Get settings from main process
}
exports.processFile = function(filepath) {
- if(appSettings.useSpeech == true) {
+ if(appSettings.useSpeech) {
return readFile(filepath).then(content => processData(content));
}
else
- return '';
+ return Promise.resolve('');
}
}
get sampleRate() {
- return localStorage.getItem('sample-rate');
+ return parseInt(localStorage.getItem('sample-rate'));
}
set apiKeyfile(apiKeyfile) {
}
get useSpeech() {
- return localStorage.getItem('use-speech');
+ return localStorage.getItem('use-speech') === 'true';
}
}
}
start() {
- if(appSettings.useSpeech == true) {
+ if(appSettings.useSpeech) {
const client = new speech.SpeechClient({
keyFilename: appSettings.apiKeyfile
<div class="form-group" v-bind:class="{ 'has-error' : apiKeyfileError}" v-if="useSpeech">
<label for="api-keyfile-input" class="col-xs-3 control-label">Google API Keyfile</label>
<div class="col-xs-9">
- <input type="url" class="form-control" id="api-keyfile-input" v-model="apiKeyfile"/>
+ <input type="url" class="form-control" id="api-keyfile-input" v-model="apiKeyfile" onclick="browseKey()"/>
</div>
</div>
<div class="form-group" v-bind:class="{ 'has-error' : languageStringError}" v-if="useSpeech">