obscure double-undescore routes

This commit is contained in:
Seth Trowbridge 2023-07-22 10:08:53 -04:00
parent 65d6d827e3
commit d2938ce6fe

View File

@ -270,10 +270,9 @@ const server = Deno.serve({port:parseInt(Deno.env.get("port")||"8000")}, async(r
const ext = Extension(url.pathname); const ext = Extension(url.pathname);
const headers = {"content-type":"application/json", "Access-Control-Allow-Origin": Configuration.Allow, "charset":"UTF-8"}; const headers = {"content-type":"application/json", "Access-Control-Allow-Origin": Configuration.Allow, "charset":"UTF-8"};
// cache-reset route if(url.pathname.includes("/__"))
if(url.pathname === Configuration.Reset)
{ {
return new Response(`{"cleared":${Transpile.Clear()}}`, {headers}); return new Response(`{"error":"unmatched route", "path":"${url.pathname}"}`, {status:404, headers});
} }
// allow for custom handler // 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 // all other static files
if(ext) if(ext)
{ {