mirror of
https://github.com/younesaassila/ttv-lol-pro.git
synced 2025-05-01 06:54:27 +02:00
Fix #334
This commit is contained in:
parent
1d08f79d6e
commit
2ef38f7a88
@ -41,7 +41,8 @@ const pageState: PageState = {
|
|||||||
|
|
||||||
window.fetch = getFetch(pageState);
|
window.fetch = getFetch(pageState);
|
||||||
|
|
||||||
window.Worker = class Worker extends window.Worker {
|
const NATIVE_WORKER = window.Worker;
|
||||||
|
window.Worker = class Worker extends NATIVE_WORKER {
|
||||||
constructor(scriptURL: string | URL, options?: WorkerOptions) {
|
constructor(scriptURL: string | URL, options?: WorkerOptions) {
|
||||||
const fullUrl = toAbsoluteUrl(scriptURL.toString());
|
const fullUrl = toAbsoluteUrl(scriptURL.toString());
|
||||||
const isTwitchWorker = fullUrl.includes(".twitch.tv");
|
const isTwitchWorker = fullUrl.includes(".twitch.tv");
|
||||||
@ -49,6 +50,13 @@ window.Worker = class Worker extends window.Worker {
|
|||||||
super(scriptURL, options);
|
super(scriptURL, options);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Required for VAFT (>=12.0.0) compatibility.
|
||||||
|
const isAlreadyHooked = NATIVE_WORKER.toString().includes("twitch");
|
||||||
|
if (isAlreadyHooked) {
|
||||||
|
console.error("[TTV LOL PRO] Twitch worker is already hooked.");
|
||||||
|
super(scriptURL, options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
let script = "";
|
let script = "";
|
||||||
// Fetch Twitch's script, since Firefox Nightly errors out when trying to
|
// Fetch Twitch's script, since Firefox Nightly errors out when trying to
|
||||||
// import a blob URL directly.
|
// import a blob URL directly.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user