diff --git a/html/src/app.js b/html/src/app.js index 2e3d5f8d..53fd612a 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -870,17 +870,14 @@ speechSynthesis.getVoices(); } else if (L.worldId) { var ref = API.cachedWorlds.get(L.worldId); if (typeof ref === 'undefined') { - API.getWorld({ - worldId: L.worldId - }).then((args) => { + $app.getWorldName(L.worldId).then((worldName) => { if (L.tag === instanceId) { if (L.instanceId) { - this.text = `${args.json.name} #${L.instanceName} ${L.accessType}`; + this.text = `${worldName} #${L.instanceName} ${L.accessType}`; } else { - this.text = args.json.name; + this.text = worldName; } } - return args; }); } else if (L.instanceId) { this.text = `${ref.name} #${L.instanceName} ${L.accessType}`; @@ -892,9 +889,8 @@ speechSynthesis.getVoices(); this.groupName = this.grouphint; } else if (L.groupId) { this.groupName = L.groupId; - API.getCachedGroup({groupId: L.groupId}).then((args) => { - this.groupName = args.json.name; - return args; + $app.getGroupName(instanceId).then((groupName) => { + this.groupName = groupName; }); } this.region = ''; @@ -999,11 +995,8 @@ speechSynthesis.getVoices(); this.groupName = this.grouphint; } else if (this.locationobject.groupId) { this.groupName = this.locationobject.groupId; - API.getCachedGroup({ - groupId: this.locationobject.groupId - }).then((args) => { - this.groupName = args.json.name; - return args; + $app.getGroupName(this.location).then((groupName) => { + this.groupName = groupName; }); } }, @@ -1428,11 +1421,11 @@ speechSynthesis.getVoices(); ref.$homeLocation = this.parseLocation(ref.homeLocation); // apply home location name to user dialog if ($app.userDialog.visible && $app.userDialog.id === ref.id) { - API.getCachedWorld({ - worldId: API.currentUser.homeLocation - }).then((args) => { - $app.userDialog.$homeLocationName = args.ref.name; - }); + $app.getWorldName(API.currentUser.homeLocation).then( + (worldName) => { + $app.userDialog.$homeLocationName = worldName; + } + ); } } ref.$isVRCPlus = ref.tags.includes('system_supporter'); @@ -4355,7 +4348,13 @@ speechSynthesis.getVoices(); case 'group-joined': case 'group-left': - // content.groupId + var groupId = content.groupId; + if ( + $app.groupDialog.visible && + $app.groupDialog.id === groupId + ) { + $app.showGroupDialog(groupId); + } break; case 'group-member-updated': // content { @@ -10135,13 +10134,7 @@ speechSynthesis.getVoices(); ) { var worldName = shortName; if (instanceId) { - var L = API.parseLocation(instanceId); - try { - var args = await API.getCachedWorld({ - worldId: L.worldId - }); - worldName = args.ref.name; - } catch (err) {} + worldName = await this.getWorldName(instanceId); } this.addEntryPhotonEvent({ photonId, @@ -14357,11 +14350,11 @@ speechSynthesis.getVoices(); D.dateFriended = ''; D.unFriended = false; if (userId === API.currentUser.id) { - API.getCachedWorld({ - worldId: API.currentUser.homeLocation - }).then((args) => { - D.$homeLocationName = args.ref.name; - }); + this.getWorldName(API.currentUser.homeLocation).then( + (worldName) => { + D.$homeLocationName = worldName; + } + ); } API.getCachedUser({ userId @@ -21657,20 +21650,43 @@ speechSynthesis.getVoices(); $app.methods.updateDatabaseVersion = async function () { var databaseVersion = 4; if (this.databaseVersion !== databaseVersion) { + var msgBox = this.$message({ + message: 'DO NOT CLOSE VRCX, database upgrade in process...', + type: 'warning', + duration: 0 + }); console.log( `Updating database from ${this.databaseVersion} to ${databaseVersion}...` ); - await database.cleanLegendFromFriendLog(); // fix friendLog spammed with crap - await database.fixGameLogTraveling(); // fix bug with gameLog location being set as traveling - await database.fixNegativeGPS(); // fix GPS being a negative value due to VRCX bug with traveling - await database.fixBrokenLeaveEntries(); // fix user instance timer being higher than current user location timer - await database.fixBrokenGroupInvites(); // fix notification v2 in wrong table - if (this.databaseVersion && this.databaseVersion < 4) { + try { + await database.cleanLegendFromFriendLog(); // fix friendLog spammed with crap + await database.fixGameLogTraveling(); // fix bug with gameLog location being set as traveling + await database.fixNegativeGPS(); // fix GPS being a negative value due to VRCX bug with traveling + await database.fixBrokenLeaveEntries(); // fix user instance timer being higher than current user location timer + await database.fixBrokenGroupInvites(); // fix notification v2 in wrong table await database.updateTableForGroupNames(); // alter tables to include group name + this.databaseVersion = databaseVersion; + configRepository.setInt( + 'VRCX_databaseVersion', + databaseVersion + ); + console.log('Database update complete.'); + msgBox.close(); + this.$message({ + message: 'Database upgrade complete', + type: 'success' + }); + } catch (err) { + console.error(err); + msgBox.close(); + this.$message({ + message: + 'Database upgrade failed, check console for details', + type: 'error', + duration: 120000 + }); + AppApi.ShowDevTools(); } - this.databaseVersion = databaseVersion; - configRepository.setInt('VRCX_databaseVersion', databaseVersion); - console.log('Database update complete.'); } }; diff --git a/html/src/index.pug b/html/src/index.pug index fa8091d5..11d1be82 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -1630,7 +1630,7 @@ html img.x-link(slot="reference" v-lazy="userDialog.ref.userIcon" style="flex:none;width:120px;height:120px;border-radius:4px;object-fit:cover") img.x-link(v-lazy="userDialog.ref.userIcon" style="height:500px" @click="downloadAndSaveImage(userDialog.ref.userIcon)") div(style="flex:none") - template(v-if="API.currentUser.id !== userDialog.ref.id") + template(v-if="(API.currentUser.id !== userDialog.ref.id && userDialog.isFriend) || userDialog.isFavorite") el-tooltip(v-if="userDialog.isFavorite" placement="top" content="Remove from favorites" :disabled="hideTooltips") el-button(@click="userDialogCommand('Delete Favorite')" type="warning" icon="el-icon-star-on" circle) el-tooltip(v-else placement="top" content="Add to favorites" :disabled="hideTooltips") diff --git a/html/src/repository/database.js b/html/src/repository/database.js index cd9d1c3c..04b71258 100644 --- a/html/src/repository/database.js +++ b/html/src/repository/database.js @@ -1830,18 +1830,23 @@ class Database { } async updateTableForGroupNames() { - try { - var tables = []; - await sqliteService.execute((dbRow) => { - tables.push(dbRow[0]); - }, `SELECT name FROM sqlite_schema WHERE type='table' AND name LIKE '%_feed_gps' OR name LIKE '%_feed_online_offline' OR name = 'gamelog_location'`); - tables.forEach((tableName) => { + var tables = []; + await sqliteService.execute((dbRow) => { + tables.push(dbRow[0]); + }, `SELECT name FROM sqlite_schema WHERE type='table' AND name LIKE '%_feed_gps' OR name LIKE '%_feed_online_offline' OR name = 'gamelog_location'`); + for (var tableName of tables) { + try { + await sqliteService.executeNonQuery( + `SELECT group_name FROM ${tableName} LIMIT 1` + ); + } catch (e) { + if (e.indexOf('no such column') === -1) { + throw e; + } sqliteService.executeNonQuery( `ALTER TABLE ${tableName} ADD group_name TEXT DEFAULT ''` ); - }); - } catch (e) { - console.error(e); + } } } } diff --git a/html/src/vr.js b/html/src/vr.js index b9f0f379..7e7b5c16 100644 --- a/html/src/vr.js +++ b/html/src/vr.js @@ -402,6 +402,7 @@ Vue.component('marquee-text', MarqueeText); $app.methods.playNoty = function (json) { var {noty, message, image} = JSON.parse(json); + var message = escapeTag(message); var text = ''; var img = ''; if (image) { @@ -422,7 +423,7 @@ Vue.component('marquee-text', MarqueeText); noty.displayName } is in ${this.displayLocation( noty.location, - noty.worldName + escapeTag(noty.worldName) )}`; break; case 'Online': @@ -430,7 +431,7 @@ Vue.component('marquee-text', MarqueeText); if (noty.worldName) { locationName = ` to ${this.displayLocation( noty.location, - noty.worldName + escapeTag(noty.worldName) )}`; } text = `${noty.displayName} has logged in${locationName}`; @@ -439,14 +440,16 @@ Vue.component('marquee-text', MarqueeText); text = `${noty.displayName} has logged out`; break; case 'Status': - text = `${noty.displayName} status is now ${noty.status} ${noty.statusDescription}`; + text = `${noty.displayName} status is now ${ + noty.status + } ${escapeTag(noty.statusDescription)}`; break; case 'invite': text = `${ noty.senderUsername } has invited you to ${this.displayLocation( noty.details.worldId, - noty.details.worldName + escapeTag(noty.details.worldName) )}${message}`; break; case 'requestInvite': @@ -474,16 +477,16 @@ Vue.component('marquee-text', MarqueeText); text = `${noty.previousDisplayName} changed their name to ${noty.displayName}`; break; case 'group.announcement': - text = noty.message; + text = escapeTag(noty.message); break; case 'group.informative': - text = noty.message; + text = escapeTag(noty.message); break; case 'group.invite': - text = noty.message; + text = escapeTag(noty.message); break; case 'group.joinRequest': - text = noty.message; + text = escapeTag(noty.message); break; case 'PortalSpawn': if (noty.displayName) { @@ -491,23 +494,29 @@ Vue.component('marquee-text', MarqueeText); noty.displayName } has spawned a portal to ${this.displayLocation( noty.instanceId, - noty.worldName + escapeTag(noty.worldName) )}`; } else { text = 'User has spawned a portal'; } break; case 'AvatarChange': - text = `${noty.displayName} changed into avatar ${noty.name}`; + text = `${ + noty.displayName + } changed into avatar ${escapeTag(noty.name)}`; break; case 'ChatBoxMessage': - text = `${noty.displayName} said ${noty.text}`; + text = `${noty.displayName} said ${escapeTag( + noty.text + )}`; break; case 'Event': - text = noty.data; + text = escapeTag(noty.data); break; case 'VideoPlay': - text = `Now playing: ${noty.notyName}`; + text = `Now playing: ${escapeTag( + noty.notyName + )}`; break; case 'BlockedOnPlayerJoined': text = `Blocked user ${noty.displayName} has joined`;