Fixes for websocket changes

This commit is contained in:
Natsumi
2023-06-29 23:28:13 +12:00
parent 825377463e
commit 35ae13ce7a
3 changed files with 77 additions and 81 deletions
+65 -68
View File
@@ -1386,6 +1386,10 @@ speechSynthesis.getVoices();
}); });
API.$on('USER', function (args) { 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 }); $app.queueUpdateFriend({ id: args.json.id, state: args.json.state });
args.ref = this.applyUser(args.json); args.ref = this.applyUser(args.json);
}); });
@@ -2591,7 +2595,12 @@ speechSynthesis.getVoices();
} }
ref.$location = this.parseLocation(ref.location); ref.$location = this.parseLocation(ref.location);
if (json.world?.id) { 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) { if (!json.$fetchedAt) {
ref.$fetchedAt = new Date().toJSON(); ref.$fetchedAt = new Date().toJSON();
@@ -4702,27 +4711,18 @@ speechSynthesis.getVoices();
break; break;
case 'friend-online': case 'friend-online':
if ( if (content?.user?.id) {
content.location !== 'private' && this.$emit('USER', {
content.location !== 'traveling' json: {
) { location: content.location,
this.$emit('WORLD', { travelingToLocation: content.travelingToLocation,
json: content.world, ...content.user
},
params: { 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', { this.$emit('FRIEND:STATE', {
json: { json: {
state: 'online' state: 'online'
@@ -4734,12 +4734,14 @@ speechSynthesis.getVoices();
break; break;
case 'friend-active': case 'friend-active':
this.$emit('USER', { if (content?.user?.id) {
json: content.user, this.$emit('USER', {
params: { json: content.user,
userId: content.userId params: {
} userId: content.userId
}); }
});
}
this.$emit('FRIEND:STATE', { this.$emit('FRIEND:STATE', {
json: { json: {
state: 'active' state: 'active'
@@ -4762,6 +4764,8 @@ speechSynthesis.getVoices();
break; break;
case 'friend-update': case 'friend-update':
// is this used anymore?
console.error('friend-update', content);
this.$emit('USER', { this.$emit('USER', {
json: content.user, json: content.user,
params: { params: {
@@ -4771,36 +4775,32 @@ speechSynthesis.getVoices();
break; break;
case 'friend-location': case 'friend-location':
if ( if (!content?.user?.id) {
content.location !== 'private' && var ref = this.cachedUsers.get(content.userId);
content.location !== 'traveling' if (typeof ref !== 'undefined') {
) { this.$emit('USER', {
this.$emit('WORLD', { json: {
json: content.world, ...ref,
params: { location: content.location,
worldId: content.world.id travelingToLocation: content.travelingToLocation
} },
}); params: {
} userId: content.userId
if (content.userId === this.currentUser.id) { }
this.$emit('USER', { });
json: content.user, }
params: { break;
userId: content.userId
}
});
} else {
this.$emit('USER', {
json: {
location: content.location,
travelingToLocation: content.travelingToLocation,
...content.user
},
params: {
userId: content.userId
}
});
} }
this.$emit('USER', {
json: {
location: content.location,
travelingToLocation: content.travelingToLocation,
...content.user
},
params: {
userId: content.userId
}
});
break; break;
case 'user-update': case 'user-update':
@@ -10997,20 +10997,25 @@ speechSynthesis.getVoices();
case 71: case 71:
// Spawn Emoji // Spawn Emoji
var photonId = data.Parameters[254]; var photonId = data.Parameters[254];
if (photonId === this.photonLobbyCurrentUser) {
return;
}
var type = data.Parameters[245][0]; var type = data.Parameters[245][0];
var emojiName = ''; var emojiName = '';
var imageUrl = '';
if (type === 0) { if (type === 0) {
var emojiId = data.Parameters[245][2]; var emojiId = data.Parameters[245][2];
emojiName = this.photonEmojis[emojiId]; emojiName = this.photonEmojis[emojiId];
} else if (type === 1) { } else if (type === 1) {
// file_id
emojiName = data.Parameters[245][1]; emojiName = data.Parameters[245][1];
imageUrl = `https://api.vrchat.cloud/api/1/file/${emojiName}/1/`;
} }
this.addEntryPhotonEvent({ this.addEntryPhotonEvent({
photonId, photonId,
text: emojiName, text: emojiName,
type: 'SpawnEmoji', type: 'SpawnEmoji',
created_at: gameLogDate created_at: gameLogDate,
imageUrl
}); });
break; break;
} }
@@ -25892,13 +25897,12 @@ speechSynthesis.getVoices();
fetchedAt: args.json.fetchedAt fetchedAt: args.json.fetchedAt
} }
}); });
this.$emit('WORLD', { this.getCachedWorld({
json: json.world, worldId: json.world.id
params: { }).then((args1) => {
worldId: json.world.id json.world = args1.ref;
} return args1;
}); });
json.world = this.applyWorld(json.world);
} }
}); });
@@ -25959,13 +25963,6 @@ speechSynthesis.getVoices();
fetchedAt: args.json.fetchedAt fetchedAt: args.json.fetchedAt
} }
}); });
this.$emit('WORLD', {
json: json.world,
params: {
worldId: json.world.id
}
});
var ref = this.cachedGroups.get(json.ownerId); var ref = this.cachedGroups.get(json.ownerId);
if (typeof ref === 'undefined') { if (typeof ref === 'undefined') {
if ($app.friendLogInitStatus) { if ($app.friendLogInitStatus) {
+1 -2
View File
@@ -323,8 +323,7 @@ html
el-tooltip(placement="top" :content="$t('dialog.user.info.refresh_instance_info')" :disabled="hideTooltips") 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) 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") 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="display:block;margin-top:5px")
location(:location="userDialog.ref.location" :traveling="userDialog.ref.travelingToLocation" style="margin-top:5px")
.x-friend-list(style="flex:1;margin-top:10px;max-height:150px") .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") .x-friend-item(v-if="userDialog.$location.userId" @click="showUserDialog(userDialog.$location.userId)" class="x-friend-item-border")
template(v-if="userDialog.$location.user") template(v-if="userDialog.$location.user")
+11 -11
View File
@@ -90,11 +90,11 @@ mixin playerListTab()
i.el-icon-right i.el-icon-right
el-tooltip(placement="top") el-tooltip(placement="top")
template(#content) template(#content)
span(v-if="scope.row.status === 'active'") Active span(v-if="scope.row.status === 'active'") {{ $t('dialog.user.status.active') }}
span(v-else-if="scope.row.status === 'join me'") Join Me span(v-else-if="scope.row.status === 'join me'") {{ $t('dialog.user.status.join_me') }}
span(v-else-if="scope.row.status === 'ask me'") Ask Me span(v-else-if="scope.row.status === 'ask me'") {{ $t('dialog.user.status.ask_me') }}
span(v-else-if="scope.row.status === 'busy'") Do Not Disturb span(v-else-if="scope.row.status === 'busy'") {{ $t('dialog.user.status.busy') }}
span(v-else) Offline span(v-else) {{ $t('dialog.user.status.offline') }}
i.x-user-status(:class="statusClass(scope.row.status)" style="margin-right: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") span(v-if="scope.row.statusDescription !== scope.row.previousStatusDescription" v-text="scope.row.statusDescription")
template(v-else-if="scope.row.type === 'ChangeGroup'") 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.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(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-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'") (Private) 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") template(v-if="scope.row.avatar.description && scope.row.avatar.name !== scope.row.avatar.description")
| - {{ scope.row.avatar.description }} | - {{ scope.row.avatar.description }}
template(v-else-if="scope.row.type === 'ChangeStatus'") 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 === 'ask me'") {{ $t('dialog.user.status.ask_me') }}
span(v-else-if="scope.row.status === 'busy'") {{ $t('dialog.user.status.busy') }} span(v-else-if="scope.row.status === 'busy'") {{ $t('dialog.user.status.busy') }}
span(v-else) {{ $t('dialog.user.status.offline') }} span(v-else) {{ $t('dialog.user.status.offline') }}
i.x-user-status(:class="statusClass(scope.row.status)") 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" style="margin-left:5px") span(v-if="scope.row.statusDescription !== scope.row.previousStatusDescription" v-text="scope.row.statusDescription")
template(v-else-if="scope.row.type === 'ChangeGroup'") 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-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") 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.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(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-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'") (Private) 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-if="scope.row.color === 'yellow'" v-text="scope.row.text" style="color:yellow")
span(v-else v-text="scope.row.text") span(v-else v-text="scope.row.text")
div.current-instance-table div.current-instance-table