From 4d97dcb798fbf97f9f7830993a16bf60b70566cf Mon Sep 17 00:00:00 2001 From: Natsumi Date: Sat, 25 Mar 2023 03:57:33 +1300 Subject: [PATCH] small changes for resource loading logging --- LogWatcher.cs | 20 ++++++++++++++++---- html/src/app.js | 27 +++++++++++++++++++++------ html/src/index.pug | 1 + html/src/repository/database.js | 12 +++++------- html/src/service/gamelog.js | 4 ++-- 5 files changed, 45 insertions(+), 19 deletions(-) diff --git a/LogWatcher.cs b/LogWatcher.cs index e2ecafdb..e8e08516 100644 --- a/LogWatcher.cs +++ b/LogWatcher.cs @@ -933,7 +933,7 @@ namespace VRCX private bool ParseLogStringDownload(FileInfo fileInfo, LogContext logContext, string line, int offset) { // 2023.03.23 11:37:21 Log - [String Download] Attempting to load String from URL 'https://pastebin.com/raw/BaW6NL2L' - string check = "] Attempting to load String from URL '"; + var check = "] Attempting to load String from URL '"; if (!line.Contains(check)) return false; @@ -943,14 +943,20 @@ namespace VRCX var stringData = line.Substring(lineOffset + check.Length); stringData = stringData.Remove(stringData.Length - 1); - AppendLog(new[] { fileInfo.Name, ConvertLogTimeToISO8601(line), "resource-load", stringData, "string" }); + AppendLog(new[] + { + fileInfo.Name, + ConvertLogTimeToISO8601(line), + "resource-load-string", + stringData + }); return true; } private bool ParseLogImageDownload(FileInfo fileInfo, LogContext logContext, string line, int offset) { // 2023.03.23 11:32:25 Log - [Image Download] Attempting to load image from URL 'https://i.imgur.com/lCfUMX0.jpeg' - string check = "] Attempting to load image from URL '"; + var check = "] Attempting to load image from URL '"; if (!line.Contains(check)) return false; @@ -960,7 +966,13 @@ namespace VRCX var imageData = line.Substring(lineOffset + check.Length); imageData = imageData.Remove(imageData.Length - 1); - AppendLog(new[] { fileInfo.Name, ConvertLogTimeToISO8601(line), "resource-load", imageData, "image" }); + AppendLog(new[] + { + fileInfo.Name, + ConvertLogTimeToISO8601(line), + "resource-load-image", + imageData + }); return true; } diff --git a/html/src/app.js b/html/src/app.js index 67d5cee0..7602e9e8 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -4656,6 +4656,9 @@ speechSynthesis.getVoices(); var buildTreeData = (json) => { var node = []; for (var key in json) { + if (key[0] === '$') { + continue; + } var value = json[key]; if (Array.isArray(value) && value.length === 0) { node.push({ @@ -8977,6 +8980,7 @@ speechSynthesis.getVoices(); this.updateVRLastLocation(); this.getCurrentInstanceUserList(); this.lastVideoUrl = ''; + this.lastResourceloadUrl = ''; this.applyUserDialogLocation(); this.applyWorldDialogInstances(); this.applyGroupDialogInstances(); @@ -9209,6 +9213,7 @@ speechSynthesis.getVoices(); $app.data.lastLocationDestination = ''; $app.data.lastLocationDestinationTime = 0; $app.data.lastVideoUrl = ''; + $app.data.lastResourceloadUrl = ''; $app.methods.addGameLogEntry = function (gameLog, location) { if (this.gameLogDisabled) { @@ -9378,15 +9383,22 @@ speechSynthesis.getVoices(); this.nowPlaying.offset = parseInt(timestamp, 10); } break; - case 'resource-load': - if (!this.logResourceLoad) { + case 'resource-load-string': + case 'resource-load-image': + if ( + !this.logResourceLoad || + this.lastResourceloadUrl === gameLog.resourceUrl + ) { break; } + this.lastResourceloadUrl = gameLog.resourceUrl; var entry = { created_at: gameLog.dt, - type: gameLog.resourceType === 'string' ? 'StringLoad' : 'ImageLoad', + type: + gameLog.type === 'resource-load-string' + ? 'StringLoad' + : 'ImageLoad', resourceUrl: gameLog.resourceUrl, - resourceType: gameLog.resourceType, location }; database.addGamelogResourceLoadToDatabase(entry); @@ -13372,8 +13384,10 @@ speechSynthesis.getVoices(); AppApi.ExecuteVrOverlayFunction('updateHudTimeout', '[]'); } }; - $app.data.logResourceLoad = configRepository.getBool('VRCX_logResourceLoad', false); - $app.methods.saveGameLogOptions = function() { + $app.data.logResourceLoad = configRepository.getBool( + 'VRCX_logResourceLoad' + ); + $app.methods.saveGameLogOptions = function () { configRepository.setBool('VRCX_logResourceLoad', this.logResourceLoad); }; @@ -20754,6 +20768,7 @@ speechSynthesis.getVoices(); if (result || !this.isRealInstance(lastLocation)) { return; } + AppApi.FocusWindow(); var entry = { created_at: new Date().toJSON(), type: 'Event', diff --git a/html/src/index.pug b/html/src/index.pug index 00d1fba0..ef1176b9 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -1506,6 +1506,7 @@ html el-button(size="small" icon="el-icon-time" @click="promptPhotonLobbyTimeoutThreshold" :disabled="!openVR") {{ $t('view.settings.advanced.photon.timeout_hud.timeout_threshold') }} div.options-container span.header {{ $t('view.settings.advanced.advanced.cache_debug.header') }} + br span.sub-header {{ $t('view.settings.advanced.advanced.pending_offline.header') }} div.options-container-item span.name {{ $t('view.settings.advanced.advanced.pending_offline.description') }} diff --git a/html/src/repository/database.js b/html/src/repository/database.js index 788ed331..acdd4967 100644 --- a/html/src/repository/database.js +++ b/html/src/repository/database.js @@ -505,9 +505,8 @@ class Database { var row = { rowId: dbRow[0], created_at: dbRow[1], - type: dbRow[3] === 'string' ? 'StringLoad' : 'ImageLoad', + type: dbRow[3], resourceUrl: dbRow[2], - resourceType: dbRow[3], location: dbRow[4] }; gamelogDatabase.unshift(row); @@ -641,7 +640,7 @@ class Database { { '@created_at': entry.created_at, '@resource_url': entry.resourceUrl, - '@resource_type': entry.resourceType, + '@resource_type': entry.type, '@location': entry.location } ); @@ -1334,18 +1333,17 @@ class Database { var checkString = ''; var checkImage = ''; if (!resourceload_string) { - checkString = `AND resource_type != 'string'`; + checkString = `AND resource_type != 'StringLoad'`; } if (!resourceload_image) { - checkString = `AND resource_type != 'image'`; + checkString = `AND resource_type != 'ImageLoad'`; } await sqliteService.execute((dbRow) => { var row = { rowId: dbRow[0], created_at: dbRow[1], - type: dbRow[3] === 'string' ? 'StringLoad' : 'ImageLoad', + type: dbRow[3], resourceUrl: dbRow[2], - resourceType: dbRow[3], location: dbRow[4] }; gamelogDatabase.unshift(row); diff --git a/html/src/service/gamelog.js b/html/src/service/gamelog.js index b638079d..85b36eda 100644 --- a/html/src/service/gamelog.js +++ b/html/src/service/gamelog.js @@ -41,9 +41,9 @@ class GameLogService { gameLog.displayName = args[1]; break; - case 'resource-load': + case 'resource-load-string': + case 'resource-load-image': gameLog.resourceUrl = args[0]; - gameLog.resourceType = args[1]; break; case 'video-sync':