diff --git a/html/src/app.js b/html/src/app.js index 5d6a36ab..87f3cddd 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -4217,8 +4217,9 @@ speechSynthesis.getVoices(); if (ctx.created_at < bias) { break; } + // (ctx.type === 'GPS' || ctx.type === 'Online') TODO: fix new friend triggering Online event if ( - (ctx.type === 'GPS' || ctx.type === 'Online') && + ctx.type === 'GPS' && ctx.location === this.lastLocation.location ) { if (joiningMap[ctx.displayName]) { @@ -9981,6 +9982,21 @@ speechSynthesis.getVoices(); } }; + $app.methods.getTTSVoiceName = function () { + var voices = speechSynthesis.getVoices(); + if (voices.length === 0) { + return ''; + } + if (this.notificationTTSVoice >= voices.length) { + this.notificationTTSVoice = 0; + configRepository.setString( + 'VRCX_notificationTTSVoice', + this.notificationTTSVoice + ); + } + return voices[this.notificationTTSVoice].name; + }; + $app.methods.changeTTSVoice = function (index) { this.notificationTTSVoice = index; configRepository.setString( @@ -9991,7 +10007,7 @@ speechSynthesis.getVoices(); if (voices.length === 0) { return; } - var voiceName = voices[index < voices.length ? index : 0].name; + var voiceName = voices[index].name; speechSynthesis.cancel(); this.speak(voiceName); }; @@ -9999,7 +10015,14 @@ speechSynthesis.getVoices(); $app.methods.speak = function (text) { var tts = new SpeechSynthesisUtterance(); var voices = speechSynthesis.getVoices(); - tts.voice = voices[this.notificationTTSVoice]; + if (voices.length === 0) { + return; + } + var index = 0; + if (this.notificationTTSVoice < voices.length) { + index = this.notificationTTSVoice; + } + tts.voice = voices[index]; tts.text = text; speechSynthesis.speak(tts); }; diff --git a/html/src/repository/database.js b/html/src/repository/database.js index 1f1ca942..23c9612d 100644 --- a/html/src/repository/database.js +++ b/html/src/repository/database.js @@ -1081,7 +1081,8 @@ class Database { async getLastDateGameLogDatabase() { var gamelogDatabase = []; - var date = '1970-01-01'; + // var date = '1970-01-01'; + var date = new Date(Date.now() - 86400000).toJSON(); // 24 hours await sqliteService.execute((dbRow) => { gamelogDatabase.unshift(dbRow[0]); }, 'SELECT created_at FROM gamelog_location ORDER BY id DESC LIMIT 1');