Remove esm.sh externals

This commit is contained in:
2026-03-31 06:57:44 +01:00
parent 68d88bce4a
commit 7dbd1f7e12
18 changed files with 232 additions and 102 deletions
+11 -8
View File
@@ -11,14 +11,7 @@ export default async function ({ req }) {
if (!file_path.startsWith(PUBLIC_DIR + path.sep)) {
return new Response("Forbidden", { status: 403 });
}
if (!existsSync(file_path)) {
return new Response(`Public File Doesn't Exist`, {
status: 404,
});
}
const file = Bun.file(file_path);
let res_opts = {};
return new Response(file, res_opts);
return readFileResponse({ file_path });
}
catch (error) {
return new Response(`Public File Not Found`, {
@@ -26,3 +19,13 @@ export default async function ({ req }) {
});
}
}
export function readFileResponse({ file_path }) {
if (!existsSync(file_path)) {
return new Response(`Public File Doesn't Exist`, {
status: 404,
});
}
const file = Bun.file(file_path);
// let res_opts: ResponseInit = {};
return new Response(file);
}