Small fixes

This commit is contained in:
Natsumi
2024-02-02 02:42:06 +13:00
parent cb35e5e50f
commit e2e907da77
3 changed files with 39 additions and 25 deletions

View File

@@ -600,10 +600,10 @@ namespace VRCX
return; return;
} }
if (String.IsNullOrEmpty(request.Value)) if (request.Value == null)
{ {
logger.Warn("World {0} tried to store data under key {1} with no value provided", worldId, request.Key); logger.Warn("World {0} tried to store data under key {1} with null value", worldId, request.Key);
this.lastError = "`value` is missing or null"; this.lastError = "`value` is null";
return; return;
} }

View File

@@ -643,8 +643,8 @@ speechSynthesis.getVoices();
options.N > 0 options.N > 0
? options.N > options.params.offset ? options.N > options.params.offset
: options.N < 0 : options.N < 0
? args.json.length ? args.json.length
: options.params.n === args.json.length) : options.params.n === args.json.length)
) { ) {
this.bulk(options); this.bulk(options);
} else if ('done' in options) { } else if ('done' in options) {
@@ -938,7 +938,9 @@ speechSynthesis.getVoices();
} else if (L.groupId) { } else if (L.groupId) {
this.groupName = L.groupId; this.groupName = L.groupId;
$app.getGroupName(instanceId).then((groupName) => { $app.getGroupName(instanceId).then((groupName) => {
this.groupName = groupName; if (L.tag === instanceId) {
this.groupName = groupName;
}
}); });
} }
this.region = ''; this.region = '';
@@ -1745,6 +1747,7 @@ speechSynthesis.getVoices();
$languages: [], $languages: [],
$locationTag: '', $locationTag: '',
$travelingToLocation: '', $travelingToLocation: '',
$vbucks: null,
...json ...json
}; };
ref.$homeLocation = this.parseLocation(ref.homeLocation); ref.$homeLocation = this.parseLocation(ref.homeLocation);
@@ -7333,18 +7336,19 @@ speechSynthesis.getVoices();
); );
}; };
$app.methods.resendEmail2fa = function () { $app.methods.resendEmail2fa = async function () {
if (this.loginForm.lastUserLoggedIn) { if (this.loginForm.lastUserLoggedIn) {
var user = var user =
this.loginForm.savedCredentials[ this.loginForm.savedCredentials[
this.loginForm.lastUserLoggedIn this.loginForm.lastUserLoggedIn
]; ];
if (typeof user !== 'undefined') { if (typeof user !== 'undefined') {
webApiService.clearCookies(); await webApiService.clearCookies();
delete user.cookies;
this.relogin(user).then(() => { this.relogin(user).then(() => {
new Noty({ new Noty({
type: 'success', type: 'success',
text: 'Successfully relogged in.' text: 'Email 2FA resent.'
}).show(); }).show();
}); });
return; return;
@@ -7654,11 +7658,12 @@ speechSynthesis.getVoices();
); );
}; };
$app.methods.relogin = function (user) { $app.methods.relogin = async function (user) {
var { loginParmas } = user; var { loginParmas } = user;
if (user.cookies) { if (user.cookies) {
webApiService.setCookies(user.cookies); await webApiService.setCookies(user.cookies);
} }
this.loginForm.lastUserLoggedIn = user.user.id; // for resend email 2fa
if (loginParmas.endpoint) { if (loginParmas.endpoint) {
API.endpointDomain = loginParmas.endpoint; API.endpointDomain = loginParmas.endpoint;
API.websocketDomain = loginParmas.websocket; API.websocketDomain = loginParmas.websocket;
@@ -7686,7 +7691,7 @@ speechSynthesis.getVoices();
}) })
.catch((err2) => { .catch((err2) => {
this.loginForm.loading = false; this.loginForm.loading = false;
API.logout(); // API.logout();
reject(err2); reject(err2);
}) })
.then(() => { .then(() => {
@@ -22871,6 +22876,12 @@ speechSynthesis.getVoices();
) { ) {
var D = this.screenshotMetadataDialog; var D = this.screenshotMetadataDialog;
var metadata = JSON.parse(json); var metadata = JSON.parse(json);
if (typeof metadata === 'undefined' || !metadata.sourceFile) {
D.metadata = {};
D.metadata.error =
'Invalid file selected. Please select a valid VRChat screenshot.';
return;
}
// Get extra data for display dialog like resolution, file size, etc // Get extra data for display dialog like resolution, file size, etc
D.loading = true; D.loading = true;
@@ -28521,6 +28532,11 @@ speechSynthesis.getVoices();
} }
await this.getGroupDialogGroupMembers(); await this.getGroupDialogGroupMembers();
while (this.groupDialog.visible && !this.isGroupMembersDone) { while (this.groupDialog.visible && !this.isGroupMembersDone) {
this.isGroupMembersLoading = true;
await new Promise((resolve) => {
workerTimers.setTimeout(resolve, 1000);
});
this.isGroupMembersLoading = false;
await this.loadMoreGroupMembers(); await this.loadMoreGroupMembers();
} }
}; };
@@ -28902,35 +28918,33 @@ speechSynthesis.getVoices();
// #endregion // #endregion
// #region | App: Language // #region | App: Language
$app.data.appLanguage = 'en'; $app.data.appLanguage =
(await configRepository.getString('VRCX_appLanguage')) ?? 'en';
i18n.locale = $app.data.appLanguage;
var initLanguage = async () => { var initLanguage = async () => {
if (await configRepository.getString('VRCX_appLanguage')) { if (!(await configRepository.getString('VRCX_appLanguage'))) {
$app.data.appLanguage =
await configRepository.getString('VRCX_appLanguage');
i18n.locale = $app.data.appLanguage;
} else {
var result = await AppApi.CurrentLanguage(); var result = await AppApi.CurrentLanguage();
if (!result) { if (!result) {
console.error('Failed to get current language'); console.error('Failed to get current language');
await $app.changeAppLanguage('en'); $app.changeAppLanguage('en');
return; return;
} }
var lang = result.split('-')[0]; var lang = result.split('-')[0];
i18n.availableLocales.forEach(async (ref) => { i18n.availableLocales.forEach((ref) => {
var refLang = ref.split('_')[0]; var refLang = ref.split('_')[0];
if (refLang === lang) { if (refLang === lang) {
await $app.changeAppLanguage(ref); $app.changeAppLanguage(ref);
} }
}); });
} }
}; };
await initLanguage(); initLanguage();
$app.methods.changeAppLanguage = async function (language) { $app.methods.changeAppLanguage = function (language) {
console.log('Language changed:', language); console.log('Language changed:', language);
this.appLanguage = language; this.appLanguage = language;
i18n.locale = language; i18n.locale = language;
await configRepository.setString('VRCX_appLanguage', language); configRepository.setString('VRCX_appLanguage', language);
this.updateVRConfigVars(); this.updateVRConfigVars();
}; };

View File

@@ -35,7 +35,7 @@ mixin loginPage()
span.name(v-text="user.user.displayName") span.name(v-text="user.user.displayName")
span.extra(v-text="user.user.username") span.extra(v-text="user.user.username")
span.extra(v-text="user.loginParmas.endpoint") span.extra(v-text="user.loginParmas.endpoint")
el-button(type="default" @click="deleteSavedLogin(user.user.id)" size="mini" icon="el-icon-delete" style="margin-left:10px" circle) el-button(type="default" @click.stop="deleteSavedLogin(user.user.id)" size="mini" icon="el-icon-delete" style="margin-left:10px" circle)
div.x-legal-notice-container div.x-legal-notice-container
div(style="text-align:center;font-size:12px") div(style="text-align:center;font-size:12px")