Fix broken site functionality #50 #45

This commit is contained in:
pixeltris
2021-10-14 14:36:13 +01:00
parent 6be4c53130
commit 3d2883ea9e
8 changed files with 84 additions and 87 deletions
+6 -8
View File
@@ -4,14 +4,12 @@ twitch-videoad.js application/javascript
function hookFetch() {
var realFetch = window.fetch;
window.fetch = function(url, init, ...args) {
if (typeof url === 'string') {
if (url.includes('gql')) {
if (typeof init.headers['X-Device-Id'] === 'string') {
init.headers['X-Device-Id'] = 'twitch-web-wall-mason';
}
if (typeof init.headers['Device-ID'] === 'string') {
init.headers['Device-ID'] = 'twitch-web-wall-mason';
}
if (typeof url === 'string' && url.includes('gql') && typeof init.body == 'string' && init.body.includes('PlaybackAccessToken')) {
if (typeof init.headers['X-Device-Id'] === 'string') {
init.headers['X-Device-Id'] = 'twitch-web-wall-mason';
}
if (typeof init.headers['Device-ID'] === 'string') {
init.headers['Device-ID'] = 'twitch-web-wall-mason';
}
}
return realFetch.apply(this, arguments);
+7 -9
View File
@@ -1,7 +1,7 @@
// ==UserScript==
// @name TwitchAdSolutions (bypass)
// @namespace https://github.com/pixeltris/TwitchAdSolutions
// @version 1.0
// @version 1.1
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/bypass/bypass.user.js
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/bypass/bypass.user.js
// @description Multiple solutions for blocking Twitch ads (bypass)
@@ -15,14 +15,12 @@
function hookFetch() {
var realFetch = window.fetch;
window.fetch = function(url, init, ...args) {
if (typeof url === 'string') {
if (url.includes('gql')) {
if (typeof init.headers['X-Device-Id'] === 'string') {
init.headers['X-Device-Id'] = 'twitch-web-wall-mason';
}
if (typeof init.headers['Device-ID'] === 'string') {
init.headers['Device-ID'] = 'twitch-web-wall-mason';
}
if (typeof url === 'string' && url.includes('gql') && typeof init.body == 'string' && init.body.includes('PlaybackAccessToken')) {
if (typeof init.headers['X-Device-Id'] === 'string') {
init.headers['X-Device-Id'] = 'twitch-web-wall-mason';
}
if (typeof init.headers['Device-ID'] === 'string') {
init.headers['Device-ID'] = 'twitch-web-wall-mason';
}
}
return realFetch.apply(this, arguments);