diff --git a/html/src/app.js b/html/src/app.js index de68523c..40d98fc1 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -1386,6 +1386,10 @@ speechSynthesis.getVoices(); }); API.$on('USER', function (args) { + if (!args?.json?.displayName) { + console.error('API.$on(USER) invalid args', args); + return; + } $app.queueUpdateFriend({ id: args.json.id, state: args.json.state }); args.ref = this.applyUser(args.json); }); @@ -2591,7 +2595,12 @@ speechSynthesis.getVoices(); } ref.$location = this.parseLocation(ref.location); if (json.world?.id) { - ref.world = this.applyWorld(json.world); + this.getCachedWorld({ + worldId: json.world.id + }).then((args) => { + ref.world = args.ref; + return args; + }); } if (!json.$fetchedAt) { ref.$fetchedAt = new Date().toJSON(); @@ -4702,27 +4711,18 @@ speechSynthesis.getVoices(); break; case 'friend-online': - if ( - content.location !== 'private' && - content.location !== 'traveling' - ) { - this.$emit('WORLD', { - json: content.world, + if (content?.user?.id) { + this.$emit('USER', { + json: { + location: content.location, + travelingToLocation: content.travelingToLocation, + ...content.user + }, params: { - worldId: content.world.id + userId: content.userId } }); } - this.$emit('USER', { - json: { - location: content.location, - travelingToLocation: content.travelingToLocation, - ...content.user - }, - params: { - userId: content.userId - } - }); this.$emit('FRIEND:STATE', { json: { state: 'online' @@ -4734,12 +4734,14 @@ speechSynthesis.getVoices(); break; case 'friend-active': - this.$emit('USER', { - json: content.user, - params: { - userId: content.userId - } - }); + if (content?.user?.id) { + this.$emit('USER', { + json: content.user, + params: { + userId: content.userId + } + }); + } this.$emit('FRIEND:STATE', { json: { state: 'active' @@ -4762,6 +4764,8 @@ speechSynthesis.getVoices(); break; case 'friend-update': + // is this used anymore? + console.error('friend-update', content); this.$emit('USER', { json: content.user, params: { @@ -4771,36 +4775,32 @@ speechSynthesis.getVoices(); break; case 'friend-location': - if ( - content.location !== 'private' && - content.location !== 'traveling' - ) { - this.$emit('WORLD', { - json: content.world, - params: { - worldId: content.world.id - } - }); - } - if (content.userId === this.currentUser.id) { - this.$emit('USER', { - json: content.user, - params: { - userId: content.userId - } - }); - } else { - this.$emit('USER', { - json: { - location: content.location, - travelingToLocation: content.travelingToLocation, - ...content.user - }, - params: { - userId: content.userId - } - }); + if (!content?.user?.id) { + var ref = this.cachedUsers.get(content.userId); + if (typeof ref !== 'undefined') { + this.$emit('USER', { + json: { + ...ref, + location: content.location, + travelingToLocation: content.travelingToLocation + }, + params: { + userId: content.userId + } + }); + } + break; } + this.$emit('USER', { + json: { + location: content.location, + travelingToLocation: content.travelingToLocation, + ...content.user + }, + params: { + userId: content.userId + } + }); break; case 'user-update': @@ -10997,20 +10997,25 @@ speechSynthesis.getVoices(); case 71: // Spawn Emoji var photonId = data.Parameters[254]; + if (photonId === this.photonLobbyCurrentUser) { + return; + } var type = data.Parameters[245][0]; var emojiName = ''; + var imageUrl = ''; if (type === 0) { var emojiId = data.Parameters[245][2]; emojiName = this.photonEmojis[emojiId]; } else if (type === 1) { - // file_id emojiName = data.Parameters[245][1]; + imageUrl = `https://api.vrchat.cloud/api/1/file/${emojiName}/1/`; } this.addEntryPhotonEvent({ photonId, text: emojiName, type: 'SpawnEmoji', - created_at: gameLogDate + created_at: gameLogDate, + imageUrl }); break; } @@ -25892,13 +25897,12 @@ speechSynthesis.getVoices(); fetchedAt: args.json.fetchedAt } }); - this.$emit('WORLD', { - json: json.world, - params: { - worldId: json.world.id - } + this.getCachedWorld({ + worldId: json.world.id + }).then((args1) => { + json.world = args1.ref; + return args1; }); - json.world = this.applyWorld(json.world); } }); @@ -25959,13 +25963,6 @@ speechSynthesis.getVoices(); fetchedAt: args.json.fetchedAt } }); - this.$emit('WORLD', { - json: json.world, - params: { - worldId: json.world.id - } - }); - var ref = this.cachedGroups.get(json.ownerId); if (typeof ref === 'undefined') { if ($app.friendLogInitStatus) { diff --git a/html/src/index.pug b/html/src/index.pug index a8925709..e41afaf3 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -323,8 +323,7 @@ html el-tooltip(placement="top" :content="$t('dialog.user.info.refresh_instance_info')" :disabled="hideTooltips") el-button(@click="refreshInstancePlayerCount(userDialog.$location.tag)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle) instance-info(:location="userDialog.$location.tag" :instance="userDialog.instance.ref" :friendcount="userDialog.instance.friendCount" :updateelement="updateInstanceInfo") - br - location(:location="userDialog.ref.location" :traveling="userDialog.ref.travelingToLocation" style="margin-top:5px") + location(:location="userDialog.ref.location" :traveling="userDialog.ref.travelingToLocation" style="display:block;margin-top:5px") .x-friend-list(style="flex:1;margin-top:10px;max-height:150px") .x-friend-item(v-if="userDialog.$location.userId" @click="showUserDialog(userDialog.$location.userId)" class="x-friend-item-border") template(v-if="userDialog.$location.user") diff --git a/html/src/mixins/tabs/playerList.pug b/html/src/mixins/tabs/playerList.pug index 8a689795..4b8ab22c 100644 --- a/html/src/mixins/tabs/playerList.pug +++ b/html/src/mixins/tabs/playerList.pug @@ -90,11 +90,11 @@ mixin playerListTab() i.el-icon-right el-tooltip(placement="top") template(#content) - span(v-if="scope.row.status === 'active'") Active - span(v-else-if="scope.row.status === 'join me'") Join Me - span(v-else-if="scope.row.status === 'ask me'") Ask Me - span(v-else-if="scope.row.status === 'busy'") Do Not Disturb - span(v-else) Offline + span(v-if="scope.row.status === 'active'") {{ $t('dialog.user.status.active') }} + span(v-else-if="scope.row.status === 'join me'") {{ $t('dialog.user.status.join_me') }} + span(v-else-if="scope.row.status === 'ask me'") {{ $t('dialog.user.status.ask_me') }} + span(v-else-if="scope.row.status === 'busy'") {{ $t('dialog.user.status.busy') }} + span(v-else) {{ $t('dialog.user.status.offline') }} i.x-user-status(:class="statusClass(scope.row.status)" style="margin-right:5px") span(v-if="scope.row.statusDescription !== scope.row.previousStatusDescription" v-text="scope.row.statusDescription") template(v-else-if="scope.row.type === 'ChangeGroup'") @@ -136,8 +136,8 @@ mixin playerListTab() span.x-link(v-text="scope.row.avatar.name" @click="showAvatarDialog(scope.row.avatar.id)") |   span(v-if="!scope.row.inCache" style="color:#aaa") #[i.el-icon-download]  - span.avatar-info-public(v-if="scope.row.avatar.releaseStatus === 'public'") (Public) - span.avatar-info-own(v-else-if="scope.row.avatar.releaseStatus === 'private'") (Private) + span.avatar-info-public(v-if="scope.row.avatar.releaseStatus === 'public'") {{ $t('dialog.avatar.labels.public') }} + span.avatar-info-own(v-else-if="scope.row.avatar.releaseStatus === 'private'") {{ $t('dialog.avatar.labels.private') }} template(v-if="scope.row.avatar.description && scope.row.avatar.name !== scope.row.avatar.description") | - {{ scope.row.avatar.description }} template(v-else-if="scope.row.type === 'ChangeStatus'") @@ -159,8 +159,8 @@ mixin playerListTab() span(v-else-if="scope.row.status === 'ask me'") {{ $t('dialog.user.status.ask_me') }} span(v-else-if="scope.row.status === 'busy'") {{ $t('dialog.user.status.busy') }} span(v-else) {{ $t('dialog.user.status.offline') }} - i.x-user-status(:class="statusClass(scope.row.status)") - span(v-if="scope.row.statusDescription !== scope.row.previousStatusDescription" v-text="scope.row.statusDescription" style="margin-left:5px") + i.x-user-status(:class="statusClass(scope.row.status)" style="margin-right:5px") + span(v-if="scope.row.statusDescription !== scope.row.previousStatusDescription" v-text="scope.row.statusDescription") template(v-else-if="scope.row.type === 'ChangeGroup'") span.x-link(v-if="scope.row.previousGroupName" v-text="scope.row.previousGroupName" @click="showGroupDialog(scope.row.previousGroupId)" style="margin-right:5px") span.x-link(v-else v-text="scope.row.previousGroupId" @click="showGroupDialog(scope.row.previousGroupId)" style="margin-right:5px") @@ -178,8 +178,8 @@ mixin playerListTab() span.x-link(v-text="scope.row.avatar.name" @click="showAvatarDialog(scope.row.avatar.id)") |   span(v-if="!scope.row.inCache" style="color:#aaa") #[i.el-icon-download]  - span.avatar-info-public(v-if="scope.row.avatar.releaseStatus === 'public'") (Public) - span.avatar-info-own(v-else-if="scope.row.avatar.releaseStatus === 'private'") (Private) + span.avatar-info-public(v-if="scope.row.avatar.releaseStatus === 'public'") {{ $t('dialog.avatar.labels.public') }} + span.avatar-info-own(v-else-if="scope.row.avatar.releaseStatus === 'private'") {{ $t('dialog.avatar.labels.private') }} span(v-else-if="scope.row.color === 'yellow'" v-text="scope.row.text" style="color:yellow") span(v-else v-text="scope.row.text") div.current-instance-table