rewrite web request logging function

This commit is contained in:
pa
2026-03-10 23:33:15 +09:00
parent 1c9e4621f5
commit 0234abcca3
7 changed files with 83 additions and 39 deletions

View File

@@ -13,7 +13,7 @@ import {
storeAvatarImage
} from '../shared/utils';
import { avatarRequest, miscRequest, queryRequest } from '../api';
import { AppDebug } from '../services/appConfig';
import { logWebRequest } from '../services/appConfig';
import { database } from '../services/database';
import { patchAvatarFromEvent } from '../queries';
import { processBulk } from '../services/request';
@@ -295,9 +295,7 @@ export async function lookupAvatars(type, search) {
}
});
const json = JSON.parse(response.data);
if (AppDebug.debugWebRequests) {
console.log(url, json, response);
}
logWebRequest('[EXTERNAL GET]', url, `(${response.status})`, json);
if (response.status === 200 && typeof json === 'object') {
json.forEach((avatar) => {
if (!avatars.has(avatar.Id)) {
@@ -386,9 +384,7 @@ async function lookupAvatarByFileId(providerUrl, fileId) {
}
});
const json = JSON.parse(response.data);
if (AppDebug.debugWebRequests) {
console.log(url, json, response);
}
logWebRequest('[EXTERNAL GET]', url, `(${response.status})`, json);
if (response.status === 200 && typeof json === 'object') {
const ref = {
authorId: '',
@@ -436,9 +432,7 @@ async function lookupAvatarsByAuthor(providerUrl, authorId) {
}
});
const json = JSON.parse(response.data);
if (AppDebug.debugWebRequests) {
console.log(url, json, response);
}
logWebRequest('[EXTERNAL GET]', url, `(${response.status})`, json);
if (response.status === 200 && typeof json === 'object') {
json.forEach((avatar) => {
const ref = {

View File

@@ -12,7 +12,7 @@ import {
replaceBioSymbols
} from '../shared/utils';
import { i18n } from '../plugins/i18n';
import { AppDebug } from '../services/appConfig';
import { AppDebug, logWebRequest } from '../services/appConfig';
import { database } from '../services/database';
import {
runLastLocationResetFlow,
@@ -334,9 +334,7 @@ export function addGameLogEntry(gameLog, location) {
vrcxStore.processScreenshot(gameLog.screenshotPath);
break;
case 'api-request':
if (AppDebug.debugWebRequests) {
console.log('API Request:', gameLog.url);
}
logWebRequest('[GAMELOG API]', gameLog.url);
if (advancedSettingsStore.saveInstanceEmoji) {
const inv = parseInventoryFromUrl(gameLog.url);
if (inv) {