Fix favourites search from crashing

Add session GUID for avatar search and updater requests
This commit is contained in:
Natsumi
2025-04-11 10:39:22 +10:00
parent 912e23f204
commit 30b1bf3332
4 changed files with 45 additions and 8 deletions

View File

@@ -295,6 +295,7 @@ console.log(`isLinux: ${LINUX}`);
console.error(err);
}
await AppApi.SetUserAgent();
await this.loadVrcxId();
this.appVersion = await AppApi.GetVersion();
await this.compareAppVersion();
await this.setBranch();
@@ -2669,6 +2670,14 @@ console.log(`isLinux: ${LINUX}`);
await configRepository.setString('VRCX_branch', this.branch);
};
$app.data.vrcxId = '';
$app.methods.loadVrcxId = async function () {
vrcxId = await configRepository.getString(
'VRCX_id',
crypto.randomUUID()
);
};
$app.methods.updateIsGameRunning = async function (
isGameRunning,
isSteamVRRunning,
@@ -9459,7 +9468,8 @@ console.log(`isLinux: ${LINUX}`);
}?${type}=${encodeURIComponent(search)}&n=5000`,
method: 'GET',
headers: {
Referer: 'https://vrcx.app'
Referer: 'https://vrcx.app',
'VRCX-ID': this.vrcxId
}
});
var json = JSON.parse(response.data);
@@ -9535,7 +9545,8 @@ console.log(`isLinux: ${LINUX}`);
url: `${url}?authorId=${encodeURIComponent(authorId)}`,
method: 'GET',
headers: {
Referer: 'https://vrcx.app'
Referer: 'https://vrcx.app',
'VRCX-ID': this.vrcxId
}
});
var json = JSON.parse(response.data);

View File

@@ -172,7 +172,10 @@ export default class extends baseClass {
try {
var response = await webApiService.execute({
url,
method: 'GET'
method: 'GET',
headers: {
'VRCX-ID': this.vrcxId
}
});
} finally {
this.checkingForVRCXUpdate = false;
@@ -243,7 +246,10 @@ export default class extends baseClass {
try {
var response = await webApiService.execute({
url,
method: 'GET'
method: 'GET',
headers: {
'VRCX-ID': this.vrcxId
}
});
} finally {
this.checkingForVRCXUpdate = false;

View File

@@ -311,7 +311,12 @@
}
for (let j = 0; j < this.localAvatarFavorites[group].length; ++j) {
ref = this.localAvatarFavorites[group][j];
if (!ref || !ref.id) {
if (
typeof ref === 'undefined' ||
typeof ref.id === 'undefined' ||
typeof ref.name === 'undefined' ||
typeof ref.authorName === 'undefined'
) {
continue;
}
if (ref.name.toLowerCase().includes(search) || ref.authorName.toLowerCase().includes(search)) {
@@ -324,7 +329,12 @@
for (let i = 0; i < this.favoriteAvatars.length; ++i) {
ref = this.favoriteAvatars[i].ref;
if (!ref) {
if (
typeof ref === 'undefined' ||
typeof ref.id === 'undefined' ||
typeof ref.name === 'undefined' ||
typeof ref.authorName === 'undefined'
) {
continue;
}
if (ref.name.toLowerCase().includes(search) || ref.authorName.toLowerCase().includes(search)) {

View File

@@ -398,7 +398,12 @@
}
for (let j = 0; j < this.localWorldFavorites[group].length; ++j) {
ref = this.localWorldFavorites[group][j];
if (!ref || !ref.id) {
if (
typeof ref === 'undefined' ||
typeof ref.id === 'undefined' ||
typeof ref.name === 'undefined' ||
typeof ref.authorName === 'undefined'
) {
continue;
}
if (ref.name.toLowerCase().includes(search) || ref.authorName.toLowerCase().includes(search)) {
@@ -411,7 +416,12 @@
for (let i = 0; i < this.favoriteWorlds.length; ++i) {
ref = this.favoriteWorlds[i].ref;
if (!ref) {
if (
typeof ref === 'undefined' ||
typeof ref.id === 'undefined' ||
typeof ref.name === 'undefined' ||
typeof ref.authorName === 'undefined'
) {
continue;
}
if (ref.name.toLowerCase().includes(search) || ref.authorName.toLowerCase().includes(search)) {