mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-13 03:50: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
26
lib/browser/history.js
Normal file
26
lib/browser/history.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
function createHistoryRewriter(ctx) {
|
||||
return function rewriteHistory() {
|
||||
if (ctx.serviceWorker) return;
|
||||
if (ctx.window.History.prototype.pushState) {
|
||||
ctx.window.History.prototype.pushState = new Proxy(ctx.window.History.prototype.pushState, {
|
||||
apply: (target, that, args) => {
|
||||
if (args[2]) args[2] = ctx.url.wrap(args[2], ctx.meta);
|
||||
const ret = Reflect.apply(target, that, args);
|
||||
ctx.updateLocation();
|
||||
return ret;
|
||||
},
|
||||
});
|
||||
};
|
||||
if (ctx.window.History.prototype.replaceState) {
|
||||
ctx.window.History.prototype.replaceState = new Proxy(ctx.window.History.prototype.replaceState, {
|
||||
apply: (target, that, args) => {
|
||||
if (args[2]) args[2] = ctx.url.wrap(args[2], ctx.meta);
|
||||
const ret = Reflect.apply(target, that, args);
|
||||
ctx.updateLocation();
|
||||
return ret;
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
};
|
||||
module.exports = createHistoryRewriter;
|
Loading…
Add table
Add a link
Reference in a new issue