From d2938ce6fe52695ac379f0a466dbaec6be3a7f88 Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Sat, 22 Jul 2023 10:08:53 -0400 Subject: [PATCH] obscure double-undescore routes --- run-serve.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/run-serve.tsx b/run-serve.tsx index 55ff51f..1e70e5c 100644 --- a/run-serve.tsx +++ b/run-serve.tsx @@ -270,10 +270,9 @@ const server = Deno.serve({port:parseInt(Deno.env.get("port")||"8000")}, async(r const ext = Extension(url.pathname); const headers = {"content-type":"application/json", "Access-Control-Allow-Origin": Configuration.Allow, "charset":"UTF-8"}; - // cache-reset route - if(url.pathname === Configuration.Reset) + if(url.pathname.includes("/__")) { - return new Response(`{"cleared":${Transpile.Clear()}}`, {headers}); + return new Response(`{"error":"unmatched route", "path":"${url.pathname}"}`, {status:404, headers}); } // allow for custom handler @@ -335,6 +334,12 @@ const server = Deno.serve({port:parseInt(Deno.env.get("port")||"8000")}, async(r } } + // cache-reset route + if(url.pathname === Configuration.Reset) + { + return new Response(`{"cleared":${Transpile.Clear()}}`, {headers}); + } + // all other static files if(ext) {