fix: turn on strict rewrites by default

This commit is contained in:
Percs 2024-10-23 21:14:32 -05:00
parent 5f70c1c0ac
commit c34d0a07e1
3 changed files with 2 additions and 14 deletions

View file

@ -2,7 +2,7 @@ import { rewriteUrl } from "../../../shared";
import { ScramjetClient } from "../../client"; import { ScramjetClient } from "../../client";
export default function (client: ScramjetClient, self) { export default function (client: ScramjetClient, self) {
client.Proxy("navigator.sendBeacon", { client.Proxy("Navigator.prototype.sendBeacon", {
apply(ctx) { apply(ctx) {
ctx.args[0] = rewriteUrl(ctx.args[0], client.meta); ctx.args[0] = rewriteUrl(ctx.args[0], client.meta);
}, },

View file

@ -16,12 +16,6 @@ export default function (client: ScramjetClient, _self: typeof globalThis) {
}, },
}); });
// client.Proxy("Headers", {
// construct(ctx) {
// ctx.args[0] = rewriteHeaders(ctx.args[0]);
// },
// });
client.Proxy("Request", { client.Proxy("Request", {
construct(ctx) { construct(ctx) {
if (typeof ctx.args[0] === "string" || ctx.args[0] instanceof URL) { if (typeof ctx.args[0] === "string" || ctx.args[0] instanceof URL) {
@ -43,10 +37,4 @@ export default function (client: ScramjetClient, _self: typeof globalThis) {
return unrewriteUrl(ctx.get() as string); return unrewriteUrl(ctx.get() as string);
}, },
}); });
// client.Proxy("Response.redirect", {
// apply(ctx) {
// ctx.args[0] = encodeUrl(ctx.args[0]);
// },
// });
} }

View file

@ -30,7 +30,7 @@ export class ScramjetController {
serviceworkers: false, serviceworkers: false,
naiiveRewriter: false, naiiveRewriter: false,
captureErrors: true, captureErrors: true,
strictRewrites: false, strictRewrites: true,
syncxhr: false, syncxhr: false,
cleanerrors: false, cleanerrors: false,
scramitize: false, scramitize: false,