mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 15:00:01 -04:00
fix beacon and fetch
This commit is contained in:
parent
90fb31d8c1
commit
1f287f4a17
3 changed files with 18 additions and 5 deletions
|
@ -2,7 +2,7 @@ export default function (client, self) {
|
||||||
// goodybye spyware~
|
// goodybye spyware~
|
||||||
client.Proxy("navigator.sendBeacon", {
|
client.Proxy("navigator.sendBeacon", {
|
||||||
apply(ctx) {
|
apply(ctx) {
|
||||||
ctx.return(null);
|
ctx.return(true);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// ts throws an error if you dont do window.fetch
|
// ts throws an error if you dont do window.fetch
|
||||||
|
|
||||||
import { isemulatedsw } from "../..";
|
import { isemulatedsw } from "../..";
|
||||||
|
import { decodeUrl } from "../../../shared/rewriters/url";
|
||||||
import { ScramjetClient } from "../../client";
|
import { ScramjetClient } from "../../client";
|
||||||
import { encodeUrl, rewriteHeaders } from "../../shared";
|
import { encodeUrl, rewriteHeaders } from "../../shared";
|
||||||
|
|
||||||
|
@ -31,9 +32,21 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
client.Proxy("Response.redirect", {
|
client.Trap("Response.prototype.url", {
|
||||||
apply(ctx) {
|
get(ctx) {
|
||||||
ctx.args[0] = encodeUrl(ctx.args[0]);
|
return decodeUrl(ctx.get() as string);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
client.Trap("Request.prototype.url", {
|
||||||
|
get(ctx) {
|
||||||
|
return decodeUrl(ctx.get() as string);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// client.Proxy("Response.redirect", {
|
||||||
|
// apply(ctx) {
|
||||||
|
// ctx.args[0] = encodeUrl(ctx.args[0]);
|
||||||
|
// },
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.$scramerr = function scramerr(e) {
|
self.$scramerr = function scramerr(e) {
|
||||||
// console.warn("CAUGHT ERROR", e);
|
console.warn("CAUGHT ERROR", e);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.$scramdbg = function scramdbg(args, t) {
|
self.$scramdbg = function scramdbg(args, t) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue