This commit is contained in:
Natsumi
2022-08-10 18:23:23 +12:00
parent 87e3b0a923
commit ca514ead77
3 changed files with 28 additions and 22 deletions

View File

@@ -349,12 +349,12 @@ namespace VRCX
// 2021.09.02 00:02:12 Log - [Behaviour] Destination set: wrld_4432ea9b-729c-46e3-8eaf-846aa0a37fdd:15609~private(usr_032383a7-748c-4fb2-94e4-bcb928e5de6b)~nonce(72CC87D420C1D49AEFFBEE8824C84B2DF0E38678E840661E) // 2021.09.02 00:02:12 Log - [Behaviour] Destination set: wrld_4432ea9b-729c-46e3-8eaf-846aa0a37fdd:15609~private(usr_032383a7-748c-4fb2-94e4-bcb928e5de6b)~nonce(72CC87D420C1D49AEFFBEE8824C84B2DF0E38678E840661E)
// 2021.09.02 00:49:15 Log - [Behaviour] Destination fetching: wrld_4432ea9b-729c-46e3-8eaf-846aa0a37fdd // 2021.09.02 00:49:15 Log - [Behaviour] Destination fetching: wrld_4432ea9b-729c-46e3-8eaf-846aa0a37fdd
if (line.Contains("[Behaviour] Destination fetching: ")) if (line.Contains("[Behaviour] Destination set: "))
{ {
var lineOffset = line.LastIndexOf("] Destination fetching: "); var lineOffset = line.LastIndexOf("] Destination set: ");
if (lineOffset < 0) if (lineOffset < 0)
return true; return true;
lineOffset += 24; lineOffset += 19;
if (lineOffset >= line.Length) if (lineOffset >= line.Length)
return true; return true;

View File

@@ -6471,9 +6471,6 @@ speechSynthesis.getVoices();
}); });
API.$on('FRIEND:STATE', function (args) { API.$on('FRIEND:STATE', function (args) {
if (args.json.state === 'online') {
$app.APILastOnline.set(args.params.userId, Date.now());
}
$app.updateFriend(args.params.userId, args.json.state); $app.updateFriend(args.params.userId, args.json.state);
}); });
@@ -6604,14 +6601,19 @@ speechSynthesis.getVoices();
if (typeof ctx === 'undefined') { if (typeof ctx === 'undefined') {
return; return;
} }
if (this.updateFriendInProgress.has(id)) { var lastOnlineDate = this.APILastOnline.get(id);
var date = this.updateFriendInProgress.get(id); if (
if (date + 10000 >= Date.now()) { stateInput &&
// wait for 10 seconds ctx.state !== stateInput &&
return; lastOnlineDate &&
} lastOnlineDate > Date.now() - 100
) {
// crappy double online fix
return;
}
if (stateInput === 'online') {
this.APILastOnline.set(id, Date.now());
} }
this.updateFriendInProgress.set(id, Date.now());
var ref = API.cachedUsers.get(id); var ref = API.cachedUsers.get(id);
var isVIP = API.cachedFavoritesByObjectId.has(id); var isVIP = API.cachedFavoritesByObjectId.has(id);
if (typeof stateInput === 'undefined' || ctx.state === stateInput) { if (typeof stateInput === 'undefined' || ctx.state === stateInput) {
@@ -6704,16 +6706,20 @@ speechSynthesis.getVoices();
ctx.state === 'online' && ctx.state === 'online' &&
(stateInput === 'active' || stateInput === 'offline') (stateInput === 'active' || stateInput === 'offline')
) { ) {
// wait 1minute then check if user came back online // check if already waiting
var date = this.updateFriendInProgress.get(id);
if (date && date > Date.now() - 110000) {
return;
}
this.updateFriendInProgress.set(id, Date.now());
// wait 2minutes then check if user came back online
await new Promise((resolve) => { await new Promise((resolve) => {
setTimeout(resolve, 50000); setTimeout(resolve, 110000);
}); });
if (this.APILastOnline.has(id)) { var date1 = this.APILastOnline.get(id);
var date = this.APILastOnline.get(id); if (date1 && date1 > Date.now() - 120000) {
if (date > Date.now() - 60000) { this.updateFriendInProgress.delete(id);
this.updateFriendInProgress.delete(id); return;
return;
}
} }
} }
try { try {

View File

@@ -1333,7 +1333,7 @@ html
location.extra(:location="item.ref.location" :traveling="item.ref.travelingToLocation" :link="false") location.extra(:location="item.ref.location" :traveling="item.ref.travelingToLocation" :link="false")
img.avatar(v-lazy="userImage(item.ref)") img.avatar(v-lazy="userImage(item.ref)")
span(v-else) Search More: #[span(v-text="item.label" style="font-weight:bold")] span(v-else) Search More: #[span(v-text="item.label" style="font-weight:bold")]
el-tooltip(placement="bottom" content="Direct access ID/URL" :disabled="hideTooltips") el-tooltip(placement="bottom" content="Direct access ID/URL from clipboard" :disabled="hideTooltips")
el-button(type="default" @click="directAccessPaste" size="mini" icon="el-icon-discover" circle) el-button(type="default" @click="directAccessPaste" size="mini" icon="el-icon-discover" circle)
el-tooltip(placement="bottom" content="Refresh friends" :disabled="hideTooltips") el-tooltip(placement="bottom" content="Refresh friends" :disabled="hideTooltips")
el-button(type="default" @click="API.closeWebSocket(); API.getCurrentUser(); API.refreshFriends()" :loading="API.isRefreshFriendsLoading" size="mini" icon="el-icon-refresh" circle style="margin-right:10px") el-button(type="default" @click="API.closeWebSocket(); API.getCurrentUser(); API.refreshFriends()" :loading="API.isRefreshFriendsLoading" size="mini" icon="el-icon-refresh" circle style="margin-right:10px")