From 5afa089984e1ac07429643489e49f0d775720810 Mon Sep 17 00:00:00 2001 From: Avad3 <65318266+Avad3@users.noreply.github.com> Date: Sun, 14 Jul 2024 15:47:36 -0400 Subject: [PATCH] url proxy --- src/client/index.ts | 1 + src/client/url.ts | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 src/client/url.ts diff --git a/src/client/index.ts b/src/client/index.ts index 32d7f79..6c5f50f 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -12,6 +12,7 @@ import "./storage.ts"; import "./css.ts"; import "./history.ts" import "./worker.ts"; +import "./url.ts"; declare global { interface Window { diff --git a/src/client/url.ts b/src/client/url.ts new file mode 100644 index 0000000..19af4ef --- /dev/null +++ b/src/client/url.ts @@ -0,0 +1,9 @@ +import { encodeUrl } from "../shared/rewriters/url"; + +URL = new Proxy(URL, { + construct(target, argArray, newTarget) { + if (typeof argArray[0] === "string") argArray[0] = encodeUrl(argArray[0]); + + return Reflect.construct(target, argArray, newTarget); + }, +}) \ No newline at end of file