Avatar gallery and listing

This commit is contained in:
Natsumi
2025-05-24 03:32:40 +10:00
parent 029aa1c43d
commit 17a75a041f
9 changed files with 244 additions and 21 deletions

View File

@@ -356,7 +356,9 @@ console.log(`isLinux: ${LINUX}`);
languageClass: this.languageClass,
showGroupDialog: this.showGroupDialog,
showGallerySelectDialog: this.showGallerySelectDialog,
showGalleryDialog: this.showGalleryDialog
showGalleryDialog: this.showGalleryDialog,
getImageUrlFromImageId: this.getImageUrlFromImageId,
getAvatarGallery: this.getAvatarGallery
};
},
el: '#root',
@@ -1474,6 +1476,10 @@ console.log(`isLinux: ${LINUX}`);
ref.unityPackages = unityPackages;
}
}
for (const listing of ref?.publishedListings) {
listing.displayName = $utils.replaceBioSymbols(listing.displayName);
listing.description = $utils.replaceBioSymbols(listing.description);
}
ref.name = $utils.replaceBioSymbols(ref.name);
ref.description = $utils.replaceBioSymbols(ref.description);
return ref;
@@ -9528,6 +9534,7 @@ console.log(`isLinux: ${LINUX}`);
isIos: false,
bundleSizes: [],
platformInfo: {},
galleryImages: [],
lastUpdated: '',
inCache: false,
cacheSize: 0,
@@ -9570,6 +9577,7 @@ console.log(`isLinux: ${LINUX}`);
D.lastUpdated = '';
D.bundleSizes = [];
D.platformInfo = {};
D.galleryImages = [];
D.isFavorite =
API.cachedFavoritesByObjectId.has(avatarId) ||
(API.currentUser.$isVRCPlus &&
@@ -9592,6 +9600,7 @@ console.log(`isLinux: ${LINUX}`);
.then((args) => {
var { ref } = args;
D.ref = ref;
this.getAvatarGallery(avatarId);
this.updateVRChatAvatarCache();
if (/quest/.test(ref.tags)) {
D.isQuestFallback = true;
@@ -9626,6 +9635,22 @@ console.log(`isLinux: ${LINUX}`);
});
};
$app.methods.getAvatarGallery = async function (avatarId) {
var D = this.avatarDialog;
const args = await avatarRequest.getAvatarGallery(avatarId);
if (args.params.galleryId !== D.id) {
return;
}
D.galleryImages = [];
for (const file of args.json) {
const url = file.versions[file.versions.length - 1].file.url;
D.galleryImages.push(url);
}
// for JSON tab treeData
D.ref.gallery = args.json;
};
$app.methods.selectAvatarWithConfirmation = function (id) {
this.$confirm(`Continue? Select Avatar`, 'Confirm', {
confirmButtonText: 'Confirm',
@@ -11153,6 +11178,10 @@ console.log(`isLinux: ${LINUX}`);
return user.currentAvatarImageUrl;
};
$app.methods.getImageUrlFromImageId = function (imageId) {
return `https://api.vrchat.cloud/api/1/file/${imageId}/1/`;
};
$app.methods.showConsole = function () {
AppApi.ShowDevTools();
if (