Skip to content

Commit

Permalink
🧪 Last experiment…
Browse files Browse the repository at this point in the history
  • Loading branch information
younesaassila committed May 29, 2023
1 parent ed107fb commit fd70d82
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/background/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ if (isChromium) {
};
setProxySettings();
} else {
// Block tracking pixels.
browser.webRequest.onBeforeRequest.addListener(
() => ({ cancel: true }),
{ urls: ["https://*.twitch.tv/r/*"] },
["blocking"]
);
// Map channel names to video-weaver URLs.
browser.webRequest.onBeforeRequest.addListener(
onBeforeUsherRequest,
Expand Down
7 changes: 1 addition & 6 deletions src/background/handlers/onHeadersReceived.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ export default function onHeadersReceived(
const proxy = getProxyFromDetails(details);

// Twitch webpage requests.
if (
store.state.proxyTwitchWebpage &&
host === "www.twitch.tv" &&
!details.url.endsWith(".js") &&
details.url.split("/").length <= 4
) {
if (store.state.proxyTwitchWebpage && host === "www.twitch.tv") {
if (!proxy) return console.log(`❌ Did not proxy ${details.url}`);
console.log(`✅ Proxied ${details.url} through ${proxy}`);
}
Expand Down
7 changes: 1 addition & 6 deletions src/background/handlers/onProxyRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ export default async function onProxyRequest(
}

// Twitch webpage requests.
if (
store.state.proxyTwitchWebpage &&
host === "www.twitch.tv" &&
!details.url.endsWith(".js") &&
details.url.split("/").length <= 4
) {
if (store.state.proxyTwitchWebpage && host === "www.twitch.tv") {
const proxies = store.state.videoWeaverProxies;
const proxyInfoArray = getProxyInfoArrayFromHosts(proxies);
console.log(`⌛ Proxying ${details.url} through one of: <empty>`);
Expand Down

0 comments on commit fd70d82

Please sign in to comment.