diff options
-rw-r--r-- | assets/public/0c8138dcc0dfe2689cdd73f7952c2475.png (renamed from assets/public/7c8f476123d28d103efe381543274c25.png) | bin | 4657 -> 4657 bytes | |||
-rw-r--r-- | assets/public/1276374a404452756f3c9cc2601508a5.png | bin | 0 -> 1522 bytes | |||
-rw-r--r-- | assets/public/2e46fe14586f8e95471c0917f56726b5.png | bin | 0 -> 1573 bytes | |||
-rw-r--r-- | assets/public/3b70bb66089c60f8be5e214bf8574c9d.png | bin | 0 -> 1321 bytes | |||
-rw-r--r-- | assets/public/4ab900144b0865430dc9be825c838faa.png | bin | 0 -> 1446 bytes | |||
-rw-r--r-- | assets/public/5ac2728593bb455250d11b848a0c36c6.png (renamed from assets/public/6f26ddd1bf59740c536d2274bb834a05.png) | bin | 4494 -> 4494 bytes | |||
-rw-r--r-- | assets/public/823a3de61c4dc2415cc4dbc38fca4299.png (renamed from assets/public/1f0bfc0865d324c2587920a7d80c609b.png) | bin | 4380 -> 4380 bytes | |||
-rw-r--r-- | assets/public/904bf9f1b61f53ef4a3b7a893afeabe3.png | bin | 0 -> 1535 bytes | |||
-rw-r--r-- | assets/public/9581acd31832465bdeaa5385b0e919a3.png | bin | 0 -> 1288 bytes | |||
-rw-r--r-- | assets/public/a8a4727cf2dc2939bd3c657fad4463fa.png | bin | 0 -> 1355 bytes | |||
-rw-r--r-- | assets/public/addd2f3268df46459e1d6012ad8e75bd.png (renamed from assets/public/3c6ccb83716d1e4fb91d3082f6b21d77.png) | bin | 4511 -> 4511 bytes | |||
-rw-r--r-- | assets/public/c4e0c8300fa491d94acfd2a1fb26cea8.png (renamed from assets/public/4c1b599b1ef5b9f1874fdb9933f3e03b.png) | bin | 4251 -> 4251 bytes | |||
-rw-r--r-- | assets/public/e56a89224be0b2b1f7c04eca975be468.png (renamed from assets/public/c09a43a372ba81e3018c3151d4ed4773.png) | bin | 4158 -> 4158 bytes | |||
-rw-r--r-- | assets/public/fac7e78de9753d4a37083bba74c1d9ef.png | bin | 0 -> 1318 bytes | |||
-rw-r--r-- | env-vars.md | 15 | ||||
-rw-r--r-- | package-lock.json | 15 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/api/Server.ts | 4 | ||||
-rw-r--r-- | src/cdn/routes/embed.ts | 40 |
19 files changed, 46 insertions, 30 deletions
diff --git a/assets/public/7c8f476123d28d103efe381543274c25.png b/assets/public/0c8138dcc0dfe2689cdd73f7952c2475.png index 3e8eeae9..3e8eeae9 100644 --- a/assets/public/7c8f476123d28d103efe381543274c25.png +++ b/assets/public/0c8138dcc0dfe2689cdd73f7952c2475.png Binary files differdiff --git a/assets/public/1276374a404452756f3c9cc2601508a5.png b/assets/public/1276374a404452756f3c9cc2601508a5.png new file mode 100644 index 00000000..b9f7f62c --- /dev/null +++ b/assets/public/1276374a404452756f3c9cc2601508a5.png Binary files differdiff --git a/assets/public/2e46fe14586f8e95471c0917f56726b5.png b/assets/public/2e46fe14586f8e95471c0917f56726b5.png new file mode 100644 index 00000000..bf747d73 --- /dev/null +++ b/assets/public/2e46fe14586f8e95471c0917f56726b5.png Binary files differdiff --git a/assets/public/3b70bb66089c60f8be5e214bf8574c9d.png b/assets/public/3b70bb66089c60f8be5e214bf8574c9d.png new file mode 100644 index 00000000..c4f95d93 --- /dev/null +++ b/assets/public/3b70bb66089c60f8be5e214bf8574c9d.png Binary files differdiff --git a/assets/public/4ab900144b0865430dc9be825c838faa.png b/assets/public/4ab900144b0865430dc9be825c838faa.png new file mode 100644 index 00000000..f3ba032d --- /dev/null +++ b/assets/public/4ab900144b0865430dc9be825c838faa.png Binary files differdiff --git a/assets/public/6f26ddd1bf59740c536d2274bb834a05.png b/assets/public/5ac2728593bb455250d11b848a0c36c6.png index 9f137906..9f137906 100644 --- a/assets/public/6f26ddd1bf59740c536d2274bb834a05.png +++ b/assets/public/5ac2728593bb455250d11b848a0c36c6.png Binary files differdiff --git a/assets/public/1f0bfc0865d324c2587920a7d80c609b.png b/assets/public/823a3de61c4dc2415cc4dbc38fca4299.png index 9b92bd2f..9b92bd2f 100644 --- a/assets/public/1f0bfc0865d324c2587920a7d80c609b.png +++ b/assets/public/823a3de61c4dc2415cc4dbc38fca4299.png Binary files differdiff --git a/assets/public/904bf9f1b61f53ef4a3b7a893afeabe3.png b/assets/public/904bf9f1b61f53ef4a3b7a893afeabe3.png new file mode 100644 index 00000000..0cac9678 --- /dev/null +++ b/assets/public/904bf9f1b61f53ef4a3b7a893afeabe3.png Binary files differdiff --git a/assets/public/9581acd31832465bdeaa5385b0e919a3.png b/assets/public/9581acd31832465bdeaa5385b0e919a3.png new file mode 100644 index 00000000..10261557 --- /dev/null +++ b/assets/public/9581acd31832465bdeaa5385b0e919a3.png Binary files differdiff --git a/assets/public/a8a4727cf2dc2939bd3c657fad4463fa.png b/assets/public/a8a4727cf2dc2939bd3c657fad4463fa.png new file mode 100644 index 00000000..35f16cc6 --- /dev/null +++ b/assets/public/a8a4727cf2dc2939bd3c657fad4463fa.png Binary files differdiff --git a/assets/public/3c6ccb83716d1e4fb91d3082f6b21d77.png b/assets/public/addd2f3268df46459e1d6012ad8e75bd.png index 62c599a7..62c599a7 100644 --- a/assets/public/3c6ccb83716d1e4fb91d3082f6b21d77.png +++ b/assets/public/addd2f3268df46459e1d6012ad8e75bd.png Binary files differdiff --git a/assets/public/4c1b599b1ef5b9f1874fdb9933f3e03b.png b/assets/public/c4e0c8300fa491d94acfd2a1fb26cea8.png index bd7afef2..bd7afef2 100644 --- a/assets/public/4c1b599b1ef5b9f1874fdb9933f3e03b.png +++ b/assets/public/c4e0c8300fa491d94acfd2a1fb26cea8.png Binary files differdiff --git a/assets/public/c09a43a372ba81e3018c3151d4ed4773.png b/assets/public/e56a89224be0b2b1f7c04eca975be468.png index 67ee7bbd..67ee7bbd 100644 --- a/assets/public/c09a43a372ba81e3018c3151d4ed4773.png +++ b/assets/public/e56a89224be0b2b1f7c04eca975be468.png Binary files differdiff --git a/assets/public/fac7e78de9753d4a37083bba74c1d9ef.png b/assets/public/fac7e78de9753d4a37083bba74c1d9ef.png new file mode 100644 index 00000000..78b66c7e --- /dev/null +++ b/assets/public/fac7e78de9753d4a37083bba74c1d9ef.png Binary files differdiff --git a/env-vars.md b/env-vars.md deleted file mode 100644 index 42e8a027..00000000 --- a/env-vars.md +++ /dev/null @@ -1,15 +0,0 @@ -# Fosscord env vars: - -| Name | Value | Description | -| ---------------- | -------------- | --------------------------------------------------------------- | -| THREADS | number | Number of threads to run Fosscord on when using bundle. | -| PORT | number | Port to listen on | -| DATABASE | string | Database connection string. Defaults to SQlite3 at project root | -| CONFIG_PATH | string | File path for JSON config, if not using `config` db table | -| WS_LOGEVENTS | boolean | If set, log websocket events from gateway | -| CDN | string | Lowest priority value for public CDN annoucements | -| GATEWAY | string | Lowest priority value for public gateway annoucements | -| STORAGE_LOCATION | string | CDN storage location. File path or S3 bucktet | -| STORAGE_PROVIDER | "s3" or "file" | CDN storage provider | -| STORAGE_BUCKET | string | S3 bucket name | -| STORAGE_REGION | string | S3 storage region | diff --git a/package-lock.json b/package-lock.json index 10eece39..8927001f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,6 +46,7 @@ "probe-image-size": "^7.2.3", "proxy-agent": "^5.0.0", "reflect-metadata": "^0.1.13", + "sqlite3": "^5.1.5", "ts-node": "^10.9.1", "tslib": "^2.4.1", "typeorm": "^0.3.10", @@ -84,7 +85,7 @@ "nodemailer-mailgun-transport": "^2.1.5", "nodemailer-mailjet-transport": "github:n0script22/nodemailer-mailjet-transport", "nodemailer-sendgrid-transport": "github:Maria-Golomb/nodemailer-sendgrid-transport", - "sqlite3": "^5.1.4" + "sqlite3": "^5.1.5" } }, "node_modules/@acuminous/bitsyntax": { @@ -7077,9 +7078,9 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, "node_modules/sqlite3": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.1.4.tgz", - "integrity": "sha512-i0UlWAzPlzX3B5XP2cYuhWQJsTtlMD6obOa1PgeEQ4DHEXUuyJkgv50I3isqZAP5oFc2T8OFvakmDh2W6I+YpA==", + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.1.5.tgz", + "integrity": "sha512-7sP16i4wI+yKnGOO2q2ijze7EjQ9US+Vw7DYYwxfFtqNZDGgBcEw0oeDaDvUTq66uJOzVd/z6MkIg+c9erSJKg==", "hasInstallScript": true, "optional": true, "dependencies": { @@ -13560,9 +13561,9 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, "sqlite3": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.1.4.tgz", - "integrity": "sha512-i0UlWAzPlzX3B5XP2cYuhWQJsTtlMD6obOa1PgeEQ4DHEXUuyJkgv50I3isqZAP5oFc2T8OFvakmDh2W6I+YpA==", + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.1.5.tgz", + "integrity": "sha512-7sP16i4wI+yKnGOO2q2ijze7EjQ9US+Vw7DYYwxfFtqNZDGgBcEw0oeDaDvUTq66uJOzVd/z6MkIg+c9erSJKg==", "optional": true, "requires": { "@mapbox/node-pre-gyp": "^1.0.0", diff --git a/package.json b/package.json index 85039e60..99a0f2d3 100644 --- a/package.json +++ b/package.json @@ -118,6 +118,6 @@ "nodemailer-mailgun-transport": "^2.1.5", "nodemailer-mailjet-transport": "github:n0script22/nodemailer-mailjet-transport", "nodemailer-sendgrid-transport": "github:Maria-Golomb/nodemailer-sendgrid-transport", - "sqlite3": "^5.1.4" + "sqlite3": "^5.1.5" } } diff --git a/src/api/Server.ts b/src/api/Server.ts index dbe61444..6ec531e0 100644 --- a/src/api/Server.ts +++ b/src/api/Server.ts @@ -135,7 +135,9 @@ export class FosscordServer extends Server { app.use("/api/v9", api); app.use("/api", api); // allow unversioned requests - app.get("/", express.static(PUBLIC_ASSETS_FOLDER)); + app.get("/", (req, res) => + res.sendFile(path.join(PUBLIC_ASSETS_FOLDER, "index.html")), + ); this.app.use(ErrorHandler); diff --git a/src/cdn/routes/embed.ts b/src/cdn/routes/embed.ts index fd13d215..d49d69f7 100644 --- a/src/cdn/routes/embed.ts +++ b/src/cdn/routes/embed.ts @@ -23,12 +23,23 @@ import { HTTPError } from "lambert-server"; import { join } from "path"; const defaultAvatarHashMap = new Map([ - ["0", "1f0bfc0865d324c2587920a7d80c609b"], - ["1", "c09a43a372ba81e3018c3151d4ed4773"], - ["2", "7c8f476123d28d103efe381543274c25"], - ["3", "6f26ddd1bf59740c536d2274bb834a05"], - ["4", "3c6ccb83716d1e4fb91d3082f6b21d77"], - ["5", "4c1b599b1ef5b9f1874fdb9933f3e03b"], + ["0", "823a3de61c4dc2415cc4dbc38fca4299"], + ["1", "e56a89224be0b2b1f7c04eca975be468"], + ["2", "0c8138dcc0dfe2689cdd73f7952c2475"], + ["3", "5ac2728593bb455250d11b848a0c36c6"], + ["4", "addd2f3268df46459e1d6012ad8e75bd"], + ["5", "c4e0c8300fa491d94acfd2a1fb26cea8"], +]); + +const defaultGroupDMAvatarHashMap = new Map([ + ["0", "3b70bb66089c60f8be5e214bf8574c9d"], + ["1", "9581acd31832465bdeaa5385b0e919a3"], + ["2", "a8a4727cf2dc2939bd3c657fad4463fa"], + ["3", "2e46fe14586f8e95471c0917f56726b5"], + ["4", "fac7e78de9753d4a37083bba74c1d9ef"], + ["5", "4ab900144b0865430dc9be825c838faa"], + ["6", "1276374a404452756f3c9cc2601508a5"], + ["7", "904bf9f1b61f53ef4a3b7a893afeabe3"], ]); const router = Router(); @@ -64,4 +75,21 @@ router.get("/avatars/:id", async (req: Request, res: Response) => { return res.send(file); }); +router.get("/group-avatars/:id", async (req: Request, res: Response) => { + let { id } = req.params; + 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 file = await getFile(path); + if (!file) throw new HTTPError("not found", 404); + const type = await FileType.fromBuffer(file); + + res.set("Content-Type", type?.mime); + res.set("Cache-Control", "public, max-age=31536000"); + + return res.send(file); +}); + export default router; |