Skip to content

Commit

Permalink
🔖 Release version 2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
younesaassila authored Oct 10, 2023
2 parents 65773c4 + 46a3d47 commit 44e31a1
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ttv-lol-pro",
"version": "2.2.0",
"version": "2.2.1",
"description": "TTV LOL PRO removes most livestream ads from Twitch.",
"@parcel/bundler-default": {
"minBundles": 10000000,
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.chromium.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "TTV LOL PRO",
"description": "TTV LOL PRO removes most livestream ads from Twitch.",
"version": "2.2.0",
"version": "2.2.1",
"background": {
"service_worker": "background/background.ts",
"type": "module"
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "TTV LOL PRO",
"description": "TTV LOL PRO removes most livestream ads from Twitch.",
"version": "2.2.0",
"version": "2.2.1",
"background": {
"scripts": ["background/background.ts"],
"persistent": false
Expand Down
1 change: 1 addition & 0 deletions src/options/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ <h2>Passport</h2>
<label for="anonymous-mode-checkbox">
Redact my passport information
</label>
<span class="tag">Recommended</span>
<br />
<small>
Watch streams as if you were logged out. This option removes
Expand Down
38 changes: 29 additions & 9 deletions src/page/getFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function getFetch(options: FetchOptions): typeof fetch {
if (options.shouldWaitForStore) {
setTimeout(() => {
options.shouldWaitForStore = false;
}, 3000);
}, 5000);
}

return async function fetch(
Expand Down Expand Up @@ -87,15 +87,35 @@ export function getFetch(options: FetchOptions): typeof fetch {
console.debug(
"[TTV LOL PRO] 🥅 Caught GraphQL PlaybackAccessToken_Template request. Flagging…"
);

while (options.shouldWaitForStore) await sleep(100);
if (options.state?.anonymousMode) {
console.log("[TTV LOL PRO] ❓ Acting as anonymous user");
setHeaderToMap(headersMap, "Authorization", "undefined");
removeHeaderFromMap(headersMap, "Client-Session-Id");
removeHeaderFromMap(headersMap, "Client-Version");
setHeaderToMap(headersMap, "Device-ID", generateRandomString(32));
removeHeaderFromMap(headersMap, "Sec-GPC");
removeHeaderFromMap(headersMap, "X-Device-Id");
let graphQlBody = null;
try {
graphQlBody = JSON.parse(requestBody);
} catch {}
const channelName = graphQlBody?.variables?.login as string | undefined;
const whitelistedChannelsLower = options.state?.whitelistedChannels.map(
channel => channel.toLowerCase()
);
const isWhitelisted =
channelName != null &&
whitelistedChannelsLower != null &&
whitelistedChannelsLower.includes(channelName.toLowerCase());

if (options.state?.anonymousMode === true) {
if (!isWhitelisted) {
console.log("[TTV LOL PRO] 🕵️ Anonymous mode is enabled.");
setHeaderToMap(headersMap, "Authorization", "undefined");
removeHeaderFromMap(headersMap, "Client-Session-Id");
removeHeaderFromMap(headersMap, "Client-Version");
setHeaderToMap(headersMap, "Device-ID", generateRandomString(32));
removeHeaderFromMap(headersMap, "Sec-GPC");
removeHeaderFromMap(headersMap, "X-Device-Id");
} else {
console.log(
"[TTV LOL PRO] 🕵️✋ Anonymous mode is enabled but channel is whitelisted."
);
}
}
flagRequest(headersMap);
} else if (
Expand Down

0 comments on commit 44e31a1

Please sign in to comment.