mirror of
https://github.com/pixeltris/TwitchAdSolutions.git
synced 2025-04-29 14:14:36 +02:00
19 lines
832 B
JavaScript
19 lines
832 B
JavaScript
twitch-videoad.js application/javascript
|
|
(function() {
|
|
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; }
|
|
function hookFetch() {
|
|
var realFetch = window.fetch;
|
|
window.fetch = function(url, init, ...args) {
|
|
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);
|
|
}
|
|
}
|
|
hookFetch();
|
|
})(); |