fix beacon and fetch

This commit is contained in:
velzie 2024-08-03 12:27:38 -04:00
parent 90fb31d8c1
commit 1f287f4a17
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
3 changed files with 18 additions and 5 deletions

View file

@ -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);
}, },
}); });
} }

View file

@ -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]);
// },
// });
} }

View file

@ -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) {