Skip to content

Commit

Permalink
Small changes and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Natsumi-sama committed Nov 21, 2023
1 parent 29b5bed commit ab8ffbe
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 23 deletions.
65 changes: 49 additions & 16 deletions html/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2232,7 +2232,7 @@ speechSynthesis.getVoices();
gameLogLocation,
userLocation
);
return null;
return 'test_world';
};

API.applyWorld = function (json) {
Expand Down Expand Up @@ -2704,9 +2704,23 @@ speechSynthesis.getVoices();
// API offset limit is 5000
break;
}
var args = await this.getFriends(params);
friends = friends.concat(args.json);
params.offset += 50;
for (var j = 0; j < 10; j++) {
// handle 429 ratelimit error, retry 10 times
try {
var args = await this.getFriends(params);
friends = friends.concat(args.json);
params.offset += 50;
break;
} catch (err) {
console.error(err);
if (j === 9) {
throw err;
}
await new Promise((resolve) => {
workerTimers.setTimeout(resolve, 5000);
});
}
}
}
return friends;
};
Expand All @@ -2728,9 +2742,23 @@ speechSynthesis.getVoices();
// API offset limit is 5000
break;
}
var args = await this.getFriends(params);
friends = friends.concat(args.json);
params.offset += 50;
for (var j = 0; j < 10; j++) {
// handle 429 ratelimit error, retry 10 times
try {
var args = await this.getFriends(params);
friends = friends.concat(args.json);
params.offset += 50;
break;
} catch (err) {
console.error(err);
if (j === 9) {
throw err;
}
await new Promise((resolve) => {
workerTimers.setTimeout(resolve, 5000);
});
}
}
}
return friends;
};
Expand Down Expand Up @@ -12643,7 +12671,8 @@ speechSynthesis.getVoices();
// custom world rpc
if (
L.worldId === 'wrld_f20326da-f1ac-45fc-a062-609723b097b1' ||
L.worldId === 'wrld_10e5e467-fc65-42ed-8957-f02cace1398c'
L.worldId === 'wrld_10e5e467-fc65-42ed-8957-f02cace1398c' ||
L.worldId === 'wrld_04899f23-e182-4a8d-b2c7-2c74c7c15534'
) {
appId = '784094509008551956';
bigIcon = 'pypy';
Expand Down Expand Up @@ -15147,6 +15176,7 @@ speechSynthesis.getVoices();
'wrld_2d40da63-8f1f-4011-8a9e-414eb8530acd',
'wrld_1b68f7a8-8aea-4900-b7a2-3fc4139ac817',
'wrld_10e5e467-fc65-42ed-8957-f02cace1398c',
'wrld_04899f23-e182-4a8d-b2c7-2c74c7c15534',
'wrld_791ebf58-54ce-4d3a-a0a0-39f10e1b20b2',
'wrld_86a09fce-a34e-4deb-81be-53c843f97e98',
'wrld_435bbf25-f34f-4b8b-82c6-cd809057eb8e',
Expand Down Expand Up @@ -19486,7 +19516,7 @@ speechSynthesis.getVoices();
D.vrcLaunchPathOverride
);
this.$message({
message: 'updated',
message: 'Updated launch options',
type: 'success'
});
};
Expand Down Expand Up @@ -25438,12 +25468,12 @@ speechSynthesis.getVoices();
);

$app.methods.updateDatabaseVersion = async function () {
var databaseVersion = 6;
var databaseVersion = 7;
if (this.databaseVersion < databaseVersion) {
if (this.databaseVersion) {
var msgBox = this.$message({
message:
'DO NOT CLOSE VRCX, database upgrade in process...',
'DO NOT CLOSE VRCX, database upgrade in progress...',
type: 'warning',
duration: 0
});
Expand All @@ -25458,7 +25488,9 @@ speechSynthesis.getVoices();
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
database.fixBrokenNotifications(); // fix notifications being null
await database.fixBrokenNotifications(); // fix notifications being null
await database.vacuum(); // succ
await database.setWal(); // https://www.sqlite.org/wal.html
await configRepository.setInt(
'VRCX_databaseVersion',
databaseVersion
Expand Down Expand Up @@ -29284,11 +29316,12 @@ speechSynthesis.getVoices();
'VRCX_VRChatRegistryLastRestoreCheck'
);
if (
lastRestoreCheck &&
lastBackupDate &&
lastRestoreCheck === lastBackupDate
!lastBackupDate ||
(lastRestoreCheck &&
lastBackupDate &&
lastRestoreCheck === lastBackupDate)
) {
// only ask to restore once
// only ask to restore once and when backup is present
return;
}
// popup message about auto restore
Expand Down
2 changes: 1 addition & 1 deletion html/src/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ html
.x-friend-item(style="width:100%;cursor:default")
.detail
span.name {{ $t('dialog.world.info.author_tags') }}
span.extra(v-if="worldDialog.ref.tags?.length > 0") {{ worldDialog.ref.tags.filter(tag => tag.startsWith('author_tag')).map(tag => tag.replace('author_tag_', '')).join(', ') }}
span.extra(v-if="worldDialog.ref.tags?.filter(tag => tag.startsWith('author_tag')).length > 0") {{ worldDialog.ref.tags.filter(tag => tag.startsWith('author_tag')).map(tag => tag.replace('author_tag_', '')).join(', ') }}
span.extra(v-else) -
.x-friend-item(style="cursor:default")
.detail
Expand Down
2 changes: 1 addition & 1 deletion html/src/localization/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@
"date": "Date",
"action": "Action",
"auto_backup": "Weekly Auto Backup",
"restore_prompt": "VRCX has noticed auto backup of VRC registry settings is enabled but this computer dosn't have any, if you'd like to restore from backup you can do so from here."
"restore_prompt": "VRCX has noticed auto backup of VRC registry settings is enabled but this computer doesn't have any, if you'd like to restore from backup you can do so from here."
},
"group_member_moderation": {
"header": "Group Member Moderation",
Expand Down
6 changes: 3 additions & 3 deletions html/src/mixins/tabs/favorites.pug
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mixin favoritesTab()
el-switch(v-model="sortFavorites" :inactive-text="$t('view.settings.appearance.appearance.sort_favorite_by_name')" :active-text="$t('view.settings.appearance.appearance.sort_favorite_by_date')" @change="saveSortFavoritesOption")
el-collapse-item(v-for="group in API.favoriteFriendGroups" :key="group.name")
template(slot="title")
span(v-text="group.displayName" style="font-weight:bold;font-size:14px;margin-left:10px")
span(v-text="group.displayName ? group.displayName : group.name" style="font-weight:bold;font-size:14px;margin-left:10px")
span(style="color:#909399;font-size:12px;margin-left:10px") {{ group.count }}/{{ group.capacity }}
el-tooltip(placement="top" :content="$t('view.favorite.rename_tooltip')" :disabled="hideTooltips")
el-button(@click.stop="changeFavoriteGroupName(group)" size="mini" icon="el-icon-edit" circle style="margin-left:10px")
Expand Down Expand Up @@ -61,7 +61,7 @@ mixin favoritesTab()
span(style="display:block;margin-top:20px") {{ $t('view.favorite.worlds.vrchat_favorites') }}
el-collapse-item(v-for="group in API.favoriteWorldGroups" :key="group.name")
template(slot="title")
span(v-text="group.displayName" style="font-weight:bold;font-size:14px;margin-left:10px")
span(v-text="group.displayName ? group.displayName : group.name" style="font-weight:bold;font-size:14px;margin-left:10px")
i.x-user-status(style="margin-left:5px" :class="userFavoriteWorldsStatus(group.visibility)")
span(style="color:#909399;font-size:12px;margin-left:10px") {{ group.count }}/{{ group.capacity }}
el-tooltip(placement="top" :content="$t('view.favorite.visibility_tooltip')" :disabled="hideTooltips")
Expand Down Expand Up @@ -142,7 +142,7 @@ mixin favoritesTab()
el-switch(v-model="sortFavorites" :inactive-text="$t('view.settings.appearance.appearance.sort_favorite_by_name')" :active-text="$t('view.settings.appearance.appearance.sort_favorite_by_date')" @change="saveSortFavoritesOption")
el-collapse-item(v-for="group in API.favoriteAvatarGroups" :key="group.name")
template(slot="title")
span(v-text="group.displayName" style="font-weight:bold;font-size:14px;margin-left:10px")
span(v-text="group.displayName ? group.displayName : group.name" style="font-weight:bold;font-size:14px;margin-left:10px")
span(style="color:#909399;font-size:12px;margin-left:10px") {{ group.count }}/{{ group.capacity }}
el-tooltip(placement="top" :content="$t('view.favorite.rename_tooltip')" :disabled="hideTooltips")
el-button(@click.stop="changeFavoriteGroupName(group)" size="mini" icon="el-icon-edit" circle style="margin-left:10px")
Expand Down
12 changes: 10 additions & 2 deletions html/src/repository/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -2474,8 +2474,8 @@ class Database {
});
}

fixBrokenNotifications() {
sqliteService.executeNonQuery(
async fixBrokenNotifications() {
await sqliteService.executeNonQuery(
`DELETE FROM ${Database.userPrefix}_notifications WHERE (created_at is null or created_at = '')`
);
}
Expand Down Expand Up @@ -2513,6 +2513,14 @@ class Database {
}
}
}

async vacuum() {
await sqliteService.executeNonQuery('VACUUM');
}

async setWal() {
await sqliteService.executeNonQuery('PRAGMA journal_mode=WAL');
}
}

var self = new Database();
Expand Down

0 comments on commit ab8ffbe

Please sign in to comment.