🐛 fix CDN

This commit is contained in:
Flam3rboy 2021-05-10 18:04:02 +02:00
parent dd87cf1dba
commit fdaa277935
4 changed files with 93 additions and 1156 deletions

1221
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,12 @@
{ {
"name": "discord-cdn", "name": "@fosscord/cdn",
"version": "1.0.0", "version": "1.0.0",
"description": "cdn for discord clone", "description": "cdn for discord clone",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc -b .",
"start": "npm run build && node dist/"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -23,18 +25,19 @@
"cheerio": "^1.0.0-rc.5", "cheerio": "^1.0.0-rc.5",
"express": "^4.17.1", "express": "^4.17.1",
"express-async-errors": "^3.1.1", "express-async-errors": "^3.1.1",
"lambert-db": "^1.0.5", "lambert-db": "^1.2.3",
"lambert-server": "^1.0.3", "lambert-server": "^1.2.1",
"missing-native-js-functions": "^1.0.8", "missing-native-js-functions": "^1.0.8",
"multer": "^1.4.2", "multer": "^1.4.2",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"uuid": "^8.3.2" "uuid": "^8.3.2"
}, },
"devDependencies": { "devDependencies": {
"@types/body-parser": "^1.19.0",
"@types/btoa": "^1.2.3", "@types/btoa": "^1.2.3",
"@types/express": "^4.17.9", "@types/express": "^4.17.11",
"@types/multer": "^1.4.5", "@types/multer": "^1.4.5",
"@types/node": "^14.14.16", "@types/node": "^14.14.43",
"@types/node-fetch": "^2.5.7", "@types/node-fetch": "^2.5.7",
"@types/uuid": "^8.3.0" "@types/uuid": "^8.3.0"
} }

View File

@ -22,7 +22,7 @@ export class CDNServer extends Server {
db: Database; db: Database;
public options: CDNServerOptions; public options: CDNServerOptions;
constructor(options: CDNServerOptions) { constructor(options: Partial<CDNServerOptions>) {
super(options); super(options);
this.db = new MongoDatabase(options?.db); this.db = new MongoDatabase(options?.db);

View File

@ -1,14 +1,9 @@
import { Server } from "./Server"; import { CDNServer } from "./Server";
const server = new Server(); const server = new CDNServer({ db: "" });
server server
.init() .start()
.then(() => { .then(() => {
console.log("[Server] started on :" + server.options.port); console.log("[Server] started on :" + server.options.port);
}) })
.catch((e) => console.error("[Server] Error starting: ", e)); .catch((e) => console.error("[Server] Error starting: ", e));
//// server
//// .destroy()
//// .then(() => console.log("[Server] closed."))
//// .catch((e) => console.log("[Server] Error closing: ", e));