From b09b3c1d0d39421ebfdd22d8926ca1781b841b9d Mon Sep 17 00:00:00 2001 From: Percs <83934299+Percslol@users.noreply.github.com> Date: Fri, 18 Oct 2024 02:57:56 -0500 Subject: [PATCH] fix: proxy more cache apis and fix proxy --- src/client/shared/caches.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/client/shared/caches.ts b/src/client/shared/caches.ts index 2baf472..c5ae2e4 100644 --- a/src/client/shared/caches.ts +++ b/src/client/shared/caches.ts @@ -41,7 +41,7 @@ export default function (client: ScramjetClient, self: typeof globalThis) { }, }); - client.Proxy("Cache.prototype.delete", { + client.Proxy("Cache.prototype.put", { apply(ctx) { ctx.args[0] = rewriteUrl(ctx.args[0], client.meta); }, @@ -55,7 +55,19 @@ export default function (client: ScramjetClient, self: typeof globalThis) { client.Proxy("Cache.prototype.matchAll", { apply(ctx) { - if (ctx.args[0]) ctx.args[0] = `${client.url.origin}@${ctx.args[0]}`; + if (ctx.args[0]) ctx.args[0] = rewriteUrl(ctx.args[0], client.meta); + }, + }); + + client.Proxy("Cache.prototype.keys", { + apply(ctx) { + if (ctx.args[0]) ctx.args[0] = rewriteUrl(ctx.args[0], client.meta); + }, + }); + + client.Proxy("Cache.prototype.delete", { + apply(ctx) { + ctx.args[0] = rewriteUrl(ctx.args[0], client.meta); }, }); }