Prevent mini player above chat when stripping ads

This commit is contained in:
pixeltris
2026-02-24 23:03:02 +00:00
parent 3d109ee68f
commit 91d83253ae
4 changed files with 22 additions and 22 deletions
@@ -1,7 +1,7 @@
twitch-videoad.js text/javascript
(function() {
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; }
const ourTwitchAdSolutionsVersion = 21;// Used to prevent conflicts with outdated versions of the scripts
const ourTwitchAdSolutionsVersion = 22;// Used to prevent conflicts with outdated versions of the scripts
if (typeof window.twitchAdSolutionsVersion !== 'undefined' && window.twitchAdSolutionsVersion >= ourTwitchAdSolutionsVersion) {
console.log("skipping video-swap-new as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion);
window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion;
@@ -685,6 +685,10 @@ twitch-videoad.js text/javascript
if (typeof init.headers['Authorization'] === 'string' && init.headers['Authorization'] !== AuthorizationHeader) {
postTwitchWorkerMessage('UpdateAuthorizationHeader', AuthorizationHeader = init.headers['Authorization']);
}
// Get rid of mini player above chat - TODO: Reject this locally instead of having server reject it
if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) {
init.body = '';
}
if (OPT_FORCE_ACCESS_TOKEN_PLAYER_TYPE && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken')) {
let replacedPlayerType = '';
const newBody = JSON.parse(init.body);
@@ -706,10 +710,6 @@ twitch-videoad.js text/javascript
init.body = JSON.stringify(newBody);
}
}
// Get rid of mini player above chat - TODO: Reject this locally instead of having server reject it
if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) {
init.body = '';
}
}
}
return realFetch.apply(this, arguments);