summary refs log tree commit diff
path: root/src/cdn/routes
diff options
context:
space:
mode:
authorRory& <myrainbowdash949@gmail.com>2024-02-19 10:09:50 +0000
committerGitHub <noreply@github.com>2024-02-19 21:09:50 +1100
commit29df169c81d963742cc973a8835a7c1a126d7220 (patch)
tree7db8092c20e187ff812f8b9f71b28c5c25641d56 /src/cdn/routes
parentFix application icons (#1110) (diff)
downloadserver-29df169c81d963742cc973a8835a7c1a126d7220.tar.xz
Add nix flake to repo (#1111)
Diffstat (limited to 'src/cdn/routes')
-rw-r--r--src/cdn/routes/embed.ts20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/cdn/routes/embed.ts b/src/cdn/routes/embed.ts
index 9d3469cd..b99396eb 100644
--- a/src/cdn/routes/embed.ts
+++ b/src/cdn/routes/embed.ts
@@ -63,7 +63,15 @@ router.get("/avatars/:id", async (req: Request, res: Response) => {
 	id = id.split(".")[0]; // remove .file extension
 	const hash = defaultAvatarHashMap.get(id);
 	if (!hash) throw new HTTPError("not found", 404);
-	const path = join(process.cwd(), "assets", "public", `${hash}.png`);
+	const path = join(
+		__dirname,
+		"..",
+		"..",
+		"..",
+		"assets",
+		"public",
+		`${hash}.png`,
+	);
 
 	const file = await getFile(path);
 	if (!file) throw new HTTPError("not found", 404);
@@ -80,7 +88,15 @@ router.get("/group-avatars/:id", async (req: Request, res: Response) => {
 	id = id.split(".")[0]; // remove .file extension
 	const hash = defaultGroupDMAvatarHashMap.get(id);
 	if (!hash) throw new HTTPError("not found", 404);
-	const path = join(process.cwd(), "assets", "public", `${hash}.png`);
+	const path = join(
+		__dirname,
+		"..",
+		"..",
+		"..",
+		"assets",
+		"public",
+		`${hash}.png`,
+	);
 
 	const file = await getFile(path);
 	if (!file) throw new HTTPError("not found", 404);