small changes for resource loading logging

This commit is contained in:
Natsumi
2023-03-25 03:57:33 +13:00
parent 3f0a479e1a
commit 4d97dcb798
5 changed files with 45 additions and 19 deletions

View File

@@ -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;
}

View File

@@ -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',

View File

@@ -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') }}

View File

@@ -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);

View File

@@ -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':