Add world sizes for all platforms

This commit is contained in:
Natsumi
2024-08-02 09:46:04 +12:00
parent 29d3f85a08
commit 1d09785896
5 changed files with 90 additions and 65 deletions
+68 -56
View File
@@ -18073,8 +18073,8 @@ speechSynthesis.getVoices();
avatarScalingDisabled: false, avatarScalingDisabled: false,
inCache: false, inCache: false,
cacheSize: '', cacheSize: '',
fileCreatedAt: '', bundleSizes: [],
fileSize: '' lastUpdated: ''
}; };
$app.data.currentInstanceLocation = {}; $app.data.currentInstanceLocation = {};
@@ -18093,8 +18093,8 @@ speechSynthesis.getVoices();
avatarScalingDisabled: false, avatarScalingDisabled: false,
inCache: false, inCache: false,
cacheSize: '', cacheSize: '',
fileCreatedAt: '', bundleSizes: [],
fileSize: '' lastUpdated: ''
}; };
this.currentInstanceLocation = {}; this.currentInstanceLocation = {};
} else if (instanceId !== this.currentInstanceLocation.tag) { } else if (instanceId !== this.currentInstanceLocation.tag) {
@@ -18107,8 +18107,8 @@ speechSynthesis.getVoices();
avatarScalingDisabled: false, avatarScalingDisabled: false,
inCache: false, inCache: false,
cacheSize: '', cacheSize: '',
fileCreatedAt: '', bundleSizes: [],
fileSize: '' lastUpdated: ''
}; };
var L = API.parseLocation(instanceId); var L = API.parseLocation(instanceId);
this.currentInstanceLocation = L; this.currentInstanceLocation = L;
@@ -18132,12 +18132,9 @@ speechSynthesis.getVoices();
).toFixed(2)} MB`; ).toFixed(2)} MB`;
} }
}); });
this.getBundleDateSize(args.ref).then( this.getBundleDateSize(args.ref).then((bundleSizes) => {
({ createdAt, fileSize }) => { this.currentInstanceWorld.bundleSizes = bundleSizes;
this.currentInstanceWorld.fileCreatedAt = createdAt; });
this.currentInstanceWorld.fileSize = fileSize;
}
);
return args; return args;
}); });
} else { } else {
@@ -18766,8 +18763,8 @@ speechSynthesis.getVoices();
avatarScalingDisabled: false, avatarScalingDisabled: false,
rooms: [], rooms: [],
treeData: [], treeData: [],
fileCreatedAt: '', bundleSizes: [],
fileSize: '', lastUpdated: '',
inCache: false, inCache: false,
cacheSize: 0, cacheSize: 0,
cacheLocked: false, cacheLocked: false,
@@ -18814,61 +18811,76 @@ speechSynthesis.getVoices();
}); });
} }
} }
if (D.fileSize === 'Loading') { if (D.bundleSizes.length === 0) {
$app.getBundleDateSize(ref) $app.getBundleDateSize(ref).then((bundleSizes) => {
.then(({ createdAt, fileSize }) => { D.bundleSizes = bundleSizes;
D.fileCreatedAt = createdAt; });
if (fileSize) {
D.fileSize = fileSize;
} else {
D.fileSize = 'Error';
}
})
.catch(() => {
D.fileSize = 'Error';
});
} }
}); });
$app.methods.getBundleDateSize = async function (ref) { $app.methods.getBundleDateSize = async function (ref) {
var assetUrl = ''; var bundleSizes = [];
var createdAt = '';
var fileSize = '';
for (let i = ref.unityPackages.length - 1; i > -1; i--) { for (let i = ref.unityPackages.length - 1; i > -1; i--) {
var unityPackage = ref.unityPackages[i]; var unityPackage = ref.unityPackages[i];
if (unityPackage.variant && unityPackage.variant !== 'standard') { if (unityPackage.variant && unityPackage.variant !== 'standard') {
continue; continue;
} }
if ( if (!this.compareUnityVersion(unityPackage.unitySortNumber)) {
unityPackage.platform === 'standalonewindows' && continue;
this.compareUnityVersion(unityPackage.unitySortNumber) }
) {
assetUrl = unityPackage.assetUrl; var platform = unityPackage.platform;
break; 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); var args = await API.getBundles(fileId);
if ( if (!args?.json?.versions) {
typeof args.json !== 'undefined' && continue;
typeof args.json.versions !== 'undefined' }
) {
var { versions } = args.json; var { versions } = args.json;
for (let i = versions.length - 1; i > -1; i--) { for (let j = versions.length - 1; j > -1; j--) {
var version = versions[i]; var version = versions[j];
if (version.version === fileVersion) { if (version.version === fileVersion) {
createdAt = version.created_at; var createdAt = version.created_at;
fileSize = `${( var fileSize = `${(
version.file.sizeInBytes / 1048576 version.file.sizeInBytes / 1048576
).toFixed(2)} MB`; ).toFixed(2)} MB`;
break; 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) { API.$on('FAVORITE', function (args) {
@@ -18899,8 +18911,8 @@ speechSynthesis.getVoices();
D.id = L.worldId; D.id = L.worldId;
D.$location = L; D.$location = L;
D.treeData = []; D.treeData = [];
D.fileCreatedAt = ''; D.bundleSizes = [];
D.fileSize = 'Loading'; D.lastUpdated = '';
D.visible = true; D.visible = true;
D.loading = true; D.loading = true;
D.inCache = false; D.inCache = false;
+4
View File
@@ -637,6 +637,10 @@ i.x-user-status.busy {
border-color: #ff4177 !important; border-color: #ff4177 !important;
} }
.x-grey {
color: #909399;
}
.el-tree-node { .el-tree-node {
white-space: normal; white-space: normal;
} }
+9 -7
View File
@@ -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.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 }} 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") 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") el-tooltip(v-for="item in userDialog.ref.$languages" :key="item.key" placement="top")
template(#content) template(#content)
span {{ item.value }} ({{ item.key }}) span {{ item.value }} ({{ item.key }})
@@ -250,7 +250,7 @@ html
template(v-if="userDialog.ref.id === API.currentUser.id") template(v-if="userDialog.ref.id === API.currentUser.id")
br br
el-popover(placement="top" trigger="click") 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 }} span(style="display:block;text-align:center;font-family:monospace") {{ API.currentUser.username | textToHex }}
div 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") 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") 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") span.dialog-title(v-text="worldDialog.ref.name")
div(style="margin-top:5px") 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 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-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-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(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 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 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 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.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(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)") 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") span(v-text="worldDialog.cacheSize")
| {{ $t('dialog.world.tags.cache')}} | {{ $t('dialog.world.tags.cache')}}
@@ -782,7 +784,7 @@ html
.x-friend-item(style="cursor:default") .x-friend-item(style="cursor:default")
.detail .detail
span.name {{ $t('dialog.world.info.last_updated') }} 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") .x-friend-item(v-if="worldDialog.ref.labsPublicationDate !== 'none'" style="cursor:default")
.detail .detail
span.name {{ $t('dialog.world.info.labs_publication_date') }} span.name {{ $t('dialog.world.info.labs_publication_date') }}
@@ -851,7 +853,7 @@ html
div div
span.dialog-title(v-text="avatarDialog.ref.name") span.dialog-title(v-text="avatarDialog.ref.name")
div(style="margin-top:5px") 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 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-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(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-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-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-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-menu(#default="dropdown")
el-dropdown-item(icon="el-icon-refresh" command="Refresh") {{ $t('dialog.avatar.actions.refresh') }} 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') }} el-dropdown-item(icon="el-icon-check" :disabled="API.currentUser.currentAvatar === avatarDialog.id" command="Select Avatar") {{ $t('dialog.avatar.actions.select') }}
+5 -2
View File
@@ -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") 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 }} | #[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 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") 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-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 === '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(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 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 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 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(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(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") 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") .x-friend-item(style="cursor:default")
.detail .detail
span.name {{ $t('dialog.world.info.last_updated') }} 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") .x-friend-item(style="cursor:default")
.detail .detail
span.name {{ $t('dialog.world.info.created_at') }} span.name {{ $t('dialog.world.info.created_at') }}
+4
View File
@@ -397,3 +397,7 @@ button {
.x-menu-container { .x-menu-container {
background: #303133; background: #303133;
} }
.x-grey {
color: #b3b3b3;
}