summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cdn/routes/embed.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/cdn/routes/embed.ts b/src/cdn/routes/embed.ts
index c38046ed..5e5ff76d 100644
--- a/src/cdn/routes/embed.ts
+++ b/src/cdn/routes/embed.ts
@@ -22,6 +22,14 @@ import fs from "fs/promises";
 import { HTTPError } from "lambert-server";
 import { join } from "path";
 
+const defaultAvatarHashMap = new Map([
+	["1", "1f0bfc0865d324c2587920a7d80c609b"],
+	["2", "c09a43a372ba81e3018c3151d4ed4773"],
+	["3", "7c8f476123d28d103efe381543274c25"],
+	["4", "6f26ddd1bf59740c536d2274bb834a05"],
+	["5", "3c6ccb83716d1e4fb91d3082f6b21d77"],
+]);
+
 const router = Router();
 
 async function getFile(path: string) {
@@ -41,7 +49,9 @@ async function getFile(path: string) {
 router.get("/avatars/:id", async (req: Request, res: Response) => {
 	let { id } = req.params;
 	id = id.split(".")[0]; // remove .file extension
-	const path = join(process.cwd(), "assets", "default-avatars", `${id}.png`);
+	const hash = defaultAvatarHashMap.get(id);
+	if (!hash) throw new HTTPError("not found", 404);
+	const path = join(process.cwd(), "assets", "public", `${hash}.png`);
 
 	const file = await getFile(path);
 	if (!file) throw new HTTPError("not found", 404);