summary refs log tree commit diff
path: root/cdn
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-13 12:59:59 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-13 12:59:59 +0200
commit3715807cf7bc1745dc76c735bf7f4006faff350e (patch)
tree3d2b38a2c0889a6e5019c06ad150711237dff48f /cdn
parent:sparkles: server bundle (diff)
downloadserver-3715807cf7bc1745dc76c735bf7f4006faff350e.tar.xz
rename @fosscord/server-util to -> @fosscord/util
Diffstat (limited to 'cdn')
-rw-r--r--cdn/package-lock.json50
-rw-r--r--cdn/package.json3
-rw-r--r--cdn/src/Server.ts24
-rw-r--r--cdn/src/routes/attachments.ts2
-rw-r--r--cdn/src/routes/avatars.ts2
-rw-r--r--cdn/src/routes/external.ts2
6 files changed, 67 insertions, 16 deletions
diff --git a/cdn/package-lock.json b/cdn/package-lock.json
index 6a51d710..0c87d5c3 100644
--- a/cdn/package-lock.json
+++ b/cdn/package-lock.json
@@ -7,9 +7,11 @@
 		"": {
 			"name": "@fosscord/cdn",
 			"version": "1.0.0",
+			"hasInstallScript": true,
 			"license": "ISC",
 			"dependencies": {
 				"@fosscord/server-util": "^1.3.42",
+				"@fosscord/util": "file:../util",
 				"body-parser": "^1.19.0",
 				"btoa": "^1.2.1",
 				"cheerio": "^1.0.0-rc.5",
@@ -39,6 +41,30 @@
 				"@types/uuid": "^8.3.0"
 			}
 		},
+		"../util": {
+			"name": "@fosscord/util",
+			"version": "1.3.52",
+			"license": "GPLV3",
+			"dependencies": {
+				"@types/jsonwebtoken": "^8.5.0",
+				"@types/mongoose-autopopulate": "^0.10.1",
+				"@types/mongoose-lean-virtuals": "^0.5.1",
+				"@types/node": "^14.14.25",
+				"ajv": "^8.5.0",
+				"amqplib": "^0.8.0",
+				"dot-prop": "^6.0.1",
+				"env-paths": "^2.2.1",
+				"jsonwebtoken": "^8.5.1",
+				"missing-native-js-functions": "^1.2.2",
+				"mongodb": "^3.6.9",
+				"mongoose": "^5.13.7",
+				"mongoose-autopopulate": "^0.12.3",
+				"typescript": "^4.1.3"
+			},
+			"devDependencies": {
+				"@types/amqplib": "^0.8.1"
+			}
+		},
 		"node_modules/@fosscord/server-util": {
 			"version": "1.3.42",
 			"resolved": "https://registry.npmjs.org/@fosscord/server-util/-/server-util-1.3.42.tgz",
@@ -59,6 +85,10 @@
 				"typescript": "^4.1.3"
 			}
 		},
+		"node_modules/@fosscord/util": {
+			"resolved": "../util",
+			"link": true
+		},
 		"node_modules/@tokenizer/token": {
 			"version": "0.1.1",
 			"resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.1.1.tgz",
@@ -1963,6 +1993,26 @@
 				"typescript": "^4.1.3"
 			}
 		},
+		"@fosscord/util": {
+			"version": "file:../util",
+			"requires": {
+				"@types/amqplib": "^0.8.1",
+				"@types/jsonwebtoken": "^8.5.0",
+				"@types/mongoose-autopopulate": "^0.10.1",
+				"@types/mongoose-lean-virtuals": "^0.5.1",
+				"@types/node": "^14.14.25",
+				"ajv": "^8.5.0",
+				"amqplib": "^0.8.0",
+				"dot-prop": "^6.0.1",
+				"env-paths": "^2.2.1",
+				"jsonwebtoken": "^8.5.1",
+				"missing-native-js-functions": "^1.2.2",
+				"mongodb": "^3.6.9",
+				"mongoose": "^5.13.7",
+				"mongoose-autopopulate": "^0.12.3",
+				"typescript": "^4.1.3"
+			}
+		},
 		"@tokenizer/token": {
 			"version": "0.1.1",
 			"resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.1.1.tgz",
diff --git a/cdn/package.json b/cdn/package.json
index bb7e7488..26f62b2c 100644
--- a/cdn/package.json
+++ b/cdn/package.json
@@ -5,6 +5,8 @@
 	"main": "dist/index.js",
 	"types": "dist/index.d.ts",
 	"scripts": {
+		"link": "npm run build && npm link",
+		"postinstall": "npm run --prefix ../util/ link && npm link @fosscord/util && npm run link",
 		"test": "echo \"Error: no test specified\" && exit 1",
 		"build": "tsc -b .",
 		"start": "npm run build && node dist/start.js"
@@ -22,6 +24,7 @@
 	"homepage": "https://github.com/discord-open-source/discord-cdn#readme",
 	"dependencies": {
 		"@fosscord/server-util": "^1.3.42",
+		"@fosscord/util": "file:../util",
 		"body-parser": "^1.19.0",
 		"btoa": "^1.2.1",
 		"cheerio": "^1.0.0-rc.5",
diff --git a/cdn/src/Server.ts b/cdn/src/Server.ts
index 1b79b037..a73a948c 100644
--- a/cdn/src/Server.ts
+++ b/cdn/src/Server.ts
@@ -1,5 +1,5 @@
 import { Server, ServerOptions } from "lambert-server";
-import { Config, db } from "@fosscord/server-util";
+import { Config, db } from "@fosscord/util";
 import path from "path";
 import avatarsRoute from "./routes/avatars";
 
@@ -13,11 +13,9 @@ export class CDNServer extends Server {
 	}
 
 	async start() {
-		console.log("[Database] connecting ...");
 		// @ts-ignore
 		await (db as Promise<Connection>);
 		await Config.init();
-		console.log("[Database] connected");
 		this.app.use((req, res, next) => {
 			res.set("Access-Control-Allow-Origin", "*");
 			// TODO: use better CSP policy
@@ -33,31 +31,31 @@ export class CDNServer extends Server {
 		await this.registerRoutes(path.join(__dirname, "routes/"));
 
 		this.app.use("/icons/", avatarsRoute);
-		this.log("info", "[Server] Route /icons registered");
+		this.log("verbose", "[Server] Route /icons registered");
 
 		this.app.use("/emojis/", avatarsRoute);
-		this.log("info", "[Server] Route /emojis registered");
+		this.log("verbose", "[Server] Route /emojis registered");
 
 		this.app.use("/stickers/", avatarsRoute);
-		this.log("info", "[Server] Route /stickers registered");
+		this.log("verbose", "[Server] Route /stickers registered");
 
 		this.app.use("/banners/", avatarsRoute);
-		this.log("info", "[Server] Route /banners registered");
-		
+		this.log("verbose", "[Server] Route /banners registered");
+
 		this.app.use("/splashes/", avatarsRoute);
-		this.log("info", "[Server] Route /splashes registered");
+		this.log("verbose", "[Server] Route /splashes registered");
 
 		this.app.use("/app-icons/", avatarsRoute);
-		this.log("info", "[Server] Route /app-icons registered");
+		this.log("verbose", "[Server] Route /app-icons registered");
 
 		this.app.use("/app-assets/", avatarsRoute);
-		this.log("info", "[Server] Route /app-assets registered");
+		this.log("verbose", "[Server] Route /app-assets registered");
 
 		this.app.use("/discover-splashes/", avatarsRoute);
-		this.log("info", "[Server] Route /discover-splashes registered");
+		this.log("verbose", "[Server] Route /discover-splashes registered");
 
 		this.app.use("/team-icons/", avatarsRoute);
-		this.log("info", "[Server] Route /team-icons registered");
+		this.log("verbose", "[Server] Route /team-icons registered");
 
 		return super.start();
 	}
diff --git a/cdn/src/routes/attachments.ts b/cdn/src/routes/attachments.ts
index c387aa37..6ce64ed4 100644
--- a/cdn/src/routes/attachments.ts
+++ b/cdn/src/routes/attachments.ts
@@ -1,5 +1,5 @@
 import { Router, Response, Request } from "express";
-import { Config, Snowflake } from "@fosscord/server-util";
+import { Config, Snowflake } from "@fosscord/util";
 import { storage } from "../util/Storage";
 import FileType from "file-type";
 import { HTTPError } from "lambert-server";
diff --git a/cdn/src/routes/avatars.ts b/cdn/src/routes/avatars.ts
index 60befe2c..03388afc 100644
--- a/cdn/src/routes/avatars.ts
+++ b/cdn/src/routes/avatars.ts
@@ -1,5 +1,5 @@
 import { Router, Response, Request } from "express";
-import { Config, Snowflake } from "@fosscord/server-util";
+import { Config, Snowflake } from "@fosscord/util";
 import { storage } from "../util/Storage";
 import FileType from "file-type";
 import { HTTPError } from "lambert-server";
diff --git a/cdn/src/routes/external.ts b/cdn/src/routes/external.ts
index 3abe9c22..625b6bbd 100644
--- a/cdn/src/routes/external.ts
+++ b/cdn/src/routes/external.ts
@@ -4,7 +4,7 @@ import { Router, Response, Request } from "express";
 import fetch from "node-fetch";
 import crypto from "crypto";
 import { HTTPError } from "lambert-server";
-import { Snowflake } from "@fosscord/server-util";
+import { Snowflake } from "@fosscord/util";
 import { storage } from "../util/Storage";
 
 const router = Router();