summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--assets/public/1f0bfc0865d324c2587920a7d80c609b.png (renamed from assets/default-avatars/1.png)bin4397 -> 4397 bytes
-rw-r--r--assets/public/3c6ccb83716d1e4fb91d3082f6b21d77.png (renamed from assets/default-avatars/5.png)bin4276 -> 4276 bytes
-rw-r--r--assets/public/6f26ddd1bf59740c536d2274bb834a05.png (renamed from assets/default-avatars/4.png)bin2855 -> 2855 bytes
-rw-r--r--assets/public/7c8f476123d28d103efe381543274c25.png (renamed from assets/default-avatars/3.png)bin2831 -> 2831 bytes
-rw-r--r--assets/public/c09a43a372ba81e3018c3151d4ed4773.png (renamed from assets/default-avatars/2.png)bin4544 -> 4544 bytes
-rw-r--r--package-lock.json1
-rw-r--r--src/cdn/routes/embed.ts12
7 files changed, 11 insertions, 2 deletions
diff --git a/assets/default-avatars/1.png b/assets/public/1f0bfc0865d324c2587920a7d80c609b.png
index 61b3f9cf..61b3f9cf 100644
--- a/assets/default-avatars/1.png
+++ b/assets/public/1f0bfc0865d324c2587920a7d80c609b.png
Binary files differdiff --git a/assets/default-avatars/5.png b/assets/public/3c6ccb83716d1e4fb91d3082f6b21d77.png
index 3cc5589c..3cc5589c 100644
--- a/assets/default-avatars/5.png
+++ b/assets/public/3c6ccb83716d1e4fb91d3082f6b21d77.png
Binary files differdiff --git a/assets/default-avatars/4.png b/assets/public/6f26ddd1bf59740c536d2274bb834a05.png
index bcf0c183..bcf0c183 100644
--- a/assets/default-avatars/4.png
+++ b/assets/public/6f26ddd1bf59740c536d2274bb834a05.png
Binary files differdiff --git a/assets/default-avatars/3.png b/assets/public/7c8f476123d28d103efe381543274c25.png
index 3fadcedf..3fadcedf 100644
--- a/assets/default-avatars/3.png
+++ b/assets/public/7c8f476123d28d103efe381543274c25.png
Binary files differdiff --git a/assets/default-avatars/2.png b/assets/public/c09a43a372ba81e3018c3151d4ed4773.png
index 8caebf90..8caebf90 100644
--- a/assets/default-avatars/2.png
+++ b/assets/public/c09a43a372ba81e3018c3151d4ed4773.png
Binary files differdiff --git a/package-lock.json b/package-lock.json
index 165a2b23..ecd455b8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -45,7 +45,6 @@
 				"probe-image-size": "^7.2.3",
 				"proxy-agent": "^5.0.0",
 				"reflect-metadata": "^0.1.13",
-				"sqlite3": "*",
 				"ts-node": "^10.9.1",
 				"tslib": "^2.4.1",
 				"typeorm": "^0.3.10",
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);