Small changes and fixes

This commit is contained in:
Natsumi
2022-12-30 10:34:31 +13:00
parent dc2b98fbfd
commit 3dde1dae43
4 changed files with 94 additions and 64 deletions

View File

@@ -882,17 +882,14 @@ speechSynthesis.getVoices();
} else if (L.worldId) { } else if (L.worldId) {
var ref = API.cachedWorlds.get(L.worldId); var ref = API.cachedWorlds.get(L.worldId);
if (typeof ref === 'undefined') { if (typeof ref === 'undefined') {
API.getWorld({ $app.getWorldName(L.worldId).then((worldName) => {
worldId: L.worldId
}).then((args) => {
if (L.tag === instanceId) { if (L.tag === instanceId) {
if (L.instanceId) { if (L.instanceId) {
this.text = `${args.json.name} #${L.instanceName} ${L.accessType}`; this.text = `${worldName} #${L.instanceName} ${L.accessType}`;
} else { } else {
this.text = args.json.name; this.text = worldName;
} }
} }
return args;
}); });
} else if (L.instanceId) { } else if (L.instanceId) {
this.text = `${ref.name} #${L.instanceName} ${L.accessType}`; this.text = `${ref.name} #${L.instanceName} ${L.accessType}`;
@@ -904,9 +901,8 @@ speechSynthesis.getVoices();
this.groupName = this.grouphint; this.groupName = this.grouphint;
} else if (L.groupId) { } else if (L.groupId) {
this.groupName = L.groupId; this.groupName = L.groupId;
API.getCachedGroup({groupId: L.groupId}).then((args) => { $app.getGroupName(instanceId).then((groupName) => {
this.groupName = args.json.name; this.groupName = groupName;
return args;
}); });
} }
this.region = ''; this.region = '';
@@ -1011,11 +1007,8 @@ speechSynthesis.getVoices();
this.groupName = this.grouphint; this.groupName = this.grouphint;
} else if (this.locationobject.groupId) { } else if (this.locationobject.groupId) {
this.groupName = this.locationobject.groupId; this.groupName = this.locationobject.groupId;
API.getCachedGroup({ $app.getGroupName(this.location).then((groupName) => {
groupId: this.locationobject.groupId this.groupName = groupName;
}).then((args) => {
this.groupName = args.json.name;
return args;
}); });
} }
}, },
@@ -1440,11 +1433,11 @@ speechSynthesis.getVoices();
ref.$homeLocation = this.parseLocation(ref.homeLocation); ref.$homeLocation = this.parseLocation(ref.homeLocation);
// apply home location name to user dialog // apply home location name to user dialog
if ($app.userDialog.visible && $app.userDialog.id === ref.id) { if ($app.userDialog.visible && $app.userDialog.id === ref.id) {
API.getCachedWorld({ $app.getWorldName(API.currentUser.homeLocation).then(
worldId: API.currentUser.homeLocation (worldName) => {
}).then((args) => { $app.userDialog.$homeLocationName = worldName;
$app.userDialog.$homeLocationName = args.ref.name; }
}); );
} }
} }
ref.$isVRCPlus = ref.tags.includes('system_supporter'); ref.$isVRCPlus = ref.tags.includes('system_supporter');
@@ -4367,7 +4360,13 @@ speechSynthesis.getVoices();
case 'group-joined': case 'group-joined':
case 'group-left': case 'group-left':
// content.groupId var groupId = content.groupId;
if (
$app.groupDialog.visible &&
$app.groupDialog.id === groupId
) {
$app.showGroupDialog(groupId);
}
break; break;
case 'group-member-updated': case 'group-member-updated':
// content { // content {
@@ -10148,13 +10147,7 @@ speechSynthesis.getVoices();
) { ) {
var worldName = shortName; var worldName = shortName;
if (instanceId) { if (instanceId) {
var L = API.parseLocation(instanceId); worldName = await this.getWorldName(instanceId);
try {
var args = await API.getCachedWorld({
worldId: L.worldId
});
worldName = args.ref.name;
} catch (err) {}
} }
this.addEntryPhotonEvent({ this.addEntryPhotonEvent({
photonId, photonId,
@@ -14370,11 +14363,11 @@ speechSynthesis.getVoices();
D.dateFriended = ''; D.dateFriended = '';
D.unFriended = false; D.unFriended = false;
if (userId === API.currentUser.id) { if (userId === API.currentUser.id) {
API.getCachedWorld({ this.getWorldName(API.currentUser.homeLocation).then(
worldId: API.currentUser.homeLocation (worldName) => {
}).then((args) => { D.$homeLocationName = worldName;
D.$homeLocationName = args.ref.name; }
}); );
} }
API.getCachedUser({ API.getCachedUser({
userId userId
@@ -21670,20 +21663,43 @@ speechSynthesis.getVoices();
$app.methods.updateDatabaseVersion = async function () { $app.methods.updateDatabaseVersion = async function () {
var databaseVersion = 4; var databaseVersion = 4;
if (this.databaseVersion !== databaseVersion) { if (this.databaseVersion !== databaseVersion) {
var msgBox = this.$message({
message: 'DO NOT CLOSE VRCX, database upgrade in process...',
type: 'warning',
duration: 0
});
console.log( console.log(
`Updating database from ${this.databaseVersion} to ${databaseVersion}...` `Updating database from ${this.databaseVersion} to ${databaseVersion}...`
); );
await database.cleanLegendFromFriendLog(); // fix friendLog spammed with crap try {
await database.fixGameLogTraveling(); // fix bug with gameLog location being set as traveling await database.cleanLegendFromFriendLog(); // fix friendLog spammed with crap
await database.fixNegativeGPS(); // fix GPS being a negative value due to VRCX bug with traveling await database.fixGameLogTraveling(); // fix bug with gameLog location being set as traveling
await database.fixBrokenLeaveEntries(); // fix user instance timer being higher than current user location timer await database.fixNegativeGPS(); // fix GPS being a negative value due to VRCX bug with traveling
await database.fixBrokenGroupInvites(); // fix notification v2 in wrong table await database.fixBrokenLeaveEntries(); // fix user instance timer being higher than current user location timer
if (this.databaseVersion && this.databaseVersion < 4) { await database.fixBrokenGroupInvites(); // fix notification v2 in wrong table
await database.updateTableForGroupNames(); // alter tables to include group name 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.');
} }
}; };

View File

@@ -1637,7 +1637,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(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)") img.x-link(v-lazy="userDialog.ref.userIcon" style="height:500px" @click="downloadAndSaveImage(userDialog.ref.userIcon)")
div(style="flex:none") 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="$t('dialog.user.actions.unfavorite_tooltip')" :disabled="hideTooltips") el-tooltip(v-if="userDialog.isFavorite" placement="top" :content="$t('dialog.user.actions.unfavorite_tooltip')" :disabled="hideTooltips")
el-button(@click="userDialogCommand('Delete Favorite')" type="warning" icon="el-icon-star-on" circle) el-button(@click="userDialogCommand('Delete Favorite')" type="warning" icon="el-icon-star-on" circle)
el-tooltip(v-else placement="top" :content="$t('dialog.user.actions.favorite_tooltip')" :disabled="hideTooltips") el-tooltip(v-else placement="top" :content="$t('dialog.user.actions.favorite_tooltip')" :disabled="hideTooltips")

View File

@@ -1830,18 +1830,23 @@ class Database {
} }
async updateTableForGroupNames() { async updateTableForGroupNames() {
try { var tables = [];
var tables = []; await sqliteService.execute((dbRow) => {
await sqliteService.execute((dbRow) => { tables.push(dbRow[0]);
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'`);
}, `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) {
tables.forEach((tableName) => { try {
await sqliteService.executeNonQuery(
`SELECT group_name FROM ${tableName} LIMIT 1`
);
} catch (e) {
if (e.indexOf('no such column') === -1) {
throw e;
}
sqliteService.executeNonQuery( sqliteService.executeNonQuery(
`ALTER TABLE ${tableName} ADD group_name TEXT DEFAULT ''` `ALTER TABLE ${tableName} ADD group_name TEXT DEFAULT ''`
); );
}); }
} catch (e) {
console.error(e);
} }
} }
} }

View File

@@ -402,6 +402,7 @@ Vue.component('marquee-text', MarqueeText);
$app.methods.playNoty = function (json) { $app.methods.playNoty = function (json) {
var {noty, message, image} = JSON.parse(json); var {noty, message, image} = JSON.parse(json);
var message = escapeTag(message);
var text = ''; var text = '';
var img = ''; var img = '';
if (image) { if (image) {
@@ -422,7 +423,7 @@ Vue.component('marquee-text', MarqueeText);
noty.displayName noty.displayName
}</strong> is in ${this.displayLocation( }</strong> is in ${this.displayLocation(
noty.location, noty.location,
noty.worldName escapeTag(noty.worldName)
)}`; )}`;
break; break;
case 'Online': case 'Online':
@@ -430,7 +431,7 @@ Vue.component('marquee-text', MarqueeText);
if (noty.worldName) { if (noty.worldName) {
locationName = ` to ${this.displayLocation( locationName = ` to ${this.displayLocation(
noty.location, noty.location,
noty.worldName escapeTag(noty.worldName)
)}`; )}`;
} }
text = `<strong>${noty.displayName}</strong> has logged in${locationName}`; text = `<strong>${noty.displayName}</strong> has logged in${locationName}`;
@@ -439,14 +440,16 @@ Vue.component('marquee-text', MarqueeText);
text = `<strong>${noty.displayName}</strong> has logged out`; text = `<strong>${noty.displayName}</strong> has logged out`;
break; break;
case 'Status': case 'Status':
text = `<strong>${noty.displayName}</strong> status is now <i>${noty.status}</i> ${noty.statusDescription}`; text = `<strong>${noty.displayName}</strong> status is now <i>${
noty.status
}</i> ${escapeTag(noty.statusDescription)}`;
break; break;
case 'invite': case 'invite':
text = `<strong>${ text = `<strong>${
noty.senderUsername noty.senderUsername
}</strong> has invited you to ${this.displayLocation( }</strong> has invited you to ${this.displayLocation(
noty.details.worldId, noty.details.worldId,
noty.details.worldName escapeTag(noty.details.worldName)
)}${message}`; )}${message}`;
break; break;
case 'requestInvite': case 'requestInvite':
@@ -474,16 +477,16 @@ Vue.component('marquee-text', MarqueeText);
text = `<strong>${noty.previousDisplayName}</strong> changed their name to ${noty.displayName}`; text = `<strong>${noty.previousDisplayName}</strong> changed their name to ${noty.displayName}`;
break; break;
case 'group.announcement': case 'group.announcement':
text = noty.message; text = escapeTag(noty.message);
break; break;
case 'group.informative': case 'group.informative':
text = noty.message; text = escapeTag(noty.message);
break; break;
case 'group.invite': case 'group.invite':
text = noty.message; text = escapeTag(noty.message);
break; break;
case 'group.joinRequest': case 'group.joinRequest':
text = noty.message; text = escapeTag(noty.message);
break; break;
case 'PortalSpawn': case 'PortalSpawn':
if (noty.displayName) { if (noty.displayName) {
@@ -491,23 +494,29 @@ Vue.component('marquee-text', MarqueeText);
noty.displayName noty.displayName
}</strong> has spawned a portal to ${this.displayLocation( }</strong> has spawned a portal to ${this.displayLocation(
noty.instanceId, noty.instanceId,
noty.worldName escapeTag(noty.worldName)
)}`; )}`;
} else { } else {
text = 'User has spawned a portal'; text = 'User has spawned a portal';
} }
break; break;
case 'AvatarChange': case 'AvatarChange':
text = `<strong>${noty.displayName}</strong> changed into avatar ${noty.name}`; text = `<strong>${
noty.displayName
}</strong> changed into avatar ${escapeTag(noty.name)}`;
break; break;
case 'ChatBoxMessage': case 'ChatBoxMessage':
text = `<strong>${noty.displayName}</strong> said ${noty.text}`; text = `<strong>${noty.displayName}</strong> said ${escapeTag(
noty.text
)}`;
break; break;
case 'Event': case 'Event':
text = noty.data; text = escapeTag(noty.data);
break; break;
case 'VideoPlay': case 'VideoPlay':
text = `<strong>Now playing:</strong> ${noty.notyName}`; text = `<strong>Now playing:</strong> ${escapeTag(
noty.notyName
)}`;
break; break;
case 'BlockedOnPlayerJoined': case 'BlockedOnPlayerJoined':
text = `Blocked user <strong>${noty.displayName}</strong> has joined`; text = `Blocked user <strong>${noty.displayName}</strong> has joined`;