diff --git a/html/src/app.js b/html/src/app.js index 478bebca..e7901ea3 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -18073,8 +18073,8 @@ speechSynthesis.getVoices(); avatarScalingDisabled: false, inCache: false, cacheSize: '', - fileCreatedAt: '', - fileSize: '' + bundleSizes: [], + lastUpdated: '' }; $app.data.currentInstanceLocation = {}; @@ -18093,8 +18093,8 @@ speechSynthesis.getVoices(); avatarScalingDisabled: false, inCache: false, cacheSize: '', - fileCreatedAt: '', - fileSize: '' + bundleSizes: [], + lastUpdated: '' }; this.currentInstanceLocation = {}; } else if (instanceId !== this.currentInstanceLocation.tag) { @@ -18107,8 +18107,8 @@ speechSynthesis.getVoices(); avatarScalingDisabled: false, inCache: false, cacheSize: '', - fileCreatedAt: '', - fileSize: '' + bundleSizes: [], + lastUpdated: '' }; var L = API.parseLocation(instanceId); this.currentInstanceLocation = L; @@ -18132,12 +18132,9 @@ speechSynthesis.getVoices(); ).toFixed(2)} MB`; } }); - this.getBundleDateSize(args.ref).then( - ({ createdAt, fileSize }) => { - this.currentInstanceWorld.fileCreatedAt = createdAt; - this.currentInstanceWorld.fileSize = fileSize; - } - ); + this.getBundleDateSize(args.ref).then((bundleSizes) => { + this.currentInstanceWorld.bundleSizes = bundleSizes; + }); return args; }); } else { @@ -18766,8 +18763,8 @@ speechSynthesis.getVoices(); avatarScalingDisabled: false, rooms: [], treeData: [], - fileCreatedAt: '', - fileSize: '', + bundleSizes: [], + lastUpdated: '', inCache: false, cacheSize: 0, cacheLocked: false, @@ -18814,61 +18811,76 @@ speechSynthesis.getVoices(); }); } } - if (D.fileSize === 'Loading') { - $app.getBundleDateSize(ref) - .then(({ createdAt, fileSize }) => { - D.fileCreatedAt = createdAt; - if (fileSize) { - D.fileSize = fileSize; - } else { - D.fileSize = 'Error'; - } - }) - .catch(() => { - D.fileSize = 'Error'; - }); + if (D.bundleSizes.length === 0) { + $app.getBundleDateSize(ref).then((bundleSizes) => { + D.bundleSizes = bundleSizes; + }); } }); $app.methods.getBundleDateSize = async function (ref) { - var assetUrl = ''; - var createdAt = ''; - var fileSize = ''; + var bundleSizes = []; for (let i = ref.unityPackages.length - 1; i > -1; i--) { var unityPackage = ref.unityPackages[i]; if (unityPackage.variant && unityPackage.variant !== 'standard') { continue; } - if ( - unityPackage.platform === 'standalonewindows' && - this.compareUnityVersion(unityPackage.unitySortNumber) - ) { - assetUrl = unityPackage.assetUrl; - break; + if (!this.compareUnityVersion(unityPackage.unitySortNumber)) { + continue; + } + + var platform = unityPackage.platform; + if (bundleSizes[platform]) { + continue; + } + var assetUrl = unityPackage.assetUrl; + var fileId = extractFileId(assetUrl); + var fileVersion = parseInt(extractFileVersion(assetUrl), 10); + if (!fileId) { + continue; } - } - var fileId = extractFileId(assetUrl); - var fileVersion = parseInt(extractFileVersion(assetUrl), 10); - if (fileId) { var args = await API.getBundles(fileId); - if ( - typeof args.json !== 'undefined' && - typeof args.json.versions !== 'undefined' - ) { - var { versions } = args.json; - for (let i = versions.length - 1; i > -1; i--) { - var version = versions[i]; - if (version.version === fileVersion) { - createdAt = version.created_at; - fileSize = `${( - version.file.sizeInBytes / 1048576 - ).toFixed(2)} MB`; - break; + if (!args?.json?.versions) { + continue; + } + + var { versions } = args.json; + for (let j = versions.length - 1; j > -1; j--) { + var version = versions[j]; + if (version.version === fileVersion) { + var createdAt = version.created_at; + var fileSize = `${( + version.file.sizeInBytes / 1048576 + ).toFixed(2)} MB`; + bundleSizes[platform] = { createdAt, fileSize }; + + // update world dialog + if (this.worldDialog.id === ref.id) { + this.worldDialog.bundleSizes[platform] = + bundleSizes[platform]; + if (this.worldDialog.lastUpdated < version.created_at) { + this.worldDialog.lastUpdated = version.created_at; + } } + // update player list + if (this.currentInstanceLocation.worldId === ref.id) { + this.currentInstanceWorld.bundleSizes[platform] = + bundleSizes[platform]; + + if ( + this.currentInstanceWorld.lastUpdated < + version.created_at + ) { + this.currentInstanceWorld.lastUpdated = + version.created_at; + } + } + break; } } } - return { createdAt, fileSize }; + + return bundleSizes; }; API.$on('FAVORITE', function (args) { @@ -18899,8 +18911,8 @@ speechSynthesis.getVoices(); D.id = L.worldId; D.$location = L; D.treeData = []; - D.fileCreatedAt = ''; - D.fileSize = 'Loading'; + D.bundleSizes = []; + D.lastUpdated = ''; D.visible = true; D.loading = true; D.inCache = false; diff --git a/html/src/app.scss b/html/src/app.scss index c597c21f..a6fe6b71 100644 --- a/html/src/app.scss +++ b/html/src/app.scss @@ -637,6 +637,10 @@ i.x-user-status.busy { border-color: #ff4177 !important; } +.x-grey { + color: #909399; +} + .el-tree-node { white-space: normal; } diff --git a/html/src/index.pug b/html/src/index.pug index b9452cb2..2f670fa1 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -242,7 +242,7 @@ html span.dialog-title(slot="reference" v-text="userDialog.ref.displayName" style="margin-left:5px;margin-right:5px;cursor:pointer") span(style="display:block;text-align:center;font-family:monospace") {{ userDialog.ref.displayName | textToHex }} el-tooltip(v-if="userDialog.ref.pronouns" placement="top" :content="$t('dialog.user.pronouns')" :disabled="hideTooltips") - span(v-text="userDialog.ref.pronouns" style="margin-right:5px;color:#909399;font-family:monospace;font-size:12px") + span.x-grey(v-text="userDialog.ref.pronouns" style="margin-right:5px;font-family:monospace;font-size:12px") el-tooltip(v-for="item in userDialog.ref.$languages" :key="item.key" placement="top") template(#content) span {{ item.value }} ({{ item.key }}) @@ -250,7 +250,7 @@ html template(v-if="userDialog.ref.id === API.currentUser.id") br el-popover(placement="top" trigger="click") - span(slot="reference" v-text="API.currentUser.username" style="margin-right:10px;color:#909399;font-family:monospace;font-size:12px;cursor:pointer") + span.x-grey(slot="reference" v-text="API.currentUser.username" style="margin-right:10px;font-family:monospace;font-size:12px;cursor:pointer") span(style="display:block;text-align:center;font-family:monospace") {{ API.currentUser.username | textToHex }} div el-tag.name(type="info" effect="plain" size="mini" :class="userDialog.ref.$trustClass" v-text="userDialog.ref.$trustLevel" style="margin-right:5px;margin-top:5px") @@ -643,17 +643,19 @@ html i.el-icon-s-home(v-show="API.currentUser.$homeLocation && API.currentUser.$homeLocation.worldId === worldDialog.id" style="margin-right:5px") span.dialog-title(v-text="worldDialog.ref.name") div(style="margin-top:5px") - span.x-link(v-text="worldDialog.ref.authorName" @click="showUserDialog(worldDialog.ref.authorId)" style="color:#909399;font-family:monospace") + span.x-link.x-grey(v-text="worldDialog.ref.authorName" @click="showUserDialog(worldDialog.ref.authorId)" style="font-family:monospace") div el-tag(v-if="worldDialog.ref.$isLabs" type="primary" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") {{ $t('dialog.world.tags.labs') }} el-tag(v-else-if="worldDialog.ref.releaseStatus === 'public'" type="success" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") {{ $t('dialog.world.tags.public') }} el-tag(v-else type="danger" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") {{ $t('dialog.world.tags.private') }} el-tag.x-tag-platform-pc(v-if="worldDialog.isPC" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") PC + span.x-grey(v-if="worldDialog.bundleSizes['standalonewindows']" style=";margin-left:5px;border-left:inherit;padding-left:5px") {{ worldDialog.bundleSizes['standalonewindows'].fileSize }} el-tag.x-tag-platform-quest(v-if="worldDialog.isQuest" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Android + span.x-grey(v-if="worldDialog.bundleSizes['android']" style="margin-left:5px;border-left:inherit;padding-left:5px") {{ worldDialog.bundleSizes['android'].fileSize }} el-tag.x-tag-platform-ios(v-if="worldDialog.isIos" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") iOS + span.x-grey(v-if="worldDialog.bundleSizes['ios']" style="margin-left:5px;border-left:inherit;padding-left:5px") {{ worldDialog.bundleSizes['ios'].fileSize }} el-tag(v-if="worldDialog.avatarScalingDisabled" type="warning" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") {{ $t('dialog.world.tags.avatar_scaling_disabled') }} el-tag(v-if="worldDialog.ref.unityPackageUrl" type="success" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") {{ $t('dialog.world.tags.future_proofing') }} - el-tag(type="info" effect="plain" size="mini" v-text="worldDialog.fileSize" style="margin-right:5px;margin-top:5px") el-tag.x-link(v-if="worldDialog.inCache" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px" @click="openFolderGeneric(worldDialog.cachePath)") span(v-text="worldDialog.cacheSize") | {{ $t('dialog.world.tags.cache')}} @@ -782,7 +784,7 @@ html .x-friend-item(style="cursor:default") .detail span.name {{ $t('dialog.world.info.last_updated') }} - span.extra {{ worldDialog.fileCreatedAt | formatDate('long') }} + span.extra {{ worldDialog.lastUpdated | formatDate('long') }} .x-friend-item(v-if="worldDialog.ref.labsPublicationDate !== 'none'" style="cursor:default") .detail span.name {{ $t('dialog.world.info.labs_publication_date') }} @@ -851,7 +853,7 @@ html div span.dialog-title(v-text="avatarDialog.ref.name") div(style="margin-top:5px") - span.x-link(v-text="avatarDialog.ref.authorName" @click="showUserDialog(avatarDialog.ref.authorId)" style="color:#909399;font-family:monospace") + span.x-link.x-grey(v-text="avatarDialog.ref.authorName" @click="showUserDialog(avatarDialog.ref.authorId)" style="font-family:monospace") div 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') }} @@ -884,7 +886,7 @@ html el-tooltip(v-else placement="top" :content="$t('dialog.avatar.actions.favorite_tooltip')" :disabled="hideTooltips") el-button(type="default" icon="el-icon-star-off" circle @click="avatarDialogCommand('Add Favorite')" style="margin-left:5px") el-dropdown(trigger="click" @command="avatarDialogCommand" size="small" style="margin-left:5px") - el-button(:type="avatarDialog.isBlocked ? 'danger' : 'default'" icon="el-icon-more" circle style="margin-left:5px") + el-button(:type="avatarDialog.isBlocked ? 'danger' : 'default'" icon="el-icon-more" circle) el-dropdown-menu(#default="dropdown") el-dropdown-item(icon="el-icon-refresh" command="Refresh") {{ $t('dialog.avatar.actions.refresh') }} el-dropdown-item(icon="el-icon-check" :disabled="API.currentUser.currentAvatar === avatarDialog.id" command="Select Avatar") {{ $t('dialog.avatar.actions.select') }} diff --git a/html/src/mixins/tabs/playerList.pug b/html/src/mixins/tabs/playerList.pug index a92038c1..64652be3 100644 --- a/html/src/mixins/tabs/playerList.pug +++ b/html/src/mixins/tabs/playerList.pug @@ -10,14 +10,17 @@ mixin playerListTab() span.x-link(@click="showWorldDialog(currentInstanceWorld.ref.id)" style="font-weight:bold;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1") | #[i.el-icon-s-home(v-show="API.currentUser.$homeLocation && API.currentUser.$homeLocation.worldId === currentInstanceWorld.ref.id" style="margin-right:5px")] {{ currentInstanceWorld.ref.name }} div - span.x-link(v-text="currentInstanceWorld.ref.authorName" @click="showUserDialog(currentInstanceWorld.ref.authorId)" style="color:#909399;font-family:monospace") + span.x-link.x-grey(v-text="currentInstanceWorld.ref.authorName" @click="showUserDialog(currentInstanceWorld.ref.authorId)" style="font-family:monospace") div(style="margin-top:5px") el-tag(v-if="currentInstanceWorld.ref.$isLabs" type="primary" effect="plain" size="mini" style="margin-right:5px") {{ $t('dialog.world.tags.labs') }} el-tag(v-else-if="currentInstanceWorld.ref.releaseStatus === 'public'" type="success" effect="plain" size="mini" style="margin-right:5px") {{ $t('dialog.world.tags.public') }} el-tag(v-else-if="currentInstanceWorld.ref.releaseStatus === 'private'" type="danger" effect="plain" size="mini" style="margin-right:5px") {{ $t('dialog.world.tags.private') }} el-tag.x-tag-platform-pc(v-if="currentInstanceWorld.isPC" type="info" effect="plain" size="mini" style="margin-right:5px") PC + span.x-grey(v-if="currentInstanceWorld.bundleSizes['standalonewindows']" style="margin-left:5px;border-left:inherit;padding-left:5px") {{ currentInstanceWorld.bundleSizes['standalonewindows'].fileSize }} el-tag.x-tag-platform-quest(v-if="currentInstanceWorld.isQuest" type="info" effect="plain" size="mini" style="margin-right:5px") Android + span.x-grey(v-if="currentInstanceWorld.bundleSizes['android']" style="margin-left:5px;border-left:inherit;padding-left:5px") {{ currentInstanceWorld.bundleSizes['android'].fileSize }} el-tag.x-tag-platform-ios(v-if="currentInstanceWorld.isIOS" type="info" effect="plain" size="mini" style="margin-right:5px") iOS + span.x-grey(v-if="currentInstanceWorld.bundleSizes['ios']" style="margin-left:5px;border-left:inherit;padding-left:5px") {{ currentInstanceWorld.bundleSizes['ios'].fileSize }} el-tag(v-if="currentInstanceWorld.avatarScalingDisabled" type="warning" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") {{ $t('dialog.world.tags.avatar_scaling_disabled') }} el-tag(type="info" effect="plain" size="mini" v-text="currentInstanceWorld.fileSize" style="margin-right:5px") el-tag(v-if="currentInstanceWorld.inCache" type="info" effect="plain" size="mini" style="margin-right:5px") @@ -39,7 +42,7 @@ mixin playerListTab() .x-friend-item(style="cursor:default") .detail span.name {{ $t('dialog.world.info.last_updated') }} - span.extra {{ currentInstanceWorld.fileCreatedAt | formatDate('long') }} + span.extra {{ currentInstanceWorld.lastUpdated | formatDate('long') }} .x-friend-item(style="cursor:default") .detail span.name {{ $t('dialog.world.info.created_at') }} diff --git a/html/src/theme.dark.scss b/html/src/theme.dark.scss index 936a1da5..aeba91bc 100644 --- a/html/src/theme.dark.scss +++ b/html/src/theme.dark.scss @@ -397,3 +397,7 @@ button { .x-menu-container { background: #303133; } + +.x-grey { + color: #b3b3b3; +}