Skip to content

Commit

Permalink
block unnecessary network requests
Browse files Browse the repository at this point in the history
  • Loading branch information
ccev committed Aug 16, 2024
1 parent b0d7145 commit 6a4ecec
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions xilriws-proxy/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ let currentProxyCreds = {
"password": null
}

const blockedScripts = [
"login-util.js",
"screen-name-script.js",
"set-state-script.js",
]
const blockedFiles = ["woff", "ttf", "css", "png", "jpg", "jpeg", "svg", "ico"]


const BLOCK_URLS = [
"*://fonts.googleapis.com/*",
]

blockedScripts.forEach(name => BLOCK_URLS.push("*://access.pokemon.com/scripts/" + name))
blockedFiles.forEach(name => BLOCK_URLS.push("*://*/*." + name + "*"))

chrome.webRequest.onBeforeRequest.addListener(
() => { return {cancel: true} },
{urls: BLOCK_URLS},
["blocking"]
)

ws.onmessage = (event) => {
console.log('Message from server: ', event.data);
const message = JSON.parse(event.data)
Expand Down

0 comments on commit 6a4ecec

Please sign in to comment.