don't use CDN's for most things. Get rid of JsDelivr.net from CSP as well.

This commit is contained in:
KingKDot
2026-04-18 21:16:29 -05:00
parent 1ee4ae96d5
commit 4cc1f47822
43 changed files with 1339 additions and 423 deletions
@@ -74,7 +74,9 @@ export async function handleAssetsRoutes(
return new Response("Not found", { status: 404 });
}
if (!(req.method === "GET" && url.pathname.startsWith("/assets/"))) {
const isAssets = req.method === "GET" && url.pathname.startsWith("/assets/");
const isVendor = req.method === "GET" && url.pathname.startsWith("/vendor/");
if (!isAssets && !isVendor) {
return null;
}
@@ -89,8 +91,10 @@ export async function handleAssetsRoutes(
return new Response("Not found", { status: 404 });
}
const assetsRoot = path.join(deps.PUBLIC_ROOT, "assets");
const relativePath = decodedPath.replace(/^\/assets\//, "");
const subdir = isVendor ? "vendor" : "assets";
const prefix = isVendor ? /^\/vendor\// : /^\/assets\//;
const assetsRoot = path.join(deps.PUBLIC_ROOT, subdir);
const relativePath = decodedPath.replace(prefix, "");
const resolvedPath = path.resolve(assetsRoot, relativePath);
const rootWithSep = assetsRoot.endsWith(path.sep) ? assetsRoot : `${assetsRoot}${path.sep}`;