From b72e029cf692e574ba08ec681b46a75d1828296c Mon Sep 17 00:00:00 2001 From: Kiradien <68683574+Kiradien@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:10:03 -0400 Subject: [PATCH 1/2] Reduce http header cookie clutter Previous logic attempted to duplicate cookies which were being set by default within chrome's request object. Cookies at issue had specialized settings of "Session" or no_restriction on SameSite. --- plugin/js/HttpClient.js | 1 + plugin/js/parsers/SpacebattlesParser.js | 1 + 2 files changed, 2 insertions(+) diff --git a/plugin/js/HttpClient.js b/plugin/js/HttpClient.js index 0f980905..08276791 100644 --- a/plugin/js/HttpClient.js +++ b/plugin/js/HttpClient.js @@ -222,6 +222,7 @@ class HttpClient { let cookies = ""; if (!util.isFirefox()) { cookies = await chrome.cookies.getAll({domain: urlparts[urlparts.length-2]+"."+urlparts[urlparts.length-1],partitionKey: {}}); + cookies = cookies.filter(item => item.session || item.sameSite == "no_restriction"); }else{ cookies = await browser.cookies.getAll({domain: urlparts[urlparts.length-2]+"."+urlparts[urlparts.length-1],partitionKey: {}}); } diff --git a/plugin/js/parsers/SpacebattlesParser.js b/plugin/js/parsers/SpacebattlesParser.js index a51ebad5..60fca0c3 100644 --- a/plugin/js/parsers/SpacebattlesParser.js +++ b/plugin/js/parsers/SpacebattlesParser.js @@ -12,6 +12,7 @@ class SpacebattlesParser extends Parser{ constructor() { super(); this.cache = new FetchCache(); + this.minimumThrottle = 50; //182 at 20 } clampSimultanousFetchSize() { From 0c064d883467594461481f5dc5155c2a242e8f70 Mon Sep 17 00:00:00 2001 From: Kiradien <68683574+Kiradien@users.noreply.github.com> Date: Tue, 10 Sep 2024 21:16:27 -0400 Subject: [PATCH 2/2] Update HttpClient.js --- plugin/js/HttpClient.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/js/HttpClient.js b/plugin/js/HttpClient.js index 08276791..871eccca 100644 --- a/plugin/js/HttpClient.js +++ b/plugin/js/HttpClient.js @@ -222,10 +222,10 @@ class HttpClient { let cookies = ""; if (!util.isFirefox()) { cookies = await chrome.cookies.getAll({domain: urlparts[urlparts.length-2]+"."+urlparts[urlparts.length-1],partitionKey: {}}); - cookies = cookies.filter(item => item.session || item.sameSite == "no_restriction"); }else{ cookies = await browser.cookies.getAll({domain: urlparts[urlparts.length-2]+"."+urlparts[urlparts.length-1],partitionKey: {}}); } + cookies = cookies.filter(item => item.partitionKey != undefined); //create new cookies for the site without the partitionKey //cookies without the partitionKey get sent with fetch cookies.forEach(element => chrome.cookies.set({