diff --git a/LogWatcher.cs b/LogWatcher.cs index 9a929e34..10fa67eb 100644 --- a/LogWatcher.cs +++ b/LogWatcher.cs @@ -211,6 +211,7 @@ namespace VRCX { if (ParseLogOnPlayerJoinedOrLeft(fileInfo, logContext, line, offset) == true || ParseLogLocation(fileInfo, logContext, line, offset) == true || + ParseLogLocationDestination(fileInfo, logContext, line, offset) == true || ParseLogPortalSpawn(fileInfo, logContext, line, offset) == true || ParseLogNotification(fileInfo, logContext, line, offset) == true || ParseLogJoinBlocked(fileInfo, logContext, line, offset) == true || @@ -313,6 +314,29 @@ namespace VRCX return false; } + private bool ParseLogLocationDestination(FileInfo fileInfo, LogContext logContext, string line, int offset) + { + // 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 + + if (string.Compare(line, offset, "[Behaviour] Destination fetching: ", 0, 34, StringComparison.Ordinal) == 0) + { + var location = line.Substring(offset + 34); + + AppendLog(new[] + { + fileInfo.Name, + ConvertLogTimeToISO8601(line), + "location-destination", + location + }); + + return true; + } + + return false; + } + private bool ParseLogOnPlayerJoinedOrLeft(FileInfo fileInfo, LogContext logContext, string line, int offset) { // 2020.10.31 23:36:58 Log - [NetworkManager] OnPlayerJoined pypy diff --git a/html/src/app.js b/html/src/app.js index 958f41ac..696019a6 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -4014,22 +4014,18 @@ speechSynthesis.getVoices(); $app.data.sharedFeed = { gameLog: { wrist: [], - noty: [], lastEntryDate: '' }, feedTable: { wrist: [], - noty: [], lastEntryDate: '' }, notificationTable: { wrist: [], - noty: [], lastEntryDate: '' }, friendLogTable: { wrist: [], - noty: [], lastEntryDate: '' }, pendingUpdate: false @@ -4054,13 +4050,6 @@ speechSynthesis.getVoices(); feeds.notificationTable.wrist, feeds.friendLogTable.wrist ); - var notyFeed = []; - notyFeed = notyFeed.concat( - feeds.gameLog.noty, - feeds.feedTable.noty, - feeds.notificationTable.noty, - feeds.friendLogTable.noty - ); // OnPlayerJoining var L = API.parseLocation(this.lastLocation.location); // WebSocket dosen't update friend only instances var locationBias = Date.now() - 30000; // 30 seconds @@ -4103,9 +4092,6 @@ speechSynthesis.getVoices(); var gameLogTable = this.gameLogTable.data; for (var k = gameLogTable.length - 1; k > -1; k--) { var gameLogItem = gameLogTable[k]; - if (gameLogItem.type === 'Notification') { - continue; - } if ( gameLogItem.type === 'Location' || gameLogItem.created_at < bias @@ -4140,15 +4126,7 @@ speechSynthesis.getVoices(); ) { wristFeed.unshift(onPlayerJoining); } - if ( - this.sharedFeedFilters.noty.OnPlayerJoining === - 'Friends' || - (this.sharedFeedFilters.noty.OnPlayerJoining === - 'VIP' && - isFavorite) - ) { - notyFeed.unshift(onPlayerJoining); - } + this.queueFeedNoty(onPlayerJoining); } } } @@ -4163,16 +4141,6 @@ speechSynthesis.getVoices(); return 0; }); wristFeed.splice(20); - notyFeed.sort(function (a, b) { - if (a.created_at < b.created_at) { - return 1; - } - if (a.created_at > b.created_at) { - return -1; - } - return 0; - }); - notyFeed.splice(5); AppApi.ExecuteVrFeedFunction( 'wristFeedUpdate', JSON.stringify(wristFeed) @@ -4183,8 +4151,6 @@ speechSynthesis.getVoices(); if (this.worldDialog.visible) { this.applyWorldDialogInstances(); } - this.getCurrentInstanceUserList(); - this.playNoty(notyFeed); feeds.pendingUpdate = false; }; @@ -4206,13 +4172,10 @@ speechSynthesis.getVoices(); } var bias = new Date(Date.now() - 86400000).toJSON(); // 24 hours var wristArr = []; - var notyArr = []; var w = 0; - var n = 0; var wristFilter = this.sharedFeedFilters.wrist; - var notyFilter = this.sharedFeedFilters.noty; - var currentUserJoinTime = ''; - var currentUserLeaveTime = ''; + var currentUserLeaveTime = 0; + var locationJoinTime = 0; for (var i = data.length - 1; i > -1; i--) { var ctx = data[i]; if (ctx.created_at < bias) { @@ -4222,69 +4185,36 @@ speechSynthesis.getVoices(); continue; } // on Location change remove OnPlayerLeft - if (ctx.type === 'OnPlayerLeft') { - if (ctx.created_at.slice(0, -4) === currentUserLeaveTime) { - continue; - } - if (ctx.displayName === API.currentUser.displayName) { - var {created_at} = ctx; - currentUserLeaveTime = created_at.slice(0, -4); - for (var k = w - 1; k > -1; k--) { - var feedItem = wristArr[k]; - if ( - feedItem.created_at.slice(0, -4) === - currentUserLeaveTime && - feedItem.type === 'OnPlayerLeft' - ) { - wristArr.splice(k, 1); - w--; - } + if (ctx.type === 'LocationDestination') { + currentUserLeaveTime = Date.parse(ctx.created_at); + for (var k = w - 1; k > -1; k--) { + var feedItem = wristArr[k]; + if ( + feedItem.type === 'OnPlayerLeft' && + Date.parse(feedItem.created_at) >= + currentUserLeaveTime && + Date.parse(feedItem.created_at) <= + currentUserLeaveTime + 5 * 1000 + ) { + wristArr.splice(k, 1); + w--; } - for (var k = n - 1; k > -1; k--) { - var feedItem = notyArr[k]; - if ( - feedItem.created_at.slice(0, -4) === - currentUserLeaveTime && - feedItem.type === 'OnPlayerLeft' - ) { - notyArr.splice(k, 1); - n--; - } - } - continue; } } // on Location change remove OnPlayerJoined - if (ctx.type === 'OnPlayerJoined') { - if (ctx.created_at.slice(0, -4) === currentUserJoinTime) { - continue; - } - if (ctx.displayName === API.currentUser.displayName) { - var {created_at} = ctx; - currentUserJoinTime = created_at.slice(0, -4); - for (var k = w - 1; k > -1; k--) { - var feedItem = wristArr[k]; - if ( - feedItem.created_at.slice(0, -4) === - currentUserJoinTime && - feedItem.type === 'OnPlayerJoined' - ) { - wristArr.splice(k, 1); - w--; - } + if (ctx.type === 'Location') { + locationJoinTime = Date.parse(ctx.created_at); + for (var k = w - 1; k > -1; k--) { + var feedItem = wristArr[k]; + if ( + feedItem.type === 'OnPlayerJoined' && + Date.parse(feedItem.created_at) >= locationJoinTime && + Date.parse(feedItem.created_at) <= + locationJoinTime + 20 * 1000 + ) { + wristArr.splice(k, 1); + w--; } - for (var k = n - 1; k > -1; k--) { - var feedItem = notyArr[k]; - if ( - feedItem.created_at.slice(0, -4) === - currentUserJoinTime && - feedItem.type === 'OnPlayerJoined' - ) { - notyArr.splice(k, 1); - n--; - } - } - continue; } } // remove current user @@ -4298,24 +4228,15 @@ speechSynthesis.getVoices(); } var isFriend = false; var isFavorite = false; - if ( - ctx.type === 'OnPlayerJoined' || - ctx.type === 'OnPlayerLeft' || - ctx.type === 'PortalSpawn' || - ctx.type === 'AvatarChange' - ) { - if (ctx.userId) { - isFriend = this.friends.has(ctx.userId); - isFavorite = API.cachedFavoritesByObjectId.has(ctx.userId); - } else { - for (var ref of API.cachedUsers.values()) { - if (ref.displayName === ctx.displayName) { - isFriend = this.friends.has(ref.id); - isFavorite = API.cachedFavoritesByObjectId.has( - ref.id - ); - break; - } + if (ctx.userId) { + isFriend = this.friends.has(ctx.userId); + isFavorite = API.cachedFavoritesByObjectId.has(ctx.userId); + } else if (ctx.displayName) { + for (var ref of API.cachedUsers.values()) { + if (ref.displayName === ctx.displayName) { + isFriend = this.friends.has(ref.id); + isFavorite = API.cachedFavoritesByObjectId.has(ref.id); + break; } } } @@ -4330,55 +4251,23 @@ speechSynthesis.getVoices(); } else { continue; } - var displayName = ref.targetDisplayName; - var userId = ref.targetUserId; - var created_at = ctx.created_at; + var entry = { + created_at: ctx.created_at, + type, + displayName: ref.targetDisplayName, + userId: ref.targetUserId, + isFriend, + isFavorite + }; if ( wristFilter[type] && (wristFilter[type] === 'Everyone' || (wristFilter[type] === 'Friends' && isFriend) || (wristFilter[type] === 'VIP' && isFavorite)) ) { - wristArr.unshift({ - created_at, - type, - displayName, - userId, - isFriend, - isFavorite - }); - } - if ( - notyFilter[type] && - (notyFilter[type] === 'Everyone' || - (notyFilter[type] === 'Friends' && isFriend) || - (notyFilter[type] === 'VIP' && isFavorite)) - ) { - notyArr.unshift({ - created_at, - type, - displayName, - userId, - isFriend, - isFavorite - }); - } - } - } - } - if (ctx.type === 'VideoPlay' && ctx.displayName) { - if (ctx.userId) { - isFriend = this.friends.has(ctx.userId); - isFavorite = API.cachedFavoritesByObjectId.has(ctx.userId); - } else { - for (var ref of API.cachedUsers.values()) { - if (ref.displayName === ctx.displayName) { - isFriend = this.friends.has(ref.id); - isFavorite = API.cachedFavoritesByObjectId.has( - ref.id - ); - break; + wristArr.unshift(entry); } + this.queueFeedNoty(entry); } } } @@ -4397,27 +4286,61 @@ speechSynthesis.getVoices(); }); ++w; } - if ( - n < 5 && - notyFilter[ctx.type] && - (notyFilter[ctx.type] === 'On' || - notyFilter[ctx.type] === 'Everyone' || - (notyFilter[ctx.type] === 'Friends' && isFriend) || - (notyFilter[ctx.type] === 'VIP' && isFavorite)) - ) { - notyArr.push({ - ...ctx, - isFriend, - isFavorite - }); - ++n; - } } this.sharedFeed.gameLog.wrist = wristArr; - this.sharedFeed.gameLog.noty = notyArr; this.sharedFeed.pendingUpdate = true; }; + $app.methods.queueGameLogNoty = function (noty) { + // remove join/leave notifications when switching worlds + if (noty.type === 'OnPlayerJoined') { + var bias = this.lastLocation.date + 30 * 1000; // 30 secs + if (Date.parse(noty.created_at) <= bias) { + return; + } + } + if (noty.type === 'OnPlayerLeft') { + var bias = this.lastLocationDestinationTime + 5 * 1000; // 5 secs + if (Date.parse(noty.created_at) <= bias) { + return; + } + } + if (noty.type === 'Notification' || noty.type === 'LocationDestination') { + return; + } + // remove current user + if ( + noty.type !== 'VideoPlay' && + noty.displayName === API.currentUser.displayName + ) { + return; + } + noty.isFriend = false; + noty.isFavorite = false; + if (noty.userId) { + noty.isFriend = this.friends.has(noty.userId); + noty.isFavorite = API.cachedFavoritesByObjectId.has(noty.userId); + } else if (noty.displayName) { + for (var ref of API.cachedUsers.values()) { + if (ref.displayName === noty.displayName) { + noty.isFriend = this.friends.has(ref.id); + noty.isFavorite = API.cachedFavoritesByObjectId.has(ref.id); + break; + } + } + } + var notyFilter = this.sharedFeedFilters.noty; + if ( + notyFilter[noty.type] && + (notyFilter[noty.type] === 'On' || + notyFilter[noty.type] === 'Everyone' || + (notyFilter[noty.type] === 'Friends' && noty.isFriend) || + (notyFilter[noty.type] === 'VIP' && noty.isFavorite)) + ) { + this.playNoty(noty); + } + }; + $app.methods.updateSharedFeedFeedTable = function (forceUpdate) { // GPS, Online, Offline, Status, Avatar var {data} = this.feedTable; @@ -4436,11 +4359,8 @@ speechSynthesis.getVoices(); } var bias = new Date(Date.now() - 86400000).toJSON(); // 24 hours var wristArr = []; - var notyArr = []; var w = 0; - var n = 0; var wristFilter = this.sharedFeedFilters.wrist; - var notyFilter = this.sharedFeedFilters.noty; for (var i = data.length - 1; i > -1; i--) { var ctx = data[i]; if (ctx.created_at < bias) { @@ -4449,7 +4369,7 @@ speechSynthesis.getVoices(); if (ctx.type === 'Avatar') { continue; } - // hide private worlds from feeds + // hide private worlds from feed if ( this.hidePrivateFromFeed && ctx.type === 'GPS' && @@ -4472,25 +4392,35 @@ speechSynthesis.getVoices(); }); ++w; } - if ( - n < 5 && - notyFilter[ctx.type] && - (notyFilter[ctx.type] === 'Friends' || - (notyFilter[ctx.type] === 'VIP' && isFavorite)) - ) { - notyArr.push({ - ...ctx, - isFriend, - isFavorite - }); - ++n; - } } this.sharedFeed.feedTable.wrist = wristArr; - this.sharedFeed.feedTable.noty = notyArr; this.sharedFeed.pendingUpdate = true; }; + $app.methods.queueFeedNoty = function (noty) { + if (noty.type === 'Avatar') { + return; + } + // hide private worlds from feed + if ( + this.hidePrivateFromFeed && + noty.type === 'GPS' && + noty.location === 'private' + ) { + return; + } + noty.isFriend = this.friends.has(noty.userId); + noty.isFavorite = API.cachedFavoritesByObjectId.has(noty.userId); + var notyFilter = this.sharedFeedFilters.noty; + if ( + notyFilter[noty.type] && + (notyFilter[noty.type] === 'Friends' || + (notyFilter[noty.type] === 'VIP' && noty.isFavorite)) + ) { + this.playNoty(noty); + } + }; + $app.methods.updateSharedFeedNotificationTable = function (forceUpdate) { // invite, requestInvite, requestInviteResponse, inviteResponse, friendRequest var {data} = this.notificationTable; @@ -4510,11 +4440,8 @@ speechSynthesis.getVoices(); } var bias = new Date(Date.now() - 86400000).toJSON(); // 24 hours var wristArr = []; - var notyArr = []; var w = 0; - var n = 0; var wristFilter = this.sharedFeedFilters.wrist; - var notyFilter = this.sharedFeedFilters.noty; for (var i = data.length - 1; i > -1; i--) { var ctx = data[i]; if (ctx.created_at < bias) { @@ -4541,26 +4468,28 @@ speechSynthesis.getVoices(); }); ++w; } - if ( - n < 5 && - notyFilter[ctx.type] && - (notyFilter[ctx.type] === 'On' || - notyFilter[ctx.type] === 'Friends' || - (notyFilter[ctx.type] === 'VIP' && isFavorite)) - ) { - notyArr.push({ - ...ctx, - isFriend, - isFavorite - }); - ++n; - } } this.sharedFeed.notificationTable.wrist = wristArr; - this.sharedFeed.notificationTable.noty = notyArr; this.sharedFeed.pendingUpdate = true; }; + $app.methods.queueNotificationNoty = function (noty) { + if (noty.senderUserId === API.currentUser.id) { + return; + } + noty.isFriend = this.friends.has(noty.senderUserId); + noty.isFavorite = API.cachedFavoritesByObjectId.has(noty.senderUserId); + var notyFilter = this.sharedFeedFilters.noty; + if ( + notyFilter[noty.type] && + (notyFilter[noty.type] === 'On' || + notyFilter[noty.type] === 'Friends' || + (notyFilter[noty.type] === 'VIP' && noty.isFavorite)) + ) { + this.playNoty(noty); + } + }; + $app.methods.updateSharedFeedFriendLogTable = function (forceUpdate) { // TrustLevel, Friend, FriendRequest, Unfriend, DisplayName var {data} = this.friendLogTable; @@ -4580,11 +4509,8 @@ speechSynthesis.getVoices(); } var bias = new Date(Date.now() - 86400000).toJSON(); // 24 hours var wristArr = []; - var notyArr = []; var w = 0; - var n = 0; var wristFilter = this.sharedFeedFilters.wrist; - var notyFilter = this.sharedFeedFilters.noty; for (var i = data.length - 1; i > -1; i--) { var ctx = data[i]; if (ctx.created_at < bias) { @@ -4609,29 +4535,58 @@ speechSynthesis.getVoices(); }); ++w; } - if ( - n < 5 && - notyFilter[ctx.type] && - (notyFilter[ctx.type] === 'On' || - notyFilter[ctx.type] === 'Friends' || - (notyFilter[ctx.type] === 'VIP' && isFavorite)) - ) { - notyArr.push({ - ...ctx, - isFriend, - isFavorite - }); - ++n; - } } this.sharedFeed.friendLogTable.wrist = wristArr; - this.sharedFeed.friendLogTable.noty = notyArr; this.sharedFeed.pendingUpdate = true; }; + $app.methods.queueFriendLogNoty = function (noty) { + if (noty.type === 'FriendRequest') { + return; + } + noty.isFriend = this.friends.has(noty.userId); + noty.isFavorite = API.cachedFavoritesByObjectId.has(noty.userId); + var notyFilter = this.sharedFeedFilters.noty; + if ( + notyFilter[noty.type] && + (notyFilter[noty.type] === 'On' || + notyFilter[noty.type] === 'Friends' || + (notyFilter[noty.type] === 'VIP' && noty.isFavorite)) + ) { + this.playNoty(noty); + } + }; + $app.data.notyMap = []; - $app.methods.playNoty = function (notyFeed) { + $app.methods.playNoty = function (noty) { + if (API.currentUser.status === 'busy' || !this.friendLogInitStatus) { + return; + } + var displayName = ''; + if (noty.displayName) { + displayName = noty.displayName; + } else if (noty.senderUsername) { + displayName = noty.senderUsername; + } else if (noty.sourceDisplayName) { + displayName = noty.sourceDisplayName; + } + if (displayName) { + // don't play noty twice + if ( + this.notyMap[displayName] && + this.notyMap[displayName] > noty.created_at + ) { + return; + } + this.notyMap[displayName] = noty.created_at; + } + var bias = new Date(Date.now() - 60000).toJSON(); + if (noty.created_at < bias) { + // don't play noty if it's over 1min old + return; + } + var playNotificationTTS = false; if ( this.notificationTTS === 'Always' || @@ -4666,70 +4621,37 @@ speechSynthesis.getVoices(); ) { playOverlayNotification = true; } - if (API.currentUser.status === 'busy' || !this.notyInit) { - return; - } - var notyToPlay = []; - notyFeed.forEach((feed) => { - var displayName = ''; - if (feed.displayName) { - displayName = feed.displayName; - } else if (feed.senderUsername) { - displayName = feed.senderUsername; - } else if (feed.sourceDisplayName) { - displayName = feed.sourceDisplayName; - } else if (feed.data) { - displayName = feed.data; - } - if ( - (displayName && !this.notyMap[displayName]) || - this.notyMap[displayName] < feed.created_at - ) { - this.notyMap[displayName] = feed.created_at; - notyToPlay.push(feed); - } - }); - var bias = new Date(Date.now() - 60000).toJSON(); var messageList = [ 'inviteMessage', 'requestMessage', 'responseMessage' ]; - for (var i = 0; i < notyToPlay.length; i++) { - let noty = notyToPlay[i]; - if (noty.created_at < bias) { - continue; + let message = ''; + for (var k = 0; k < messageList.length; k++) { + if ( + typeof noty.details !== 'undefined' && + typeof noty.details[messageList[k]] !== 'undefined' + ) { + message = `, ${noty.details[messageList[k]]}`; } - let message = ''; - for (var k = 0; k < messageList.length; k++) { - if ( - typeof noty.details !== 'undefined' && - typeof noty.details[messageList[k]] !== 'undefined' - ) { - message = noty.details[messageList[k]]; + } + if (playNotificationTTS) { + this.playNotyTTS(noty, message); + } + if (playOverlayNotification) { + this.notyGetImage(noty).then((imageUrl) => { + this.displayOverlayNotification(noty, message, imageUrl); + }); + } + if (playDesktopToast || playXSNotification) { + this.notySaveImage(noty).then((image) => { + if (playXSNotification) { + this.displayXSNotification(noty, message, image); } - } - if (message) { - message = `, ${message}`; - } - if (playNotificationTTS) { - this.playNotyTTS(noty, message); - } - if (playOverlayNotification) { - this.notyGetImage(noty).then((imageUrl) => { - this.displayOverlayNotification(noty, message, imageUrl); - }); - } - if (playDesktopToast || playXSNotification) { - this.notySaveImage(noty).then((image) => { - if (playXSNotification) { - this.displayXSNotification(noty, message, image); - } - if (playDesktopToast) { - this.displayDesktopToast(noty, message, image); - } - }); - } + if (playDesktopToast) { + this.displayDesktopToast(noty, message, image); + } + }); } }; @@ -7078,6 +7000,7 @@ speechSynthesis.getVoices(); this.feedTable.data.push(feed); this.sweepFeed(); this.updateSharedFeed(false); + this.queueFeedNoty(feed); this.notifyMenu('feed'); }; @@ -7185,6 +7108,7 @@ speechSynthesis.getVoices(); playerList: new Map(), friendList: new Map() }; + this.updateVRLastLocation(); }; $app.data.lastLocation$ = {}; @@ -7220,7 +7144,7 @@ speechSynthesis.getVoices(); { prop: 'type', value: true, - filterFn: (row) => row.type !== 'Notification' + filterFn: (row) => row.type !== 'Notification' || row.type !== 'LocationDestination' } ], tableProps: { @@ -7304,11 +7228,9 @@ speechSynthesis.getVoices(); this.sweepGameLog(); }; - $app.methods.addGameLogEntry = function ( - gameLog, - location, - pushToTable - ) { + $app.lastLocationDestinationTime = 0; + + $app.methods.addGameLogEntry = function (gameLog, location, pushToTable) { var userId = ''; if (gameLog.userDisplayName) { for (var ref of API.cachedUsers.values()) { @@ -7319,6 +7241,17 @@ speechSynthesis.getVoices(); } } switch (gameLog.type) { + case 'location-destination': + if (this.isGameRunning) { + this.cancelVRChatCacheDownload(gameLog.location); + } + this.lastLocationDestinationTime = Date.parse(gameLog.dt); + var entry = { + created_at: gameLog.dt, + type: 'LocationDestination', + location: gameLog.location + }; + break; case 'location': if (this.isGameRunning) { this.lastLocationReset(); @@ -7330,7 +7263,7 @@ speechSynthesis.getVoices(); friendList: new Map() }; this.updateVRLastLocation(); - this.checkVRChatCacheDownload(this.lastLocation.location); + this.cancelVRChatCacheDownload(gameLog.location); } var L = API.parseLocation(gameLog.location); var entry = { @@ -7433,6 +7366,7 @@ speechSynthesis.getVoices(); break; } if (pushToTable && entry) { + this.queueGameLogNoty(entry); this.gameLogTable.data.push(entry); } }; @@ -8129,6 +8063,7 @@ speechSynthesis.getVoices(); }; this.friendLogTable.data.push(friendLogHistory); database.addFriendLogHistory(friendLogHistory); + this.queueFriendLogNoty(friendLogHistory); var friendLogCurrent = { userId: id, displayName: ctx.displayName, @@ -8153,6 +8088,7 @@ speechSynthesis.getVoices(); }; this.friendLogTable.data.push(friendLogHistory); database.addFriendLogHistory(friendLogHistory); + this.queueFriendLogNoty(friendLogHistory); this.friendLog.delete(id); database.deleteFriendLogCurrent(id); this.notifyMenu('friendLog'); @@ -8185,18 +8121,17 @@ speechSynthesis.getVoices(); displayName: ref.displayName, previousDisplayName: ctx.displayName }; - this.friendLogTable.data.push(friendLogHistory); - database.addFriendLogHistory(friendLogHistory); - } else if (ctx.displayName === null) { + } else { var friendLogHistory = { created_at: new Date().toJSON(), type: 'Friend', userId: ref.id, displayName: ref.displayName }; - this.friendLogTable.data.push(friendLogHistory); - database.addFriendLogHistory(friendLogHistory); } + this.friendLogTable.data.push(friendLogHistory); + database.addFriendLogHistory(friendLogHistory); + this.queueFriendLogNoty(friendLogHistory); var friendLogCurrent = { userId: ref.id, displayName: ref.displayName, @@ -8207,35 +8142,32 @@ speechSynthesis.getVoices(); ctx.displayName = ref.displayName; this.notifyMenu('friendLog'); } - if (ref.$trustLevel && ctx.trustLevel !== ref.$trustLevel) { - if ( - ctx.trustLevel && - ctx.trustLevel !== 'Legendary User' && - ctx.trustLevel !== 'VRChat Team' && - ctx.trustLevel !== 'Nuisance' - ) { - // TODO: remove - var friendLogHistory = { - created_at: new Date().toJSON(), - type: 'TrustLevel', - userId: ref.id, - displayName: ref.displayName, - trustLevel: ref.$trustLevel, - previousTrustLevel: ctx.trustLevel - }; - this.friendLogTable.data.push(friendLogHistory); - database.addFriendLogHistory(friendLogHistory); - var friendLogCurrent = { - userId: ref.id, - displayName: ref.displayName, - trustLevel: ref.$trustLevel - }; - this.friendLog.set(ref.id, friendLogCurrent); - database.setFriendLogCurrent(friendLogCurrent); - this.notifyMenu('friendLog'); - } - ctx.trustLevel = ref.$trustLevel; + if ( + ref.$trustLevel && + ctx.trustLevel && + ctx.trustLevel !== ref.$trustLevel + ) { + var friendLogHistory = { + created_at: new Date().toJSON(), + type: 'TrustLevel', + userId: ref.id, + displayName: ref.displayName, + trustLevel: ref.$trustLevel, + previousTrustLevel: ctx.trustLevel + }; + this.friendLogTable.data.push(friendLogHistory); + database.addFriendLogHistory(friendLogHistory); + this.queueFriendLogNoty(friendLogHistory); + var friendLogCurrent = { + userId: ref.id, + displayName: ref.displayName, + trustLevel: ref.$trustLevel + }; + this.friendLog.set(ref.id, friendLogCurrent); + database.setFriendLogCurrent(friendLogCurrent); + this.notifyMenu('friendLog'); } + ctx.trustLevel = ref.$trustLevel; }; $app.methods.deleteFriendLog = function (row) { @@ -8398,6 +8330,7 @@ speechSynthesis.getVoices(); $app.notifyMenu('notification'); $app.unseenNotifications.push(ref.id); } + $app.queueNotificationNoty(ref); } $app.updateSharedFeed(true); }); @@ -14070,12 +14003,13 @@ speechSynthesis.getVoices(); this.downloadVRChatCacheProgress(); }; - $app.methods.checkVRChatCacheDownload = function (lastLocation) { - var L = API.parseLocation(lastLocation); + $app.methods.cancelVRChatCacheDownload = function (location) { + var L = API.parseLocation(location); if (L.worldId) { if (this.downloadCurrent.id === L.worldId) { - this.cancelVRChatCacheDownload(L.worldId); - } else if (this.downloadQueue.has(L.worldId)) { + AssetBundleCacher.CancelDownload(); + } + if (this.downloadQueue.has(L.worldId)) { this.downloadQueue.delete(L.worldId); this.downloadQueueTable.data = Array.from( this.downloadQueue.values() @@ -14084,18 +14018,6 @@ speechSynthesis.getVoices(); } }; - $app.methods.cancelVRChatCacheDownload = function (worldId) { - if (this.downloadCurrent.id === worldId) { - AssetBundleCacher.CancelDownload(); - } - if (this.downloadQueue.has(worldId)) { - this.downloadQueue.delete(worldId); - this.downloadQueueTable.data = Array.from( - this.downloadQueue.values() - ); - } - }; - $app.methods.cancelAllVRChatCacheDownload = function () { if (typeof this.downloadCurrent.id !== 'undefined') { this.cancelVRChatCacheDownload(this.downloadCurrent.id); diff --git a/html/src/index.pug b/html/src/index.pug index 8bf3a478..f37ff754 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -1110,7 +1110,7 @@ html el-dropdown-item(v-else icon="el-icon-plus" command="Send Friend Request") Send Friend Request el-dropdown-item(icon="el-icon-s-custom" command="Show Avatar Author" divided) Show Avatar Author el-dropdown-item(icon="el-icon-s-custom" command="Show Fallback Avatar Details") Show Fallback Avatar Details - el-dropdown-item(v-if="userDialog.currentAvatarImageUrl !== 'https://assets.vrchat.com/system/defaultAvatar.png'" icon="el-icon-picture-outline" command="Previous Images") Show Avatar Previous Images + el-dropdown-item(v-if="userDialog.ref.currentAvatarImageUrl !== 'https://assets.vrchat.com/system/defaultAvatar.png'" icon="el-icon-picture-outline" command="Previous Images") Show Avatar Previous Images el-dropdown-item(v-if="userDialog.isBlock" icon="el-icon-circle-check" command="Unblock" divided style="color:#F56C6C") Unblock el-dropdown-item(v-else icon="el-icon-circle-close" command="Block" divided :disabled="userDialog.ref.$isModerator") Block el-dropdown-item(v-if="userDialog.isMute" icon="el-icon-microphone" command="Unmute" style="color:#F56C6C") Unmute