diff --git a/deno.json b/deno.json index c8fb0e1..df119b2 100644 --- a/deno.json +++ b/deno.json @@ -1,7 +1,8 @@ { "tasks": { "dev": "deno run --allow-all --watch server.ts", - "server": "deno run --allow-all server.ts" + "server": "deno run --allow-all server.ts", + "compile": "deno compile --allow-all --include ./assets/ --output substr server.ts" }, "imports": { "@deno/gfm": "jsr:@deno/gfm@^0.9.0", diff --git a/server.ts b/server.ts index 90d680b..ee7a02a 100644 --- a/server.ts +++ b/server.ts @@ -85,6 +85,7 @@ router.get("/:username/:identifier", async (ctx) => { }); router.get("/assets/:path*", async (ctx) => { + console.log(import.meta.dirname); try { let filePath = ctx.params.path || ""; let root: string; @@ -93,7 +94,7 @@ router.get("/assets/:path*", async (ctx) => { filePath = filePath.replace(/^g\//, ""); root = "/tmp/substr"; } else { - root = `${Deno.cwd()}/assets`; + root = `${import.meta.dirname}/assets`; } await send(ctx, filePath, { root });