mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-12 19:40:02 -04:00
Added Corrosion Fix for Heroku
Credits: https://github.com/BinBashBanana/Corrosion-Heroku (very epic person)
This commit is contained in:
parent
8d88daf1c2
commit
b0c48df26c
25 changed files with 13 additions and 10 deletions
|
@ -1,33 +0,0 @@
|
|||
function createWorkerRewriter(ctx = {}) {
|
||||
return function rewriteWorker() {
|
||||
if (ctx.window.Worker) {
|
||||
ctx.window.Worker = new Proxy(ctx.window.Worker, {
|
||||
construct: (target, args) => {
|
||||
if (args[0]) {
|
||||
if (args[0].trim().startsWith(`blob:${ctx.window.location.origin}`)) {
|
||||
const xhr = new ctx.originalXhr();
|
||||
xhr.open('GET', args[0], false);
|
||||
xhr.send();
|
||||
const script = ctx.js.process(xhr.responseText, ctx.location.origin + args[0].trim().slice(`blob:${ctx.window.location.origin}`.length));
|
||||
const blob = new Blob([ script ], { type: 'application/javascript' });
|
||||
args[0] = URL.createObjectURL(blob);
|
||||
} else {
|
||||
args[0] = ctx.url.wrap(args[0], ctx.meta);
|
||||
};
|
||||
};
|
||||
return Reflect.construct(target, args);
|
||||
},
|
||||
});
|
||||
};
|
||||
if (ctx.serviceWorker && ctx.window.importScripts) {
|
||||
ctx.window.importScripts = new Proxy(ctx.window.importScripts, {
|
||||
apply: (target, that, args) => {
|
||||
if (args[0]) args[0] = ctx.url.wrap(args[0], ctx.meta);
|
||||
return Reflect.apply(target, that, args);
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = createWorkerRewriter;
|
Loading…
Add table
Add a link
Reference in a new issue