diff --git a/html/src/app.js b/html/src/app.js index 3cbb4085..8f051f29 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -1300,7 +1300,7 @@ speechSynthesis.getVoices(); travelingToWorld: '', // VRCX $online_for: Date.now(), - $offline_for: Date.now(), + $offline_for: '', $travelingToTime: Date.now(), $homeLocation: {}, $isVRCPlus: false, @@ -6788,8 +6788,10 @@ speechSynthesis.getVoices(); (newState === 'offline' || newState === 'active') && ctx.state === 'online' ) { - ctx.ref.$online_for = ''; - ctx.ref.$offline_for = Date.now(); + if (ctx.ref !== 'undefined') { + ctx.ref.$online_for = ''; + ctx.ref.$offline_for = Date.now(); + } var ts = Date.now(); var time = ts - $location_at; var worldName = await this.getWorldName(location); @@ -6805,9 +6807,11 @@ speechSynthesis.getVoices(); this.addFeed(feed); database.addOnlineOfflineToDatabase(feed); } else if (newState === 'online') { - ctx.ref.$location_at = Date.now(); - ctx.ref.$online_for = Date.now(); - ctx.ref.$offline_for = ''; + if (ctx.ref !== 'undefined') { + ctx.ref.$location_at = Date.now(); + ctx.ref.$online_for = Date.now(); + ctx.ref.$offline_for = ''; + } var worldName = await this.getWorldName(newRef.location); var feed = { created_at: new Date().toJSON(), @@ -10932,9 +10936,11 @@ speechSynthesis.getVoices(); } var ref = API.cachedUsers.get(id); if (typeof ref === 'undefined') { - API.getUser({ - userId: id - }); + try { + API.getUser({ + userId: id + }); + } catch {} return; } API.getFriendStatus({ @@ -13236,8 +13242,8 @@ speechSynthesis.getVoices(); instanceId: L.instanceId }); } - D.$location = L; } + D.$location = L; if (L.userId) { var ref = API.cachedUsers.get(L.userId); if (typeof ref === 'undefined') { @@ -19705,6 +19711,17 @@ speechSynthesis.getVoices(); API.currentUser.location = this.lastLocation.location; API.currentUser.travelingToLocation = this.lastLocationDestination; API.currentUser.$travelingToTime = this.lastLocationDestinationTime; + var ref = API.cachedUsers.get(API.currentUser.id); + if (typeof ref !== 'undefined') { + var currentLocation = this.lastLocation.location; + if (this.lastLocation.location === 'traveling') { + currentLocation = this.lastLocationDestination; + } + ref.$location = API.parseLocation(currentLocation); + ref.location = this.lastLocation.location; + ref.travelingToLocation = this.lastLocationDestination; + ref.$travelingToTime = this.lastLocationDestinationTime; + } }; $app.data.avatarHistory = new Set(); diff --git a/html/src/index.pug b/html/src/index.pug index c6f157bf..f9215142 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -1532,13 +1532,13 @@ html div(v-if="userDialog.ref.location" style="display:flex;flex-direction:column;margin-bottom:10px;padding-bottom:10px;border-bottom:1px solid #e4e7ed14") div(style="flex:none") location(:location="userDialog.ref.location" :traveling="userDialog.ref.travelingToLocation") - template(v-if="isRealInstance(userDialog.ref.$location.tag)") + template(v-if="isRealInstance(userDialog.$location.tag)") el-tooltip(placement="top" content="Launch/Invite" :disabled="hideTooltips") - launch(:location="userDialog.ref.$location.tag" style="margin-left:5px") + launch(:location="userDialog.$location.tag" style="margin-left:5px") el-tooltip(placement="top" content="Invite yourself" :disabled="hideTooltips") - invite-yourself(:location="userDialog.ref.$location.tag" style="margin-left:5px") + invite-yourself(:location="userDialog.$location.tag" style="margin-left:5px") el-tooltip(placement="top" content="Refresh player count" :disabled="hideTooltips") - el-button(v-if="userDialog.ref.$location.tag !== lastLocation.location" @click="refreshInstancePlayerCount(userDialog.ref.$location.tag)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle) + el-button(v-if="userDialog.$location.tag !== lastLocation.location" @click="refreshInstancePlayerCount(userDialog.$location.tag)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle) span(v-if="userDialog.instance.occupants" style="margin-left:5px") {{ userDialog.instance.occupants }} #[template(v-if="userDialog.instance.friendCount > 0") ({{ userDialog.instance.friendCount }})] .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")