diff --git a/html/src/app.js b/html/src/app.js
index e7718445..efa4233d 100644
--- a/html/src/app.js
+++ b/html/src/app.js
@@ -66,25 +66,10 @@ speechSynthesis.getVoices();
configRepository.setBool('migrate_config_20201101', true);
}
- var showConsoleWarningMessage = function () {
- if ($app.debug || $app.debugWebRequests || $app.debugWebSocket) {
- return;
- }
- console.log(
- '%cCareful! This might not do what you think.',
- 'background-color: red; color: yellow; font-size: 32px; font-weight: bold'
- );
- console.log(
- '%cIf someone told you to copy-paste something here, it can give them access to your account.',
- 'font-size: 20px;'
- );
- };
-
document.addEventListener('keyup', function (e) {
if (e.ctrlKey) {
if (e.key === 'I') {
- AppApi.ShowDevTools();
- showConsoleWarningMessage();
+ $app.showConsole();
} else if (e.key === 'r') {
location.reload();
}
@@ -4212,7 +4197,7 @@ speechSynthesis.getVoices();
}
return 0;
});
- wristFeed.splice(20);
+ wristFeed.splice(15);
AppApi.ExecuteVrFeedFunction(
'wristFeedUpdate',
JSON.stringify(wristFeed)
@@ -7182,17 +7167,20 @@ speechSynthesis.getVoices();
$app.methods.sweepFeed = function () {
var {data} = this.feedTable;
- // 로그는 3일까지만 남김
- var limit = new Date(Date.now() - 3 * 24 * 60 * 60 * 1000).toJSON();
- var i = 0;
var j = data.length;
- while (i < j && data[i].created_at < limit) {
- ++i;
- }
- if (i === j) {
- this.feedTable.data = [];
- } else if (i) {
- data.splice(0, i);
+ if (j > 5000) {
+ data.splice(0, j - 5000);
+ } else {
+ var limit = new Date(Date.now() - 3 * 24 * 60 * 60 * 1000).toJSON();
+ var i = 0;
+ while (i < j && data[i].created_at < limit) {
+ ++i;
+ }
+ if (i === j) {
+ this.feedTable.data = [];
+ } else if (i) {
+ data.splice(0, i);
+ }
}
};
@@ -7379,17 +7367,20 @@ speechSynthesis.getVoices();
$app.methods.sweepGameLog = function () {
var {data} = this.gameLogTable;
- // 로그는 7일까지만 남김
- var limit = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toJSON();
- var i = 0;
var j = data.length;
- while (i < j && data[i].created_at < limit) {
- ++i;
- }
- if (i === j) {
- this.gameLogTable.data = [];
- } else if (i) {
- data.splice(0, i);
+ if (j > 5000) {
+ data.splice(0, j - 5000);
+ } else {
+ var limit = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toJSON();
+ var i = 0;
+ while (i < j && data[i].created_at < limit) {
+ ++i;
+ }
+ if (i === j) {
+ this.gameLogTable.data = [];
+ } else if (i) {
+ data.splice(0, i);
+ }
}
};
@@ -15582,6 +15573,44 @@ speechSynthesis.getVoices();
return user.currentAvatarImageUrl;
};
+ $app.methods.showConsole = function () {
+ AppApi.ShowDevTools();
+ if (this.debug || this.debugWebRequests || this.debugWebSocket) {
+ return;
+ }
+ console.log(
+ '%cCareful! This might not do what you think.',
+ 'background-color: red; color: yellow; font-size: 32px; font-weight: bold'
+ );
+ console.log(
+ '%cIf someone told you to copy-paste something here, it can give them access to your account.',
+ 'font-size: 20px;'
+ );
+ };
+
+ $app.methods.clearVRCXCache = function () {
+ API.cachedUsers.forEach((value, key) => {
+ if (!this.friends.has(key) && !this.lastLocation.playerList.has(value.displayName) && key !== API.currentUser.id) {
+ API.cachedUsers.delete(key);
+ console.log(key);
+ }
+ });
+ API.cachedWorlds.forEach((value, key) => {
+ if (!API.cachedFavoritesByObjectId.has(key) && value.authorId !== API.currentUser.id) {
+ API.cachedWorlds.delete(key);
+ console.log(key);
+ }
+ });
+ API.cachedAvatars.forEach((value, key) => {
+ if (!API.cachedFavoritesByObjectId.has(key) && value.authorId !== API.currentUser.id) {
+ API.cachedAvatars.delete(key);
+ console.log(key);
+ }
+ });
+
+ API.cachedAvatarNames = new Map();
+ };
+
$app.methods.ipcEvent = function (json) {
try {
var data = JSON.parse(json);
diff --git a/html/src/index.pug b/html/src/index.pug
index 8db7399b..229d44a2 100644
--- a/html/src/index.pug
+++ b/html/src/index.pug
@@ -938,6 +938,20 @@ html
el-switch(v-model="youTubeApi" @change="changeYouTubeApi")
div.options-container-item
el-button(size="small" icon="el-icon-caret-right" @click="showYouTubeApiDialog") YouTube API Key
+ div.options-container
+ span.header VRCX Cache/Debug
+ div.options-container-item
+ span.name User cache: #[span(v-text="API.cachedUsers.size")]
+ div.options-container-item
+ span.name World cache: #[span(v-text="API.cachedWorlds.size")]
+ div.options-container-item
+ span.name Avatar cache: #[span(v-text="API.cachedAvatars.size")]
+ div.options-container-item
+ span.name Avatar Name cache: #[span(v-text="API.cachedAvatarNames.size")]
+ div.options-container-item
+ el-button(size="small" icon="el-icon-delete-solid" @click="clearVRCXCache") Clear Cache
+ div.options-container-item
+ el-button(size="small" icon="el-icon-tickets" @click="showConsole") Show Console
div.options-container(style="margin-top:45px;border-top:1px solid #eee;padding-top:30px")
span.header Legal Notice
div.options-container-item
diff --git a/html/src/repository/database.js b/html/src/repository/database.js
index b145567e..dacfbb40 100644
--- a/html/src/repository/database.js
+++ b/html/src/repository/database.js
@@ -65,7 +65,7 @@ class Database {
time: dbRow[7]
};
feedDatabase.unshift(row);
- }, `SELECT * FROM ${Database.userId}_feed_gps WHERE created_at >= date('${dateOffset}')`);
+ }, `SELECT * FROM ${Database.userId}_feed_gps WHERE created_at >= date('${dateOffset}') LIMIT 5000`);
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
@@ -79,7 +79,7 @@ class Database {
previousStatusDescription: dbRow[7]
};
feedDatabase.unshift(row);
- }, `SELECT * FROM ${Database.userId}_feed_status WHERE created_at >= date('${dateOffset}')`);
+ }, `SELECT * FROM ${Database.userId}_feed_status WHERE created_at >= date('${dateOffset}') LIMIT 5000`);
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
@@ -95,7 +95,7 @@ class Database {
previousCurrentAvatarThumbnailImageUrl: dbRow[9]
};
feedDatabase.unshift(row);
- }, `SELECT * FROM ${Database.userId}_feed_avatar WHERE created_at >= date('${dateOffset}')`);
+ }, `SELECT * FROM ${Database.userId}_feed_avatar WHERE created_at >= date('${dateOffset}') LIMIT 5000`);
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
@@ -108,7 +108,7 @@ class Database {
time: dbRow[7]
};
feedDatabase.unshift(row);
- }, `SELECT * FROM ${Database.userId}_feed_online_offline WHERE created_at >= date('${dateOffset}')`);
+ }, `SELECT * FROM ${Database.userId}_feed_online_offline WHERE created_at >= date('${dateOffset}') LIMIT 5000`);
var compareByCreatedAt = function (a, b) {
var A = a.created_at;
var B = b.created_at;
@@ -121,6 +121,7 @@ class Database {
return 0;
};
feedDatabase.sort(compareByCreatedAt);
+ feedDatabase.splice(0, feedDatabase.length - 5000);
return feedDatabase;
}
@@ -237,7 +238,7 @@ class Database {
row.previousTrustLevel = dbRow[7];
}
friendLogHistory.unshift(row);
- }, `SELECT * FROM ${Database.userId}_friend_log_history`);
+ }, `SELECT * FROM ${Database.userId}_friend_log_history LIMIT 10000`);
return friendLogHistory;
}
@@ -387,7 +388,7 @@ class Database {
time: dbRow[5]
};
gamelogDatabase.unshift(row);
- }, `SELECT * FROM gamelog_location WHERE created_at >= date('${dateOffset}')`);
+ }, `SELECT * FROM gamelog_location WHERE created_at >= date('${dateOffset}') LIMIT 5000`);
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
@@ -399,7 +400,7 @@ class Database {
time: dbRow[6]
};
gamelogDatabase.unshift(row);
- }, `SELECT * FROM gamelog_join_leave WHERE created_at >= date('${dateOffset}')`);
+ }, `SELECT * FROM gamelog_join_leave WHERE created_at >= date('${dateOffset}') LIMIT 5000`);
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
@@ -412,7 +413,7 @@ class Database {
worldName: dbRow[6]
};
gamelogDatabase.unshift(row);
- }, `SELECT * FROM gamelog_portal_spawn WHERE created_at >= date('${dateOffset}')`);
+ }, `SELECT * FROM gamelog_portal_spawn WHERE created_at >= date('${dateOffset}') LIMIT 5000`);
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
@@ -426,7 +427,7 @@ class Database {
userId: dbRow[7]
};
gamelogDatabase.unshift(row);
- }, `SELECT * FROM gamelog_video_play WHERE created_at >= date('${dateOffset}')`);
+ }, `SELECT * FROM gamelog_video_play WHERE created_at >= date('${dateOffset}') LIMIT 5000`);
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
@@ -435,7 +436,7 @@ class Database {
data: dbRow[2]
};
gamelogDatabase.unshift(row);
- }, `SELECT * FROM gamelog_event WHERE created_at >= date('${dateOffset}')`);
+ }, `SELECT * FROM gamelog_event WHERE created_at >= date('${dateOffset}') LIMIT 5000`);
var compareByCreatedAt = function (a, b) {
var A = a.created_at;
var B = b.created_at;
@@ -447,6 +448,7 @@ class Database {
}
return 0;
};
+ gamelogDatabase.splice(0, gamelogDatabase.length - 5000);
gamelogDatabase.sort(compareByCreatedAt);
return gamelogDatabase;
}