support url base

This commit is contained in:
velzie 2024-09-01 13:26:24 -04:00
parent a1ce4e33b3
commit 7a9c990b01
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
32 changed files with 213 additions and 158 deletions

View file

@ -1,7 +1,7 @@
// @ts-nocheck
import { ScramjetClient } from "./client";
import { nativeGetOwnPropertyDescriptor } from "./natives";
import { encodeUrl, decodeUrl } from "../shared";
import { decodeUrl, encodeUrl } from "../shared";
import { iswindow } from ".";
export function createLocationProxy(
@ -76,7 +76,7 @@ export function createLocationProxy(
if (self.location.assign)
fakeLocation.assign = new Proxy(self.location.assign, {
apply(target, thisArg, args) {
args[0] = encodeUrl(args[0]);
args[0] = encodeUrl(args[0], client.meta);
Reflect.apply(target, self.location, args);
},
});
@ -89,7 +89,7 @@ export function createLocationProxy(
if (self.location.replace)
fakeLocation.replace = new Proxy(self.location.replace, {
apply(target, thisArg, args) {
args[0] = encodeUrl(args[0]);
args[0] = encodeUrl(args[0], client.meta);
Reflect.apply(target, self.location, args);
},
});