mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 07:37:19 +02:00
Clear logs in DB
This commit is contained in:
parent
281787d955
commit
989634b52e
@ -8241,17 +8241,38 @@ function updateIceCandidates(candidates, options) {
|
||||
}
|
||||
|
||||
|
||||
function clearDbLogs(dbName, table) {
|
||||
const request = window.indexedDB.open(dbName);
|
||||
request.onsuccess = e => {
|
||||
const db = e.target.result;
|
||||
|
||||
const objectStore = db.transaction(table, 'readwrite').objectStore(table);
|
||||
const objectStoreRequest = objectStore.clear();
|
||||
|
||||
objectStoreRequest.onsuccess = function(event) {
|
||||
console.log(`[Better xCloud] Cleared ${dbName}.${table}`);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function clearApplicationInsightsBuffers() {
|
||||
window.sessionStorage.removeItem('AI_buffer');
|
||||
window.sessionStorage.removeItem('AI_sentBuffer');
|
||||
}
|
||||
|
||||
|
||||
function clearAllLogs() {
|
||||
clearApplicationInsightsBuffers();
|
||||
clearDbLogs('StreamClientLogHandler', 'logs');
|
||||
clearDbLogs('XCloudAppLogs', 'logs');
|
||||
}
|
||||
|
||||
|
||||
function interceptHttpRequests() {
|
||||
var BLOCKED_URLS = [];
|
||||
if (PREFS.get(Preferences.BLOCK_TRACKING)) {
|
||||
// Clear Applications Insight buffers
|
||||
clearApplicationInsightsBuffers();
|
||||
clearAllLogs();
|
||||
|
||||
BLOCKED_URLS = BLOCKED_URLS.concat([
|
||||
'https://arc.msn.com',
|
||||
@ -8283,7 +8304,7 @@ function interceptHttpRequests() {
|
||||
for (let blocked of BLOCKED_URLS) {
|
||||
if (this._url.startsWith(blocked)) {
|
||||
if (blocked === 'https://dc.services.visualstudio.com') {
|
||||
setTimeout(clearApplicationInsightsBuffers, 1000);
|
||||
setTimeout(clearAllLogs, 1000);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user