From 85d156f6b2ef0df38926e97cb3ada6a30299b9a9 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Thu, 26 Oct 2023 15:43:33 +0700 Subject: [PATCH] Clear Application Insights buffers periodically --- better-xcloud.user.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/better-xcloud.user.js b/better-xcloud.user.js index b1187a7..e57459e 100644 --- a/better-xcloud.user.js +++ b/better-xcloud.user.js @@ -4068,12 +4068,17 @@ function updateIceCandidates(candidates) { } +function clearApplicationInsightsBuffers() { + window.sessionStorage.removeItem('AI_buffer'); + window.sessionStorage.removeItem('AI_sentBuffer'); +} + + function interceptHttpRequests() { var BLOCKED_URLS = []; if (PREFS.get(Preferences.BLOCK_TRACKING)) { - // Clear Analytics Insight buffers - window.sessionStorage.removeItem('AI_buffer'); - window.sessionStorage.removeItem('AI_sentBuffer'); + // Clear Applications Insight buffers + clearApplicationInsightsBuffers(); BLOCKED_URLS = BLOCKED_URLS.concat([ 'https://arc.msn.com', @@ -4109,6 +4114,9 @@ function interceptHttpRequests() { xhrPrototype.send = function(...arg) { for (let blocked of BLOCKED_URLS) { if (this._url.startsWith(blocked)) { + if (blocked === 'https://dc.services.visualstudio.com') { + setTimeout(clearApplicationInsightsBuffers, 1000); + } return false; } }