diff --git a/html/src/app.js b/html/src/app.js index 8a35dd1f..0cca0803 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -9282,7 +9282,7 @@ speechSynthesis.getVoices(); D.loading = false; D.ref = args.ref; D.isFavorite = API.cachedFavoritesByObjectId.has(D.id); - this.updateVRChatCache(); + this.updateVRChatWorldCache(); if (args.cache) { API.getWorld(args.params); } @@ -9427,7 +9427,7 @@ speechSynthesis.getVoices(); D.loading = false; D.ref = args.ref; D.isFavorite = API.cachedFavoritesByObjectId.has(D.id); - this.updateVRChatCache(); + this.updateVRChatWorldCache(); } return args; }); @@ -9546,7 +9546,9 @@ speechSynthesis.getVoices(); isQuestFallback: false, treeData: [], fileCreatedAt: '', - fileSize: '' + fileSize: '', + inCache: false, + cacheSize: 0 }; API.$on('LOGOUT', function () { @@ -9576,23 +9578,26 @@ speechSynthesis.getVoices(); $app.methods.showAvatarDialog = function (avatarId) { this.$nextTick(() => adjustDialogZ(this.$refs.avatarDialog.$el)); var D = this.avatarDialog; + D.visible = true; D.id = avatarId; D.treeData = []; D.fileSize = ''; + D.inCache = false; + D.cacheSize = 0; D.isQuestFallback = false; D.isFavorite = API.cachedFavoritesByObjectId.has(avatarId); var ref = API.cachedAvatars.get(avatarId); if (typeof ref !== 'undefined') { D.ref = ref; - D.visible = true; + this.updateVRChatAvatarCache(); } API.getAvatar({ avatarId }).then((args) => { var { ref } = args; D.ref = ref; + this.updateVRChatAvatarCache(); if ((ref.imageUrl === API.currentUser.currentAvatarImageUrl) && (!ref.assetUrl)) { D.ref.assetUrl = API.currentUser.currentAvatarAssetUrl; } - D.visible = true; if (/quest/.test(ref.tags)) { D.isQuestFallback = true; } @@ -12464,7 +12469,7 @@ speechSynthesis.getVoices(); // Asset Bundle Cacher - $app.methods.updateVRChatCache = function () { + $app.methods.updateVRChatWorldCache = function () { var D = this.worldDialog; if (D.visible) { D.inCache = false; @@ -12478,6 +12483,20 @@ speechSynthesis.getVoices(); } }; + $app.methods.updateVRChatAvatarCache = function () { + var D = this.avatarDialog; + if (D.visible) { + D.inCache = false; + D.cacheSize = 0; + this.checkVRChatCache(D.ref).then((cacheSize) => { + if (cacheSize > 0) { + D.inCache = true; + D.cacheSize = `${(cacheSize / 1048576).toFixed(2)} MiB`; + } + }); + } + }; + $app.methods.checkVRChatCache = async function (ref) { var cacheDir = await this.getVRChatCacheDir(); return await AssetBundleCacher.CheckVRChatCache(ref.id, ref.version, cacheDir); @@ -12690,7 +12709,7 @@ speechSynthesis.getVoices(); break; case -3: if (this.worldDialog.id === this.downloadCurrent.id) { - this.updateVRChatCache(); + this.updateVRChatWorldCache(); } if (this.downloadCurrent.type === 'Manual') { this.$message({ @@ -12743,7 +12762,7 @@ speechSynthesis.getVoices(); return; case -12: if (this.worldDialog.id === this.downloadCurrent.id) { - this.updateVRChatCache(); + this.updateVRChatWorldCache(); } if (this.downloadCurrent.type === 'Manual') { this.$message({ @@ -12852,7 +12871,8 @@ speechSynthesis.getVoices(); var cacheDir = await this.getVRChatCacheDir(); await AssetBundleCacher.DeleteCache(cacheDir, ref.id, ref.version); this.getVRChatCacheSize(); - this.updateVRChatCache(); + this.updateVRChatWorldCache(); + this.updateVRChatAvatarCache(); }; $app.methods.showDeleteAllVRChatCacheConfirm = function () { @@ -13292,7 +13312,15 @@ speechSynthesis.getVoices(); }); this.checkingForVRCXUpdate = false; var json = JSON.parse(response.data); - D.releases = json; + var releases = []; + for (var release of json) { + for (var asset of release.assets) { + if ((asset.content_type === 'application/octet-stream') && (asset.state === 'uploaded')) { + releases.push(release); + } + } + } + D.releases = releases; D.release = json[0].name; if (configRepository.getString('VRCX_branch') !== this.branch) { configRepository.setString('VRCX_branch', this.branch); diff --git a/html/src/index.pug b/html/src/index.pug index 490cdd62..30b9ad36 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -1240,10 +1240,13 @@ html div(style="margin-top:5px") span.x-link(v-text="worldDialog.ref.authorName" @click="showUserDialog(worldDialog.ref.authorId)" style="color:#909399;font-family:monospace") div(style="margin-top:5px") - el-tag(v-if="worldDialog.ref.$isLabs" type="primary" effect="plain" size="mini") Labs - el-tag(v-else-if="worldDialog.ref.releaseStatus === 'public'" type="success" effect="plain" size="mini") Public - el-tag(v-else type="danger" effect="plain" size="mini") Private - el-tag(type="info" effect="plain" size="mini" v-text="worldDialog.fileSize" style="margin-left:5px") + el-tag(v-if="worldDialog.ref.$isLabs" type="primary" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Labs + el-tag(v-else-if="worldDialog.ref.releaseStatus === 'public'" type="success" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Public + el-tag(v-else type="danger" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Private + el-tag(type="info" effect="plain" size="mini" v-text="worldDialog.fileSize" style="margin-right:5px;margin-top:5px") + el-tag(v-if="worldDialog.inCache" type="info" effect="plain" size="mini" style="margin-top:5px") + span(v-text="worldDialog.cacheSize") + | Cache div(style="margin-top:5px") span(v-show="worldDialog.ref.name !== worldDialog.ref.description" v-text="worldDialog.ref.description" style="font-size:12px") div(style="flex:none;margin-left:10px") @@ -1383,17 +1386,22 @@ html div(style="margin-top:5px") span.x-link(v-text="avatarDialog.ref.authorName" @click="showUserDialog(avatarDialog.ref.authorId)" style="color:#909399;font-family:monospace") div(style="margin-top:5px") - el-tag(v-if="avatarDialog.ref.releaseStatus === 'public'" type="success" effect="plain" size="mini") Public - el-tag(v-else type="danger" effect="plain" size="mini") Private - el-tag(v-if="avatarDialog.isQuestFallback" type="info" effect="plain" size="mini" style="margin-left:5px") Fallback - el-tag(v-if="avatarDialog.fileSize" type="info" effect="plain" size="mini" v-text="avatarDialog.fileSize" style="margin-left:5px") + el-tag(v-if="avatarDialog.ref.releaseStatus === 'public'" type="success" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Public + el-tag(v-else type="danger" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Private + el-tag(v-if="avatarDialog.isQuestFallback" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Fallback + 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(v-if="avatarDialog.inCache" type="info" effect="plain" size="mini" style="margin-top:5px") + span(v-text="avatarDialog.cacheSize") + | Cache div(style="margin-top:5px") span(v-show="avatarDialog.ref.name !== avatarDialog.ref.description" v-text="avatarDialog.ref.description" style="font-size:12px") div(style="flex:none;margin-left:10px") + el-tooltip(v-if="avatarDialog.inCache" placement="top" content="Delete avatar from cache" :disabled="hideTooltips") + el-button(icon="el-icon-delete" circle @click="deleteVRChatCache(avatarDialog.ref)") el-tooltip(v-if="avatarDialog.isFavorite" placement="top" content="Remove from favorites" :disabled="hideTooltips") - el-button(type="warning" icon="el-icon-star-on" circle @click="avatarDialogCommand('Delete Favorite')") + el-button(type="warning" icon="el-icon-star-on" circle @click="avatarDialogCommand('Delete Favorite')" style="margin-left:5px") el-tooltip(v-else placement="top" content="Add to favorites" :disabled="hideTooltips") - el-button(type="default" icon="el-icon-star-off" circle @click="avatarDialogCommand('Add Favorite')") + 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="default" icon="el-icon-more" circle) el-dropdown-menu(#default="dropdown") @@ -1729,9 +1737,6 @@ html //- dialog: update VRCX el-dialog.x-dialog(ref="VRCXUpdateDialog" :visible.sync="VRCXUpdateDialog.visible" title="VRCX Updater" width="400px") div(v-loading="checkingForVRCXUpdate" style="margin-top:15px") - template(v-if="!VRCXUpdateDialog.updatePending && VRCXUpdateDialog.release === appVersion") - span VRCX is up to date. - br template(v-if="VRCXUpdateDialog.updatePending") span Update ready for install, restart VRCX to apply. template(v-else) @@ -1739,6 +1744,9 @@ html el-option(v-once v-for="branch in branches" :key="branch.name" :label="branch.name" :value="branch.name") el-select(v-model="VRCXUpdateDialog.release" style="display:inline-block;width:150px") el-option(v-for="item in VRCXUpdateDialog.releases" :key="item.name" :label="item.tag_name" :value="item.name") + template(v-if="!VRCXUpdateDialog.updatePending && VRCXUpdateDialog.release === appVersion") + br + span VRCX is up to date. template(#footer) el-button(v-if="!VRCXUpdateDialog.updatePending && VRCXUpdateDialog.release !== appVersion" type="primary" size="small" @click="installVRCXUpdate") Download el-button(v-if="VRCXUpdateDialog.updatePending" type="primary" size="small" @click="restartVRCX") Install