mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 06:46:04 +02:00
Feed limits and cache management
This commit is contained in:
+50
-21
@@ -66,25 +66,10 @@ speechSynthesis.getVoices();
|
|||||||
configRepository.setBool('migrate_config_20201101', true);
|
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) {
|
document.addEventListener('keyup', function (e) {
|
||||||
if (e.ctrlKey) {
|
if (e.ctrlKey) {
|
||||||
if (e.key === 'I') {
|
if (e.key === 'I') {
|
||||||
AppApi.ShowDevTools();
|
$app.showConsole();
|
||||||
showConsoleWarningMessage();
|
|
||||||
} else if (e.key === 'r') {
|
} else if (e.key === 'r') {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
@@ -4212,7 +4197,7 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
wristFeed.splice(20);
|
wristFeed.splice(15);
|
||||||
AppApi.ExecuteVrFeedFunction(
|
AppApi.ExecuteVrFeedFunction(
|
||||||
'wristFeedUpdate',
|
'wristFeedUpdate',
|
||||||
JSON.stringify(wristFeed)
|
JSON.stringify(wristFeed)
|
||||||
@@ -7182,10 +7167,12 @@ speechSynthesis.getVoices();
|
|||||||
|
|
||||||
$app.methods.sweepFeed = function () {
|
$app.methods.sweepFeed = function () {
|
||||||
var {data} = this.feedTable;
|
var {data} = this.feedTable;
|
||||||
// 로그는 3일까지만 남김
|
var j = data.length;
|
||||||
|
if (j > 5000) {
|
||||||
|
data.splice(0, j - 5000);
|
||||||
|
} else {
|
||||||
var limit = new Date(Date.now() - 3 * 24 * 60 * 60 * 1000).toJSON();
|
var limit = new Date(Date.now() - 3 * 24 * 60 * 60 * 1000).toJSON();
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var j = data.length;
|
|
||||||
while (i < j && data[i].created_at < limit) {
|
while (i < j && data[i].created_at < limit) {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@@ -7194,6 +7181,7 @@ speechSynthesis.getVoices();
|
|||||||
} else if (i) {
|
} else if (i) {
|
||||||
data.splice(0, i);
|
data.splice(0, i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// App: gameLog
|
// App: gameLog
|
||||||
@@ -7379,10 +7367,12 @@ speechSynthesis.getVoices();
|
|||||||
|
|
||||||
$app.methods.sweepGameLog = function () {
|
$app.methods.sweepGameLog = function () {
|
||||||
var {data} = this.gameLogTable;
|
var {data} = this.gameLogTable;
|
||||||
// 로그는 7일까지만 남김
|
var j = data.length;
|
||||||
|
if (j > 5000) {
|
||||||
|
data.splice(0, j - 5000);
|
||||||
|
} else {
|
||||||
var limit = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toJSON();
|
var limit = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toJSON();
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var j = data.length;
|
|
||||||
while (i < j && data[i].created_at < limit) {
|
while (i < j && data[i].created_at < limit) {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@@ -7391,6 +7381,7 @@ speechSynthesis.getVoices();
|
|||||||
} else if (i) {
|
} else if (i) {
|
||||||
data.splice(0, i);
|
data.splice(0, i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.refreshEntireGameLog = async function () {
|
$app.methods.refreshEntireGameLog = async function () {
|
||||||
@@ -15582,6 +15573,44 @@ speechSynthesis.getVoices();
|
|||||||
return user.currentAvatarImageUrl;
|
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) {
|
$app.methods.ipcEvent = function (json) {
|
||||||
try {
|
try {
|
||||||
var data = JSON.parse(json);
|
var data = JSON.parse(json);
|
||||||
|
|||||||
@@ -938,6 +938,20 @@ html
|
|||||||
el-switch(v-model="youTubeApi" @change="changeYouTubeApi")
|
el-switch(v-model="youTubeApi" @change="changeYouTubeApi")
|
||||||
div.options-container-item
|
div.options-container-item
|
||||||
el-button(size="small" icon="el-icon-caret-right" @click="showYouTubeApiDialog") YouTube API Key
|
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")
|
div.options-container(style="margin-top:45px;border-top:1px solid #eee;padding-top:30px")
|
||||||
span.header Legal Notice
|
span.header Legal Notice
|
||||||
div.options-container-item
|
div.options-container-item
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class Database {
|
|||||||
time: dbRow[7]
|
time: dbRow[7]
|
||||||
};
|
};
|
||||||
feedDatabase.unshift(row);
|
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) => {
|
await sqliteService.execute((dbRow) => {
|
||||||
var row = {
|
var row = {
|
||||||
rowId: dbRow[0],
|
rowId: dbRow[0],
|
||||||
@@ -79,7 +79,7 @@ class Database {
|
|||||||
previousStatusDescription: dbRow[7]
|
previousStatusDescription: dbRow[7]
|
||||||
};
|
};
|
||||||
feedDatabase.unshift(row);
|
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) => {
|
await sqliteService.execute((dbRow) => {
|
||||||
var row = {
|
var row = {
|
||||||
rowId: dbRow[0],
|
rowId: dbRow[0],
|
||||||
@@ -95,7 +95,7 @@ class Database {
|
|||||||
previousCurrentAvatarThumbnailImageUrl: dbRow[9]
|
previousCurrentAvatarThumbnailImageUrl: dbRow[9]
|
||||||
};
|
};
|
||||||
feedDatabase.unshift(row);
|
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) => {
|
await sqliteService.execute((dbRow) => {
|
||||||
var row = {
|
var row = {
|
||||||
rowId: dbRow[0],
|
rowId: dbRow[0],
|
||||||
@@ -108,7 +108,7 @@ class Database {
|
|||||||
time: dbRow[7]
|
time: dbRow[7]
|
||||||
};
|
};
|
||||||
feedDatabase.unshift(row);
|
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 compareByCreatedAt = function (a, b) {
|
||||||
var A = a.created_at;
|
var A = a.created_at;
|
||||||
var B = b.created_at;
|
var B = b.created_at;
|
||||||
@@ -121,6 +121,7 @@ class Database {
|
|||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
feedDatabase.sort(compareByCreatedAt);
|
feedDatabase.sort(compareByCreatedAt);
|
||||||
|
feedDatabase.splice(0, feedDatabase.length - 5000);
|
||||||
return feedDatabase;
|
return feedDatabase;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +238,7 @@ class Database {
|
|||||||
row.previousTrustLevel = dbRow[7];
|
row.previousTrustLevel = dbRow[7];
|
||||||
}
|
}
|
||||||
friendLogHistory.unshift(row);
|
friendLogHistory.unshift(row);
|
||||||
}, `SELECT * FROM ${Database.userId}_friend_log_history`);
|
}, `SELECT * FROM ${Database.userId}_friend_log_history LIMIT 10000`);
|
||||||
return friendLogHistory;
|
return friendLogHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +388,7 @@ class Database {
|
|||||||
time: dbRow[5]
|
time: dbRow[5]
|
||||||
};
|
};
|
||||||
gamelogDatabase.unshift(row);
|
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) => {
|
await sqliteService.execute((dbRow) => {
|
||||||
var row = {
|
var row = {
|
||||||
rowId: dbRow[0],
|
rowId: dbRow[0],
|
||||||
@@ -399,7 +400,7 @@ class Database {
|
|||||||
time: dbRow[6]
|
time: dbRow[6]
|
||||||
};
|
};
|
||||||
gamelogDatabase.unshift(row);
|
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) => {
|
await sqliteService.execute((dbRow) => {
|
||||||
var row = {
|
var row = {
|
||||||
rowId: dbRow[0],
|
rowId: dbRow[0],
|
||||||
@@ -412,7 +413,7 @@ class Database {
|
|||||||
worldName: dbRow[6]
|
worldName: dbRow[6]
|
||||||
};
|
};
|
||||||
gamelogDatabase.unshift(row);
|
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) => {
|
await sqliteService.execute((dbRow) => {
|
||||||
var row = {
|
var row = {
|
||||||
rowId: dbRow[0],
|
rowId: dbRow[0],
|
||||||
@@ -426,7 +427,7 @@ class Database {
|
|||||||
userId: dbRow[7]
|
userId: dbRow[7]
|
||||||
};
|
};
|
||||||
gamelogDatabase.unshift(row);
|
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) => {
|
await sqliteService.execute((dbRow) => {
|
||||||
var row = {
|
var row = {
|
||||||
rowId: dbRow[0],
|
rowId: dbRow[0],
|
||||||
@@ -435,7 +436,7 @@ class Database {
|
|||||||
data: dbRow[2]
|
data: dbRow[2]
|
||||||
};
|
};
|
||||||
gamelogDatabase.unshift(row);
|
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 compareByCreatedAt = function (a, b) {
|
||||||
var A = a.created_at;
|
var A = a.created_at;
|
||||||
var B = b.created_at;
|
var B = b.created_at;
|
||||||
@@ -447,6 +448,7 @@ class Database {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
gamelogDatabase.splice(0, gamelogDatabase.length - 5000);
|
||||||
gamelogDatabase.sort(compareByCreatedAt);
|
gamelogDatabase.sort(compareByCreatedAt);
|
||||||
return gamelogDatabase;
|
return gamelogDatabase;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user