diff --git a/html/src/app.js b/html/src/app.js index 10b174e26..c091f44f6 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -18473,6 +18473,31 @@ speechSynthesis.getVoices(); return { isPC, isQuest, isIos }; }; + $app.methods.getPlatformInfo = function (unityPackages) { + var pc = {}; + var android = {}; + var ios = {}; + if (typeof unityPackages === 'object') { + for (var unityPackage of unityPackages) { + if ( + unityPackage.variant && + unityPackage.variant !== 'standard' && + unityPackage.variant !== 'security' + ) { + continue; + } + if (unityPackage.platform === 'standalonewindows') { + pc = unityPackage; + } else if (unityPackage.platform === 'android') { + android = unityPackage; + } else if (unityPackage.platform === 'ios') { + ios = unityPackage; + } + } + } + return { pc, android, ios }; + }; + $app.methods.replaceVrcPackageUrl = function (url) { if (!url) { return ''; @@ -19143,8 +19168,21 @@ speechSynthesis.getVoices(); var fileSize = `${( version.file.sizeInBytes / 1048576 ).toFixed(2)} MB`; - bundleSizes[platform] = { createdAt, fileSize }; + bundleSizes[platform] = { + createdAt, + fileSize + }; + // update avatar dialog + if (this.avatarDialog.id === ref.id) { + this.avatarDialog.bundleSizes[platform] = + bundleSizes[platform]; + if ( + this.avatarDialog.lastUpdated < version.created_at + ) { + this.avatarDialog.lastUpdated = version.created_at; + } + } // update world dialog if (this.worldDialog.id === ref.id) { this.worldDialog.bundleSizes[platform] = @@ -19808,11 +19846,14 @@ speechSynthesis.getVoices(); isBlocked: false, isQuestFallback: false, hasImposter: false, + imposterVersion: '', isPC: false, isQuest: false, isIos: false, treeData: [], - fileSize: '', + bundleSizes: [], + platformInfo: {}, + lastUpdated: '', inCache: false, cacheSize: 0, cacheLocked: false, @@ -19863,7 +19904,6 @@ speechSynthesis.getVoices(); D.id = avatarId; D.fileAnalysis = {}; D.treeData = []; - D.fileSize = ''; D.inCache = false; D.cacheSize = 0; D.cacheLocked = false; @@ -19873,6 +19913,10 @@ speechSynthesis.getVoices(); D.isQuest = false; D.isIos = false; D.hasImposter = false; + D.imposterVersion = ''; + D.lastUpdated = ''; + D.bundleSizes = []; + D.platformInfo = {}; D.isFavorite = API.cachedFavoritesByObjectId.has(avatarId) || (this.isLocalUserVrcplusSupporter() && @@ -19912,49 +19956,19 @@ speechSynthesis.getVoices(); D.isPC = isPC; D.isQuest = isQuest; D.isIos = isIos; - var assetUrl = ''; + D.platformInfo = this.getPlatformInfo(args.ref.unityPackages); for (let i = ref.unityPackages.length - 1; i > -1; i--) { var unityPackage = ref.unityPackages[i]; - if ( - !assetUrl && - unityPackage.platform === 'standalonewindows' && - unityPackage.variant === 'standard' && - this.compareUnityVersion(unityPackage.unitySortNumber) - ) { - assetUrl = unityPackage.assetUrl; - } if (unityPackage.variant === 'impostor') { D.hasImposter = true; + D.imposterVersion = unityPackage.impostorizerVersion; + break; } } - var fileId = extractFileId(assetUrl); - var fileVersion = parseInt(extractFileVersion(assetUrl), 10); - if (!fileId) { - fileId = extractFileId(ref.assetUrl); - fileVersion = parseInt( - extractFileVersion(ref.assetUrl), - 10 - ); - } - D.fileSize = ''; - if (fileId) { - D.fileSize = 'Loading'; - API.getBundles(fileId) - .then((args2) => { - var { versions } = args2.json; - for (let i = versions.length - 1; i > -1; i--) { - var version = versions[i]; - if (version.version === fileVersion) { - D.fileSize = `${( - version.file.sizeInBytes / 1048576 - ).toFixed(2)} MB`; - break; - } - } - }) - .catch(() => { - D.fileSize = 'Error'; - }); + if (D.bundleSizes.length === 0) { + this.getBundleDateSize(ref).then((bundleSizes) => { + D.bundleSizes = bundleSizes; + }); } }) .catch((err) => { diff --git a/html/src/index.pug b/html/src/index.pug index 59a1cc943..850d221d6 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -786,7 +786,8 @@ html .x-friend-item(style="cursor:default") .detail span.name {{ $t('dialog.world.info.last_updated') }} - span.extra {{ worldDialog.lastUpdated | formatDate('long') }} + span.extra(v-if="worldDialog.lastUpdated") {{ worldDialog.lastUpdated | formatDate('long') }} + span.extra(v-else) {{ worldDialog.ref.updated_at | formatDate('long') }} .x-friend-item(v-if="worldDialog.ref.labsPublicationDate !== 'none'" style="cursor:default") .detail span.name {{ $t('dialog.world.info.labs_publication_date') }} @@ -860,12 +861,18 @@ html el-tag(v-if="avatarDialog.ref.releaseStatus === 'public'" type="success" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") {{ $t('dialog.avatar.tags.public') }} el-tag(v-else type="danger" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") {{ $t('dialog.avatar.tags.private') }} el-tag.x-tag-platform-pc(v-if="avatarDialog.isPC" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") PC + span.x-grey(v-if="avatarDialog.platformInfo.pc" style=";margin-left:5px;border-left:inherit;padding-left:5px") {{ avatarDialog.platformInfo.pc.performanceRating }} + span.x-grey(v-if="avatarDialog.bundleSizes['standalonewindows']" style=";margin-left:5px;border-left:inherit;padding-left:5px") {{ avatarDialog.bundleSizes['standalonewindows'].fileSize }} el-tag.x-tag-platform-quest(v-if="avatarDialog.isQuest" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Android + span.x-grey(v-if="avatarDialog.platformInfo.android" style=";margin-left:5px;border-left:inherit;padding-left:5px") {{ avatarDialog.platformInfo.android.performanceRating }} + span.x-grey(v-if="avatarDialog.bundleSizes['android']" style="margin-left:5px;border-left:inherit;padding-left:5px") {{ avatarDialog.bundleSizes['android'].fileSize }} el-tag.x-tag-platform-ios(v-if="avatarDialog.isIos" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") iOS + span.x-grey(v-if="avatarDialog.platformInfo.ios" style=";margin-left:5px;border-left:inherit;padding-left:5px") {{ avatarDialog.platformInfo.ios.performanceRating }} + span.x-grey(v-if="avatarDialog.bundleSizes['ios']" style="margin-left:5px;border-left:inherit;padding-left:5px") {{ avatarDialog.bundleSizes['ios'].fileSize }} el-tag(v-if="avatarDialog.isQuestFallback" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") {{ $t('dialog.avatar.tags.fallback') }} el-tag(v-if="avatarDialog.hasImposter" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") {{ $t('dialog.avatar.tags.impostor') }} + span.x-grey(v-if="avatarDialog.imposterVersion" style="margin-left:5px;border-left:inherit;padding-left:5px") V{{ avatarDialog.imposterVersion }} el-tag(v-if="avatarDialog.ref.unityPackageUrl" type="success" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") {{ $t('dialog.avatar.tags.future_proofing') }} - el-tag(v-if="avatarDialog.fileSize" type="info" effect="plain" size="mini" v-text="avatarDialog.fileSize" style="margin-right:5px;margin-top:5px") el-tag.x-link(v-if="avatarDialog.inCache" type="info" effect="plain" size="mini" @click="openFolderGeneric(avatarDialog.cachePath)" style="margin-right:5px;margin-top:5px") span(v-text="avatarDialog.cacheSize") | {{ $t('dialog.avatar.tags.cache') }} @@ -931,7 +938,8 @@ html .x-friend-item(style="cursor:default") .detail span.name {{ $t('dialog.avatar.info.last_updated') }} - span.extra {{ avatarDialog.ref.updated_at | formatDate('long') }} + span.extra(v-if="avatarDialog.lastUpdated") {{ avatarDialog.lastUpdated | formatDate('long') }} + span.extra(v-else) {{ avatarDialog.ref.updated_at | formatDate('long') }} .x-friend-item(style="cursor:default") .detail span.name {{ $t('dialog.avatar.info.version') }}