diff --git a/.gitignore b/.gitignore
index a2ee62f..ee2d139 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
node_modules/
build/
-bundle/
+combined.ts
tHMM.ds
server-stats.log
-config.json
\ No newline at end of file
+config.json
diff --git a/Binato.ts b/Binato.ts
index 96d0f60..395d8d8 100644
--- a/Binato.ts
+++ b/Binato.ts
@@ -8,65 +8,54 @@ if (!existsSync("./config.json")) {
process.exit(1);
}
-import { ChatHistory } from "./server/ChatHistory";
-import { Config } from "./server/interfaces/Config";
-import compression from "compression";
-import express from "express";
-import { HandleRequest } from "./server/BanchoServer";
-import { Shared } from "./server/objects/Shared";
+import ChatHistory from "./server/ChatHistory";
+import Config from "./server/interfaces/Config";
+import HandleRequest from "./server/BanchoServer";
import { Registry, collectDefaultMetrics } from "prom-client";
+import http from "http";
const config:Config = JSON.parse(readFileSync(__dirname + "/config.json").toString()) as Config;
-const binatoApp:express.Application = express();
-
if (config["prometheus"]["enabled"]) {
const register:Registry = new Registry();
register.setDefaultLabels({ app: "nodejs_binato" });
collectDefaultMetrics({ register });
- const prometheusApp:express.Application = express();
- prometheusApp.get("/metrics", async (req, res) => {
- res.end(await register.metrics());
+ const prometheusServer = http.createServer(async (req, res) => {
+ if (req.method === "GET") {
+ res.end(await register.metrics());
+ }
});
- prometheusApp.listen(config["prometheus"]["port"], () => ConsoleHelper.printInfo(`Prometheus metrics listening at port ${config["prometheus"]["port"]}`));
+ prometheusServer.listen(config["prometheus"]["port"], () => ConsoleHelper.printInfo(`Prometheus metrics listening at port ${config["prometheus"]["port"]}`));
} else {
ConsoleHelper.printWarn("Prometheus is disabled!");
}
-if (config["express"]["compression"]) {
- binatoApp.use(compression());
- ConsoleHelper.printInfo("Compression is enabled");
-} else {
- ConsoleHelper.printWarn("Compression is disabled");
-}
-
const INDEX_PAGE:string = readFileSync("./web/serverPage.html").toString();
-binatoApp.use((req, res) => {
+const binatoServer = http.createServer((req, res) => {
let packet:Buffer = Buffer.alloc(0);
req.on("data", (chunk:Buffer) => packet = Buffer.concat([packet, chunk], packet.length + chunk.length));
req.on("end", () => {
switch (req.method) {
case "GET":
if (req.url == "/" || req.url == "/index.html" || req.url == "/index") {
- res.send(INDEX_PAGE);
+ res.end(INDEX_PAGE);
} else if (req.url == "/chat") {
// I don't think this works??
- res.send(ChatHistory.GenerateForWeb());
+ res.end(ChatHistory.GenerateForWeb());
}
- break;
-
+ break;
case "POST":
HandleRequest(req, res, packet);
- break;
-
+ break;
default:
- res.status(405).send("405 | Method not allowed!
Binato");
- break;
+ res.writeHead(405);
+ res.end("Method not allowed");
+ break;
}
});
});
-binatoApp.listen(config.express.port, () => ConsoleHelper.printInfo(`Binato is up! Listening at port ${config.express.port}`));
\ No newline at end of file
+binatoServer.listen(config.http.port, () => ConsoleHelper.printInfo(`Binato is up! Listening at port ${config.http.port}`));
\ No newline at end of file
diff --git a/Constants.ts b/Constants.ts
index 0a02477..bd42a58 100644
--- a/Constants.ts
+++ b/Constants.ts
@@ -1,4 +1,4 @@
-export abstract class Constants {
+export default abstract class Constants {
public static readonly DEBUG = false;
public static readonly PROTOCOL_VERSION = 19;
}
\ No newline at end of file
diff --git a/osuTyping.ts b/osuTyping.ts
index 543f420..496f0a0 100644
--- a/osuTyping.ts
+++ b/osuTyping.ts
@@ -1,9 +1,8 @@
-import { OsuPacketWriter } from "./server/interfaces/OsuPacketWriter";
+import OsuPacketWriter from "./server/interfaces/OsuPacketWriter";
-// Dummy file
const nodeOsu = require("osu-packet");
-export abstract class osu {
+export default abstract class osu {
static Bancho = {
Writer: function() : OsuPacketWriter {
return new nodeOsu.Bancho.Writer();
diff --git a/package-lock.json b/package-lock.json
index 2ca3eb0..de9e4c7 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,26 +10,22 @@
"license": "MIT",
"dependencies": {
"aes256": "^1.1.0",
- "compression": "^1.7.4",
"dyetty": "^1.0.1",
- "express": "^4.18.2",
- "mysql2": "^3.6.0",
- "node-fetch": "^2.6.13",
+ "mysql2": "^3.6.1",
+ "node-fetch": "^2.7.0",
"osu-packet": "^4.1.2",
"prom-client": "^14.2.0",
- "redis": "^4.6.7"
+ "redis": "^4.6.8"
},
"devDependencies": {
- "@types/compression": "^1.7.2",
- "@types/express": "^4.17.17",
- "@types/node": "^20.5.1",
+ "@types/node": "^20.6.0",
"@types/node-fetch": "^2.6.4",
"check-outdated": "^2.12.0",
"nodemon": "^3.0.1",
"npm-run-all": "^4.1.5",
"ts-loader": "^9.4.4",
"ts-node": "^10.9.1",
- "typescript": "^5.1.6"
+ "typescript": "^5.2.2"
}
},
"node_modules/@cspotcode/source-map-support": {
@@ -114,9 +110,9 @@
}
},
"node_modules/@redis/client": {
- "version": "1.5.8",
- "resolved": "https://registry.npmjs.org/@redis/client/-/client-1.5.8.tgz",
- "integrity": "sha512-xzElwHIO6rBAqzPeVnCzgvrnBEcFL1P0w8P65VNLRkdVW8rOE58f52hdj0BDgmsdOm4f1EoXPZtH4Fh7M/qUpw==",
+ "version": "1.5.9",
+ "resolved": "https://registry.npmjs.org/@redis/client/-/client-1.5.9.tgz",
+ "integrity": "sha512-SffgN+P1zdWJWSXBvJeynvEnmnZrYmtKSRW00xl8pOPFOMJjxRR9u0frSxJpPR6Y4V+k54blJjGW7FgxbTI7bQ==",
"dependencies": {
"cluster-key-slot": "1.1.2",
"generic-pool": "3.9.0",
@@ -151,9 +147,9 @@
}
},
"node_modules/@redis/time-series": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-1.0.4.tgz",
- "integrity": "sha512-ThUIgo2U/g7cCuZavucQTQzA9g9JbDDY2f64u3AbAoz/8vE2lt2U37LamDUVChhaDA3IRT9R6VvJwqnUfTJzng==",
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-1.0.5.tgz",
+ "integrity": "sha512-IFjIgTusQym2B5IZJG3XKr5llka7ey84fw/NOYqESP5WUfQs9zz1ww/9+qoz4ka/S6KcGBodzlCeZ5UImKbscg==",
"peerDependencies": {
"@redis/client": "^1.0.0"
}
@@ -182,34 +178,6 @@
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
"dev": true
},
- "node_modules/@types/body-parser": {
- "version": "1.19.2",
- "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz",
- "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==",
- "dev": true,
- "dependencies": {
- "@types/connect": "*",
- "@types/node": "*"
- }
- },
- "node_modules/@types/compression": {
- "version": "1.7.2",
- "resolved": "https://registry.npmjs.org/@types/compression/-/compression-1.7.2.tgz",
- "integrity": "sha512-lwEL4M/uAGWngWFLSG87ZDr2kLrbuR8p7X+QZB1OQlT+qkHsCPDVFnHPyXf4Vyl4yDDorNY+mAhosxkCvppatg==",
- "dev": true,
- "dependencies": {
- "@types/express": "*"
- }
- },
- "node_modules/@types/connect": {
- "version": "3.4.35",
- "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
- "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==",
- "dev": true,
- "dependencies": {
- "@types/node": "*"
- }
- },
"node_modules/@types/eslint": {
"version": "8.44.2",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.2.tgz",
@@ -239,36 +207,6 @@
"dev": true,
"peer": true
},
- "node_modules/@types/express": {
- "version": "4.17.17",
- "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz",
- "integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==",
- "dev": true,
- "dependencies": {
- "@types/body-parser": "*",
- "@types/express-serve-static-core": "^4.17.33",
- "@types/qs": "*",
- "@types/serve-static": "*"
- }
- },
- "node_modules/@types/express-serve-static-core": {
- "version": "4.17.35",
- "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.35.tgz",
- "integrity": "sha512-wALWQwrgiB2AWTT91CB62b6Yt0sNHpznUXeZEcnPU3DRdlDIz74x8Qg1UUYKSVFi+va5vKOLYRBI1bRKiLLKIg==",
- "dev": true,
- "dependencies": {
- "@types/node": "*",
- "@types/qs": "*",
- "@types/range-parser": "*",
- "@types/send": "*"
- }
- },
- "node_modules/@types/http-errors": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.1.tgz",
- "integrity": "sha512-/K3ds8TRAfBvi5vfjuz8y6+GiAYBZ0x4tXv1Av6CWBWn0IlADc+ZX9pMq7oU0fNQPnBwIZl3rmeLp6SBApbxSQ==",
- "dev": true
- },
"node_modules/@types/json-schema": {
"version": "7.0.12",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz",
@@ -276,16 +214,10 @@
"dev": true,
"peer": true
},
- "node_modules/@types/mime": {
- "version": "1.3.2",
- "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz",
- "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==",
- "dev": true
- },
"node_modules/@types/node": {
- "version": "20.5.1",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.1.tgz",
- "integrity": "sha512-4tT2UrL5LBqDwoed9wZ6N3umC4Yhz3W3FloMmiiG4JwmUJWpie0c7lcnUNd4gtMKuDEO4wRVS8B6Xa0uMRsMKg==",
+ "version": "20.6.0",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.0.tgz",
+ "integrity": "sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==",
"dev": true
},
"node_modules/@types/node-fetch": {
@@ -298,39 +230,6 @@
"form-data": "^3.0.0"
}
},
- "node_modules/@types/qs": {
- "version": "6.9.7",
- "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
- "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==",
- "dev": true
- },
- "node_modules/@types/range-parser": {
- "version": "1.2.4",
- "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz",
- "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==",
- "dev": true
- },
- "node_modules/@types/send": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.1.tgz",
- "integrity": "sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==",
- "dev": true,
- "dependencies": {
- "@types/mime": "^1",
- "@types/node": "*"
- }
- },
- "node_modules/@types/serve-static": {
- "version": "1.15.2",
- "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.2.tgz",
- "integrity": "sha512-J2LqtvFYCzaj8pVYKw8klQXrLLk7TBZmQ4ShlcdkELFKGwGMfevMLneMMRkMgZxotOD9wg497LpC7O8PcvAmfw==",
- "dev": true,
- "dependencies": {
- "@types/http-errors": "*",
- "@types/mime": "*",
- "@types/node": "*"
- }
- },
"node_modules/@webassemblyjs/ast": {
"version": "1.11.6",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz",
@@ -512,18 +411,6 @@
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"dev": true
},
- "node_modules/accepts": {
- "version": "1.3.8",
- "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
- "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
- "dependencies": {
- "mime-types": "~2.1.34",
- "negotiator": "0.6.3"
- },
- "engines": {
- "node": ">= 0.6"
- }
- },
"node_modules/acorn": {
"version": "8.10.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz",
@@ -631,11 +518,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/array-flatten": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
- "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
- },
"node_modules/arraybuffer.prototype.slice": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.1.tgz",
@@ -694,37 +576,6 @@
"resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz",
"integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw=="
},
- "node_modules/body-parser": {
- "version": "1.20.1",
- "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
- "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
- "dependencies": {
- "bytes": "3.1.2",
- "content-type": "~1.0.4",
- "debug": "2.6.9",
- "depd": "2.0.0",
- "destroy": "1.2.0",
- "http-errors": "2.0.0",
- "iconv-lite": "0.4.24",
- "on-finished": "2.4.1",
- "qs": "6.11.0",
- "raw-body": "2.5.1",
- "type-is": "~1.6.18",
- "unpipe": "1.0.0"
- },
- "engines": {
- "node": ">= 0.8",
- "npm": "1.2.8000 || >= 1.4.16"
- }
- },
- "node_modules/body-parser/node_modules/bytes": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
- "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
- "engines": {
- "node": ">= 0.8"
- }
- },
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@@ -787,18 +638,11 @@
"dev": true,
"peer": true
},
- "node_modules/bytes": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
- "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==",
- "engines": {
- "node": ">= 0.8"
- }
- },
"node_modules/call-bind": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
+ "dev": true,
"dependencies": {
"function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2"
@@ -933,91 +777,12 @@
"dev": true,
"peer": true
},
- "node_modules/compressible": {
- "version": "2.0.18",
- "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz",
- "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==",
- "dependencies": {
- "mime-db": ">= 1.43.0 < 2"
- },
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/compression": {
- "version": "1.7.4",
- "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz",
- "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==",
- "dependencies": {
- "accepts": "~1.3.5",
- "bytes": "3.0.0",
- "compressible": "~2.0.16",
- "debug": "2.6.9",
- "on-headers": "~1.0.2",
- "safe-buffer": "5.1.2",
- "vary": "~1.1.2"
- },
- "engines": {
- "node": ">= 0.8.0"
- }
- },
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true
},
- "node_modules/content-disposition": {
- "version": "0.5.4",
- "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
- "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
- "dependencies": {
- "safe-buffer": "5.2.1"
- },
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/content-disposition/node_modules/safe-buffer": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
- "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ]
- },
- "node_modules/content-type": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
- "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/cookie": {
- "version": "0.5.0",
- "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
- "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/cookie-signature": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
- "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
- },
"node_modules/create-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
@@ -1049,14 +814,6 @@
"semver": "bin/semver"
}
},
- "node_modules/debug": {
- "version": "2.6.9",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
- "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
- "dependencies": {
- "ms": "2.0.0"
- }
- },
"node_modules/define-properties": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz",
@@ -1090,23 +847,6 @@
"node": ">=0.10"
}
},
- "node_modules/depd": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
- "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/destroy": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
- "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
- "engines": {
- "node": ">= 0.8",
- "npm": "1.2.8000 || >= 1.4.16"
- }
- },
"node_modules/diff": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
@@ -1121,11 +861,6 @@
"resolved": "https://registry.npmjs.org/dyetty/-/dyetty-1.0.1.tgz",
"integrity": "sha512-MQEccirDXkAQf5U1gIwcIz46+vMMEEyAl33nCqOJ7TeCRKgcHTZdG013gmWRWw3Q9wivnJqcJ04ohZnyF8nRew=="
},
- "node_modules/ee-first": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
- "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
- },
"node_modules/electron-to-chromium": {
"version": "1.4.496",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.496.tgz",
@@ -1133,14 +868,6 @@
"dev": true,
"peer": true
},
- "node_modules/encodeurl": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
- "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
- "engines": {
- "node": ">= 0.8"
- }
- },
"node_modules/enhanced-resolve": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz",
@@ -1264,11 +991,6 @@
"node": ">=6"
}
},
- "node_modules/escape-html": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
- "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
- },
"node_modules/escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
@@ -1325,14 +1047,6 @@
"node": ">=4.0"
}
},
- "node_modules/etag": {
- "version": "1.8.1",
- "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
- "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
- "engines": {
- "node": ">= 0.6"
- }
- },
"node_modules/events": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
@@ -1343,66 +1057,6 @@
"node": ">=0.8.x"
}
},
- "node_modules/express": {
- "version": "4.18.2",
- "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
- "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
- "dependencies": {
- "accepts": "~1.3.8",
- "array-flatten": "1.1.1",
- "body-parser": "1.20.1",
- "content-disposition": "0.5.4",
- "content-type": "~1.0.4",
- "cookie": "0.5.0",
- "cookie-signature": "1.0.6",
- "debug": "2.6.9",
- "depd": "2.0.0",
- "encodeurl": "~1.0.2",
- "escape-html": "~1.0.3",
- "etag": "~1.8.1",
- "finalhandler": "1.2.0",
- "fresh": "0.5.2",
- "http-errors": "2.0.0",
- "merge-descriptors": "1.0.1",
- "methods": "~1.1.2",
- "on-finished": "2.4.1",
- "parseurl": "~1.3.3",
- "path-to-regexp": "0.1.7",
- "proxy-addr": "~2.0.7",
- "qs": "6.11.0",
- "range-parser": "~1.2.1",
- "safe-buffer": "5.2.1",
- "send": "0.18.0",
- "serve-static": "1.15.0",
- "setprototypeof": "1.2.0",
- "statuses": "2.0.1",
- "type-is": "~1.6.18",
- "utils-merge": "1.0.1",
- "vary": "~1.1.2"
- },
- "engines": {
- "node": ">= 0.10.0"
- }
- },
- "node_modules/express/node_modules/safe-buffer": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
- "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ]
- },
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@@ -1429,23 +1083,6 @@
"node": ">=8"
}
},
- "node_modules/finalhandler": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
- "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
- "dependencies": {
- "debug": "2.6.9",
- "encodeurl": "~1.0.2",
- "escape-html": "~1.0.3",
- "on-finished": "2.4.1",
- "parseurl": "~1.3.3",
- "statuses": "2.0.1",
- "unpipe": "~1.0.0"
- },
- "engines": {
- "node": ">= 0.8"
- }
- },
"node_modules/for-each": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
@@ -1469,40 +1106,11 @@
"node": ">= 6"
}
},
- "node_modules/forwarded": {
- "version": "0.2.0",
- "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
- "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/fresh": {
- "version": "0.5.2",
- "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
- "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/fsevents": {
- "version": "2.3.2",
- "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
- "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
- "dev": true,
- "hasInstallScript": true,
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
- }
- },
"node_modules/function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
- "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
+ "dev": true
},
"node_modules/function.prototype.name": {
"version": "1.1.5",
@@ -1551,6 +1159,7 @@
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
+ "dev": true,
"dependencies": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
@@ -1633,6 +1242,7 @@
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "dev": true,
"dependencies": {
"function-bind": "^1.1.1"
},
@@ -1674,6 +1284,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
+ "dev": true,
"engines": {
"node": ">= 0.4"
},
@@ -1685,6 +1296,7 @@
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
+ "dev": true,
"engines": {
"node": ">= 0.4"
},
@@ -1713,43 +1325,12 @@
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
"dev": true
},
- "node_modules/http-errors": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
- "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
- "dependencies": {
- "depd": "2.0.0",
- "inherits": "2.0.4",
- "setprototypeof": "1.2.0",
- "statuses": "2.0.1",
- "toidentifier": "1.0.1"
- },
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/iconv-lite": {
- "version": "0.4.24",
- "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
- "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
- "dependencies": {
- "safer-buffer": ">= 2.1.2 < 3"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
"node_modules/ignore-by-default": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
"integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
"dev": true
},
- "node_modules/inherits": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
- "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
- },
"node_modules/internal-slot": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz",
@@ -1764,14 +1345,6 @@
"node": ">= 0.4"
}
},
- "node_modules/ipaddr.js": {
- "version": "1.9.1",
- "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
- "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
- "engines": {
- "node": ">= 0.10"
- }
- },
"node_modules/is-array-buffer": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz",
@@ -2135,14 +1708,6 @@
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
"dev": true
},
- "node_modules/media-typer": {
- "version": "0.3.0",
- "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
- "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
- "engines": {
- "node": ">= 0.6"
- }
- },
"node_modules/memorystream": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz",
@@ -2152,11 +1717,6 @@
"node": ">= 0.10.0"
}
},
- "node_modules/merge-descriptors": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
- "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
- },
"node_modules/merge-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
@@ -2164,14 +1724,6 @@
"dev": true,
"peer": true
},
- "node_modules/methods": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
- "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
- "engines": {
- "node": ">= 0.6"
- }
- },
"node_modules/micromatch": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz",
@@ -2185,21 +1737,11 @@
"node": ">=8.6"
}
},
- "node_modules/mime": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
- "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
- "bin": {
- "mime": "cli.js"
- },
- "engines": {
- "node": ">=4"
- }
- },
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "dev": true,
"engines": {
"node": ">= 0.6"
}
@@ -2208,6 +1750,7 @@
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "dev": true,
"dependencies": {
"mime-db": "1.52.0"
},
@@ -2227,15 +1770,10 @@
"node": "*"
}
},
- "node_modules/ms": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
- "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
- },
"node_modules/mysql2": {
- "version": "3.6.0",
- "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.6.0.tgz",
- "integrity": "sha512-EWUGAhv6SphezurlfI2Fpt0uJEWLmirrtQR7SkbTHFC+4/mJBrPiSzHESHKAWKG7ALVD6xaG/NBjjd1DGJGQQQ==",
+ "version": "3.6.1",
+ "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.6.1.tgz",
+ "integrity": "sha512-O7FXjLtNkjcMBpLURwkXIhyVbX9i4lq4nNRCykPNOXfceq94kJ0miagmTEGCZieuO8JtwtXaZ41U6KT4eF9y3g==",
"dependencies": {
"denque": "^2.1.0",
"generate-function": "^2.3.1",
@@ -2280,14 +1818,6 @@
"node": ">=12"
}
},
- "node_modules/negotiator": {
- "version": "0.6.3",
- "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
- "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
- "engines": {
- "node": ">= 0.6"
- }
- },
"node_modules/neo-async": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
@@ -2302,9 +1832,9 @@
"dev": true
},
"node_modules/node-fetch": {
- "version": "2.6.13",
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.13.tgz",
- "integrity": "sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA==",
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
"dependencies": {
"whatwg-url": "^5.0.0"
},
@@ -2444,6 +1974,7 @@
"version": "1.12.3",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
"integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
+ "dev": true,
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
@@ -2475,25 +2006,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/on-finished": {
- "version": "2.4.1",
- "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
- "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
- "dependencies": {
- "ee-first": "1.1.1"
- },
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/on-headers": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
- "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
- "engines": {
- "node": ">= 0.8"
- }
- },
"node_modules/osu-packet": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/osu-packet/-/osu-packet-4.1.2.tgz",
@@ -2521,14 +2033,6 @@
"node": ">=4"
}
},
- "node_modules/parseurl": {
- "version": "1.3.3",
- "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
- "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
- "engines": {
- "node": ">= 0.8"
- }
- },
"node_modules/path-key": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
@@ -2544,11 +2048,6 @@
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true
},
- "node_modules/path-to-regexp": {
- "version": "0.1.7",
- "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
- "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
- },
"node_modules/path-type": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz",
@@ -2612,18 +2111,6 @@
"node": ">=10"
}
},
- "node_modules/proxy-addr": {
- "version": "2.0.7",
- "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
- "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
- "dependencies": {
- "forwarded": "0.2.0",
- "ipaddr.js": "1.9.1"
- },
- "engines": {
- "node": ">= 0.10"
- }
- },
"node_modules/pstree.remy": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
@@ -2640,20 +2127,6 @@
"node": ">=6"
}
},
- "node_modules/qs": {
- "version": "6.11.0",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
- "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
- "dependencies": {
- "side-channel": "^1.0.4"
- },
- "engines": {
- "node": ">=0.6"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
"node_modules/randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
@@ -2664,36 +2137,6 @@
"safe-buffer": "^5.1.0"
}
},
- "node_modules/range-parser": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
- "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/raw-body": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
- "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
- "dependencies": {
- "bytes": "3.1.2",
- "http-errors": "2.0.0",
- "iconv-lite": "0.4.24",
- "unpipe": "1.0.0"
- },
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/raw-body/node_modules/bytes": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
- "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
- "engines": {
- "node": ">= 0.8"
- }
- },
"node_modules/read-pkg": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
@@ -2721,16 +2164,16 @@
}
},
"node_modules/redis": {
- "version": "4.6.7",
- "resolved": "https://registry.npmjs.org/redis/-/redis-4.6.7.tgz",
- "integrity": "sha512-KrkuNJNpCwRm5vFJh0tteMxW8SaUzkm5fBH7eL5hd/D0fAkzvapxbfGPP/r+4JAXdQuX7nebsBkBqA2RHB7Usw==",
+ "version": "4.6.8",
+ "resolved": "https://registry.npmjs.org/redis/-/redis-4.6.8.tgz",
+ "integrity": "sha512-S7qNkPUYrsofQ0ztWlTHSaK0Qqfl1y+WMIxrzeAGNG+9iUZB4HGeBgkHxE6uJJ6iXrkvLd1RVJ2nvu6H1sAzfQ==",
"dependencies": {
"@redis/bloom": "1.2.0",
- "@redis/client": "1.5.8",
+ "@redis/client": "1.5.9",
"@redis/graph": "1.1.0",
"@redis/json": "1.0.4",
"@redis/search": "1.1.3",
- "@redis/time-series": "1.0.4"
+ "@redis/time-series": "1.0.5"
}
},
"node_modules/regexp.prototype.flags": {
@@ -2788,7 +2231,9 @@
"node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
- "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
+ "dev": true,
+ "peer": true
},
"node_modules/safe-regex-test": {
"version": "1.0.0",
@@ -2855,34 +2300,6 @@
"node": ">=10"
}
},
- "node_modules/send": {
- "version": "0.18.0",
- "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
- "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
- "dependencies": {
- "debug": "2.6.9",
- "depd": "2.0.0",
- "destroy": "1.2.0",
- "encodeurl": "~1.0.2",
- "escape-html": "~1.0.3",
- "etag": "~1.8.1",
- "fresh": "0.5.2",
- "http-errors": "2.0.0",
- "mime": "1.6.0",
- "ms": "2.1.3",
- "on-finished": "2.4.1",
- "range-parser": "~1.2.1",
- "statuses": "2.0.1"
- },
- "engines": {
- "node": ">= 0.8.0"
- }
- },
- "node_modules/send/node_modules/ms": {
- "version": "2.1.3",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
- "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
- },
"node_modules/seq-queue": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz",
@@ -2898,25 +2315,6 @@
"randombytes": "^2.1.0"
}
},
- "node_modules/serve-static": {
- "version": "1.15.0",
- "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
- "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
- "dependencies": {
- "encodeurl": "~1.0.2",
- "escape-html": "~1.0.3",
- "parseurl": "~1.3.3",
- "send": "0.18.0"
- },
- "engines": {
- "node": ">= 0.8.0"
- }
- },
- "node_modules/setprototypeof": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
- "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
- },
"node_modules/shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
@@ -2951,6 +2349,7 @@
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
+ "dev": true,
"dependencies": {
"call-bind": "^1.0.0",
"get-intrinsic": "^1.0.2",
@@ -3033,14 +2432,6 @@
"node": ">= 0.6"
}
},
- "node_modules/statuses": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
- "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
- "engines": {
- "node": ">= 0.8"
- }
- },
"node_modules/string.prototype.padend": {
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.4.tgz",
@@ -3230,14 +2621,6 @@
"node": ">=8.0"
}
},
- "node_modules/toidentifier": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
- "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
- "engines": {
- "node": ">=0.6"
- }
- },
"node_modules/touch": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
@@ -3387,18 +2770,6 @@
}
}
},
- "node_modules/type-is": {
- "version": "1.6.18",
- "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
- "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
- "dependencies": {
- "media-typer": "0.3.0",
- "mime-types": "~2.1.24"
- },
- "engines": {
- "node": ">= 0.6"
- }
- },
"node_modules/typed-array-buffer": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz",
@@ -3465,9 +2836,9 @@
}
},
"node_modules/typescript": {
- "version": "5.1.6",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
- "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
+ "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@@ -3498,14 +2869,6 @@
"integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==",
"dev": true
},
- "node_modules/unpipe": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
- "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
- "engines": {
- "node": ">= 0.8"
- }
- },
"node_modules/update-browserslist-db": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz",
@@ -3547,14 +2910,6 @@
"punycode": "^2.1.0"
}
},
- "node_modules/utils-merge": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
- "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
- "engines": {
- "node": ">= 0.4.0"
- }
- },
"node_modules/v8-compile-cache-lib": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
@@ -3571,14 +2926,6 @@
"spdx-expression-parse": "^3.0.0"
}
},
- "node_modules/vary": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
- "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
- "engines": {
- "node": ">= 0.8"
- }
- },
"node_modules/watchpack": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
diff --git a/package.json b/package.json
index 4f2ba3c..b88d368 100644
--- a/package.json
+++ b/package.json
@@ -18,25 +18,21 @@
"license": "MIT",
"dependencies": {
"aes256": "^1.1.0",
- "compression": "^1.7.4",
"dyetty": "^1.0.1",
- "express": "^4.18.2",
- "mysql2": "^3.6.0",
- "node-fetch": "^2.6.13",
+ "mysql2": "^3.6.1",
+ "node-fetch": "^2.7.0",
"osu-packet": "^4.1.2",
"prom-client": "^14.2.0",
- "redis": "^4.6.7"
+ "redis": "^4.6.8"
},
"devDependencies": {
- "@types/compression": "^1.7.2",
- "@types/express": "^4.17.17",
- "@types/node": "^20.5.1",
+ "@types/node": "^20.6.0",
"@types/node-fetch": "^2.6.4",
"check-outdated": "^2.12.0",
"nodemon": "^3.0.1",
"npm-run-all": "^4.1.5",
"ts-loader": "^9.4.4",
"ts-node": "^10.9.1",
- "typescript": "^5.1.6"
+ "typescript": "^5.2.2"
}
}
diff --git a/server/BanchoServer.ts b/server/BanchoServer.ts
index 55882bd..2a2879b 100644
--- a/server/BanchoServer.ts
+++ b/server/BanchoServer.ts
@@ -1,15 +1,15 @@
+import Channel from "./objects/Channel";
import { ConsoleHelper } from "../ConsoleHelper";
-import { Channel } from "./objects/Channel";
-import { LatLng } from "./objects/LatLng";
-import { LoginProcess } from "./LoginProcess";
+import Constants from "../Constants";
+import LoginProcess from "./LoginProcess";
+import { IncomingMessage, ServerResponse } from "http";
import { Packets } from "./enums/Packets";
import { RedisClientType, createClient } from "redis";
-import { Request, Response } from "express";
-import { SpectatorManager } from "./SpectatorManager";
-import { User } from "./objects/User";
-import { PrivateMessage } from "./packets/PrivateMessage";
-import { MessageData } from "./interfaces/MessageData";
-import { Shared } from "./objects/Shared";
+import MessageData from "./interfaces/MessageData";
+import PrivateMessage from "./packets/PrivateMessage";
+import Shared from "./objects/Shared";
+import SpectatorManager from "./SpectatorManager";
+import osu from "../osuTyping";
const shared:Shared = new Shared();
shared.database.query("UPDATE mp_matches SET close_time = UNIX_TIMESTAMP() WHERE close_time IS NULL");
@@ -55,19 +55,17 @@ if (shared.config.redis.enabled) {
} else ConsoleHelper.printWarn("Redis is disabled!");
// Import packets
-import { ChangeAction } from "./packets/ChangeAction";
-import { Logout } from "./packets/Logout";
-import { UserPresence } from "./packets/UserPresence";
-import { UserStatsRequest } from "./packets/UserStatsRequest";
-import { UserPresenceBundle } from "./packets/UserPresenceBundle";
-import { TourneyMatchSpecialInfo } from "./packets/TourneyMatchSpecialInfo";
-import { osu } from "../osuTyping";
-import { TourneyMatchJoinChannel } from "./packets/TourneyJoinMatchChannel";
-import { TourneyMatchLeaveChannel } from "./packets/TourneyMatchLeaveChannel";
-import { AddFriend } from "./packets/AddFriend";
-import { RemoveFriend } from "./packets/RemoveFriend";
-import { PrivateChannel } from "./objects/PrivateChannel";
-import { Constants } from "../Constants";
+import ChangeAction from "./packets/ChangeAction";
+import Logout from "./packets/Logout";
+import UserPresence from "./packets/UserPresence";
+import UserStatsRequest from "./packets/UserStatsRequest";
+import UserPresenceBundle from "./packets/UserPresenceBundle";
+import TourneyMatchSpecialInfo from "./packets/TourneyMatchSpecialInfo";
+import TourneyMatchJoinChannel from "./packets/TourneyJoinMatchChannel";
+import TourneyMatchLeaveChannel from "./packets/TourneyMatchLeaveChannel";
+import AddFriend from "./packets/AddFriend";
+import RemoveFriend from "./packets/RemoveFriend";
+import PrivateChannel from "./objects/PrivateChannel";
// User timeout interval
setInterval(() => {
@@ -83,30 +81,23 @@ setInterval(() => {
const EMPTY_BUFFER = Buffer.alloc(0);
-export async function HandleRequest(req:Request, res:Response, packet:Buffer) {
+export default async function HandleRequest(req:IncomingMessage, res:ServerResponse, packet:Buffer) {
// Get the client's token string and request data
- const requestTokenString:string | undefined = req.header("osu-token");
+ const requestTokenString = typeof(req.headers["osu-token"]) === "string" ? req.headers["osu-token"] : undefined;
// Check if the user is logged in
- if (requestTokenString == null) {
- // Only do this if we're absolutely sure that we're connected to the DB
- if (shared.database.connected) {
- // Client doesn't have a token yet, let's auth them!
-
- await LoginProcess(req, res, packet, shared);
- shared.database.query("UPDATE osu_info SET value = ? WHERE name = 'online_now'", [shared.users.getLength() - 1]);
- }
+ if (requestTokenString === undefined) {
+ // Client doesn't have a token yet, let's auth them!
+
+ await LoginProcess(req, res, packet, shared);
+ shared.database.query("UPDATE osu_info SET value = ? WHERE name = 'online_now'", [shared.users.getLength() - 1]);
} else {
- let responseData:Buffer | string = EMPTY_BUFFER;
-
- // Remove headers we don't need for Bancho
- res.removeHeader('X-Powered-By');
- res.removeHeader('Date'); // This is not spec compilant
+ let responseData = EMPTY_BUFFER;
// Client has a token, let's see what they want.
try {
// Get the current user
- const PacketUser:User | undefined = shared.users.getByToken(requestTokenString);
+ const PacketUser = shared.users.getByToken(requestTokenString);
// Make sure the client's token isn't invalid
if (PacketUser != null) {
@@ -298,12 +289,12 @@ export async function HandleRequest(req:Request, res:Response, packet:Buffer) {
responseData = PacketUser.queue;
PacketUser.clearQueue();
} else {
- // Only do this if we're absolutely sure that we're connected to the DB
- if (shared.database.connected) {
- // User's token is invlid, force a reconnect
- ConsoleHelper.printBancho(`Forced client re-login (Token is invalid)`);
- responseData = "\u0005\u0000\u0000\u0004\u0000\u0000\u0000����\u0018\u0000\u0000\u0011\u0000\u0000\u0000\u000b\u000fReconnecting...";
- }
+ // User's token is invlid, force a reconnect
+ ConsoleHelper.printBancho(`Forced client re-login (Token is invalid)`);
+ const osuPacketWriter = osu.Bancho.Writer();
+ osuPacketWriter.Announce("Reconnecting...");
+ osuPacketWriter.Restart(0);
+ responseData = osuPacketWriter.toBuffer;
}
} catch (e) {
if (Constants.DEBUG) {
diff --git a/server/Bot.ts b/server/Bot.ts
index c07d41d..24b71ce 100644
--- a/server/Bot.ts
+++ b/server/Bot.ts
@@ -1,16 +1,16 @@
-import { ICommand } from "./interfaces/ICommand";
-import { Channel } from "./objects/Channel";
-import { Shared } from "./objects/Shared";
-import { User } from "./objects/User";
+import ICommand from "./interfaces/ICommand";
+import Channel from "./objects/Channel";
+import Shared from "./objects/Shared";
+import User from "./objects/User";
// Commands
-import { RankingCommand } from "./commands/Ranking";
-import { LockCommand } from "./commands/Lock";
-import { MultiplayerCommands } from "./commands/Multiplayer";
-import { HelpCommand } from "./commands/Help";
-import { RollCommand } from "./commands/RollCommand";
+import RankingCommand from "./commands/Ranking";
+import LockCommand from "./commands/Lock";
+import MultiplayerCommands from "./commands/Multiplayer";
+import HelpCommand from "./commands/Help";
+import RollCommand from "./commands/RollCommand";
-export class Bot {
+export default class Bot {
public user:User;
private commands:{ [id: string]: ICommand } = {};
diff --git a/server/ChatHistory.ts b/server/ChatHistory.ts
index 84397a6..49e2854 100644
--- a/server/ChatHistory.ts
+++ b/server/ChatHistory.ts
@@ -1,6 +1,6 @@
import { readFileSync } from "fs";
-export abstract class ChatHistory {
+export default abstract class ChatHistory {
private static _history:Array = new Array();
private static _lastGeneratedPage:string;
private static _hasChanged:boolean = true;
@@ -8,7 +8,7 @@ export abstract class ChatHistory {
private static readonly PAGE_TEMPLATE = readFileSync("./web/chatPageTemplate.html").toString();
public static AddMessage(message:string) : void {
- if (this._history.length === 10) {
+ if (this._history.length === this.HISTORY_LENGTH) {
this._history.splice(0, 1);
}
@@ -17,14 +17,14 @@ export abstract class ChatHistory {
}
public static GenerateForWeb() : string {
- let lines:string = "", flip:boolean = false;
-
- for (let i:number = Math.max(this._history.length - this.HISTORY_LENGTH, this.HISTORY_LENGTH); i < this._history.length; i++) {
- lines += `${this._history[i] == null ? "blank" : this._history[i]}
`
- flip = !flip;
- }
-
if (this._hasChanged) {
+ let lines = "", flip = false;
+
+ for (let i = 0; i < this.HISTORY_LENGTH; i++) {
+ lines += `${this._history[i] == null ? "blank" : this._history[i].replaceAll("<", "<").replaceAll(">", ">").replaceAll("\n", "
")}
`
+ flip = !flip;
+ }
+
this._lastGeneratedPage = this.PAGE_TEMPLATE.toString().replace("|content|", lines);
this._hasChanged = false;
}
diff --git a/server/ChatManager.ts b/server/ChatManager.ts
index 1a41eb7..6b64502 100644
--- a/server/ChatManager.ts
+++ b/server/ChatManager.ts
@@ -1,12 +1,12 @@
-import { Channel } from "./objects/Channel";
+import Channel from "./objects/Channel";
import { ConsoleHelper } from "../ConsoleHelper";
-import { FunkyArray } from "./objects/FunkyArray";
-import { User } from "./objects/User";
-import { Shared } from "./objects/Shared";
-import { osu } from "../osuTyping";
-import { PrivateChannel } from "./objects/PrivateChannel";
+import FunkyArray from "./objects/FunkyArray";
+import User from "./objects/User";
+import Shared from "./objects/Shared";
+import osu from "../osuTyping";
+import PrivateChannel from "./objects/PrivateChannel";
-export class ChatManager {
+export default class ChatManager {
public chatChannels:FunkyArray = new FunkyArray();
public forceJoinChannels:FunkyArray = new FunkyArray();
private readonly shared:Shared;
diff --git a/server/Country.ts b/server/Country.ts
index 01672fb..c4908f1 100644
--- a/server/Country.ts
+++ b/server/Country.ts
@@ -254,7 +254,7 @@ enum CountryCodes {
const keys = Object.keys(CountryCodes);
const values = Object.values(CountryCodes);
-export function getCountryID(code:string) : number {
+export default function getCountryID(code:string) : number {
// Get id of a country from a 2 char code
const upperCode:string = code.toUpperCase();
if (upperCode in CountryCodes) {
diff --git a/server/LoginProcess.ts b/server/LoginProcess.ts
index bb9e312..28b5fd6 100644
--- a/server/LoginProcess.ts
+++ b/server/LoginProcess.ts
@@ -1,19 +1,19 @@
import { ConsoleHelper } from "../ConsoleHelper";
import fetch from "node-fetch";
-import { getCountryID } from "./Country";
+import getCountryID from "./Country";
import { generateSession } from "./Util";
-import { LatLng } from "./objects/LatLng";
-import { LoginInfo } from "./objects/LoginInfo";
-import { Logout } from "./packets/Logout";
+import LatLng from "./objects/LatLng";
+import LoginInfo from "./objects/LoginInfo";
+import Logout from "./packets/Logout";
import { pbkdf2 } from "crypto";
-import { Request, Response } from "express";
-import { User } from "./objects/User";
-import { UserPresenceBundle } from "./packets/UserPresenceBundle";
-import { UserPresence } from "./packets/UserPresence";
-import { StatusUpdate } from "./packets/StatusUpdate";
-import { Shared } from "./objects/Shared";
-import { osu } from "../osuTyping";
-import { IpZxqResponse } from "./interfaces/IpZxqResponse";
+import User from "./objects/User";
+import UserPresenceBundle from "./packets/UserPresenceBundle";
+import UserPresence from "./packets/UserPresence";
+import StatusUpdate from "./packets/StatusUpdate";
+import Shared from "./objects/Shared";
+import osu from "../osuTyping";
+import IpZxqResponse from "./interfaces/IpZxqResponse";
+import { IncomingMessage, ServerResponse } from "http";
const { decrypt: aesDecrypt } = require("aes256");
const incorrectLoginResponse:Buffer = osu.Bancho.Writer().LoginReply(-1).toBuffer;
@@ -43,7 +43,6 @@ function TestLogin(loginInfo:LoginInfo, shared:Shared) {
// Make sure the username is the same as the login info
if (userDBData.username !== loginInfo.username) return resolve(LoginResult.INCORRECT);
- console.log(userDBData.has_old_password);
switch (userDBData.has_old_password) {
case LoginTypes.CURRENT:
pbkdf2(loginInfo.password, userDBData.password_salt, shared.config.database.pbkdf2.itterations, shared.config.database.pbkdf2.keylength, "sha512", (err, derivedKey) => {
@@ -58,11 +57,9 @@ function TestLogin(loginInfo:LoginInfo, shared:Shared) {
});
break;
case LoginTypes.OLD_AES:
- console.log("OLD AES");
if (aesDecrypt(shared.config.database.key, userDBData.password_hash) !== loginInfo.password) {
return resolve(LoginResult.INCORRECT);
}
- console.log("correct password");
return resolve(LoginResult.MIGRATION);
case LoginTypes.OLD_MD5:
if (userDBData.password_hash !== loginInfo.password) {
@@ -73,7 +70,7 @@ function TestLogin(loginInfo:LoginInfo, shared:Shared) {
});
}
-export async function LoginProcess(req:Request, res:Response, packet:Buffer, shared:Shared) {
+export default async function LoginProcess(req:IncomingMessage, res:ServerResponse, packet:Buffer, shared:Shared) {
const loginStartTime = Date.now();
const loginInfo = LoginInfo.From(packet);
@@ -93,11 +90,11 @@ export async function LoginProcess(req:Request, res:Response, packet:Buffer, sha
// Get users IP for getting location
// Get cloudflare requestee IP first
- let requestIP = req.get("cf-connecting-ip");
+ let requestIP = req.headers["cf-connecting-ip"];
// Get IP of requestee since we are probably behind a reverse proxy
if (requestIP === undefined) {
- requestIP = req.get("X-Real-IP");
+ requestIP = req.headers["X-Real-IP"];
}
// Just get the requestee IP (we are not behind a reverse proxy)
@@ -196,7 +193,7 @@ export async function LoginProcess(req:Request, res:Response, packet:Buffer, sha
osuPacketWriter.Announce(`Welcome back ${loginInfo.username}!`);
// TODO: Remove once merged into master
- osuPacketWriter.Announce("WARNING\nThis is a development test server made for the TypeScript rewrite.\nAnything could happen be it data loss, catastrophic crashes or otherwise.\nHere be dragons.");
+ osuPacketWriter.Announce("Heads up!\nWhile the TypeScript server rewrite is mostly stable it still has some issues.");
} catch (err) {
console.error(err);
}
@@ -208,10 +205,10 @@ export async function LoginProcess(req:Request, res:Response, packet:Buffer, sha
const writerBuffer:Buffer = osuPacketWriter.toBuffer;
if (newUser === undefined) {
res.writeHead(200, {
+ "cho-token": "no",
"Connection": "keep-alive",
"Keep-Alive": "timeout=5, max=100"
});
- console.log(res.headersSent);
switch (loginResult) {
case LoginResult.INCORRECT:
res.end(incorrectLoginResponse, () => {
diff --git a/server/MultiplayerManager.ts b/server/MultiplayerManager.ts
index 2f328c5..d419aea 100644
--- a/server/MultiplayerManager.ts
+++ b/server/MultiplayerManager.ts
@@ -1,18 +1,18 @@
-import { Channel } from "./objects/Channel";
-import { Shared } from "./objects/Shared";
+import Channel from "./objects/Channel";
+import Shared from "./objects/Shared";
import { SlotStatus } from "./enums/SlotStatus";
-import { DataStream } from "./objects/DataStream";
-import { Match } from "./objects/Match";
-import { User } from "./objects/User";
-import { StatusUpdate } from "./packets/StatusUpdate";
-import { UserPresence } from "./packets/UserPresence";
-import { UserPresenceBundle } from "./packets/UserPresenceBundle";
-import { MatchArray } from "./objects/MatchArray";
-import { MatchJoinData } from "./interfaces/MatchJoinData";
-import { MatchData } from "./interfaces/MatchData";
-import { osu } from "../osuTyping";
+import DataStream from "./objects/DataStream";
+import Match from "./objects/Match";
+import User from "./objects/User";
+import StatusUpdate from "./packets/StatusUpdate";
+import UserPresence from "./packets/UserPresence";
+import UserPresenceBundle from "./packets/UserPresenceBundle";
+import MatchArray from "./objects/MatchArray";
+import MatchJoinData from "./interfaces/MatchJoinData";
+import MatchData from "./interfaces/MatchData";
+import osu from "../osuTyping";
-export class MultiplayerManager {
+export default class MultiplayerManager {
private readonly shared:Shared;
private matches:MatchArray = new MatchArray();
private readonly lobbyStream:DataStream;
diff --git a/server/PrivateChatManager.ts b/server/PrivateChatManager.ts
index d5a7978..31961d8 100644
--- a/server/PrivateChatManager.ts
+++ b/server/PrivateChatManager.ts
@@ -1,12 +1,12 @@
-import { Channel } from "./objects/Channel";
+import Channel from "./objects/Channel";
import { ConsoleHelper } from "../ConsoleHelper";
-import { FunkyArray } from "./objects/FunkyArray";
-import { User } from "./objects/User";
-import { Shared } from "./objects/Shared";
-import { osu } from "../osuTyping";
-import { PrivateChannel } from "./objects/PrivateChannel";
+import FunkyArray from "./objects/FunkyArray";
+import User from "./objects/User";
+import Shared from "./objects/Shared";
+import osu from "../osuTyping";
+import PrivateChannel from "./objects/PrivateChannel";
-export class PrivateChatManager {
+export default class PrivateChatManager {
public chatChannels:FunkyArray = new FunkyArray();
private readonly shared:Shared;
diff --git a/server/SpectatorManager.ts b/server/SpectatorManager.ts
index c740b8a..653bc46 100644
--- a/server/SpectatorManager.ts
+++ b/server/SpectatorManager.ts
@@ -1,9 +1,9 @@
-import { DataStream } from "./objects/DataStream";
-import { Shared } from "./objects/Shared";
-import { User } from "./objects/User";
-import { osu } from "../osuTyping";
+import DataStream from "./objects/DataStream";
+import Shared from "./objects/Shared";
+import User from "./objects/User";
+import osu from "../osuTyping";
-export class SpectatorManager {
+export default class SpectatorManager {
private shared:Shared;
public constructor(shared:Shared) {
diff --git a/server/Util.ts b/server/Util.ts
index 8dd792d..2b73109 100644
--- a/server/Util.ts
+++ b/server/Util.ts
@@ -12,10 +12,6 @@ export function generateSession() : Promise {
});
}
-export function generateSessionSync() : string {
- return randomBytes(12).toString("hex");
-}
-
export function hexlify(data:Buffer) : string {
let out:string = "";
for (let i = 0; i < data.length; i++) {
diff --git a/server/commands/BaseCommand.ts b/server/commands/BaseCommand.ts
index 66664a3..709998f 100644
--- a/server/commands/BaseCommand.ts
+++ b/server/commands/BaseCommand.ts
@@ -1,9 +1,9 @@
-import { ICommand } from "../interfaces/ICommand";
-import { Channel } from "../objects/Channel";
-import { Shared } from "../objects/Shared";
-import { User } from "../objects/User";
+import ICommand from "../interfaces/ICommand";
+import Channel from "../objects/Channel";
+import Shared from "../objects/Shared";
+import User from "../objects/User";
-export class BaseCommand implements ICommand {
+export default class BaseCommand implements ICommand {
public shared:Shared;
public readonly helpText:string = "No help page was found for that command";
public readonly helpDescription:string = "Command has no description set";
diff --git a/server/commands/Help.ts b/server/commands/Help.ts
index e14490d..b354c61 100644
--- a/server/commands/Help.ts
+++ b/server/commands/Help.ts
@@ -1,10 +1,10 @@
-import { Channel } from "../objects/Channel";
-import { User } from "../objects/User";
-import { BaseCommand } from "./BaseCommand";
-import { Shared } from "../objects/Shared";
-import { ICommand } from "../interfaces/ICommand";
+import Channel from "../objects/Channel";
+import User from "../objects/User";
+import BaseCommand from "./BaseCommand";
+import Shared from "../objects/Shared";
+import ICommand from "../interfaces/ICommand";
-export class HelpCommand extends BaseCommand {
+export default class HelpCommand extends BaseCommand {
public readonly helpDescription:string = "Shows this message! :)";
private readonly commandList:{ [id:string]: ICommand };
diff --git a/server/commands/Lock.ts b/server/commands/Lock.ts
index fd1650f..e25db53 100644
--- a/server/commands/Lock.ts
+++ b/server/commands/Lock.ts
@@ -1,8 +1,8 @@
-import { Channel } from "../objects/Channel";
-import { User } from "../objects/User";
-import { BaseCommand } from "./BaseCommand";
+import Channel from "../objects/Channel";
+import User from "../objects/User";
+import BaseCommand from "./BaseCommand";
-export class LockCommand extends BaseCommand {
+export default class LockCommand extends BaseCommand {
public readonly helpDescription:string = "Locks/Unlocks a channel and limits conversation to mods and above.";
public exec(channel:Channel, sender:User, args:Array) {
diff --git a/server/commands/Multiplayer.ts b/server/commands/Multiplayer.ts
index 8576d62..75fe862 100644
--- a/server/commands/Multiplayer.ts
+++ b/server/commands/Multiplayer.ts
@@ -1,15 +1,13 @@
-import { Channel } from "../objects/Channel";
-import { User } from "../objects/User";
-import { Match } from "../objects/Match";
-import { BaseCommand } from "./BaseCommand";
+import Channel from "../objects/Channel";
+import User from "../objects/User";
+import Match from "../objects/Match";
+import BaseCommand from "./BaseCommand";
-const helpText = `Multiplayer Subcommands:
+export default class MultiplayerCommands extends BaseCommand {
+ public readonly helpText:string = `Multiplayer Subcommands:
!mp start - Starts a multiplayer match with a delay (optional)
!mp abort - Aborts the currently running round / countdown
!mp obr - Toggles Battle Royale mode`;
-
-export class MultiplayerCommands extends BaseCommand {
- public readonly helpText:string = helpText;
public readonly helpDescription:string = "Command for use in multiplayer matches.";
public readonly helpArguments:Array = ["subCommand"];
diff --git a/server/commands/Ranking.ts b/server/commands/Ranking.ts
index e4d810e..f71742c 100644
--- a/server/commands/Ranking.ts
+++ b/server/commands/Ranking.ts
@@ -1,15 +1,13 @@
-import { Channel } from "../objects/Channel";
-import { User } from "../objects/User";
+import Channel from "../objects/Channel";
+import User from "../objects/User";
import { RankingModes } from "../enums/RankingModes";
-import { BaseCommand } from "./BaseCommand";
+import BaseCommand from "./BaseCommand";
-const helpText = `Ranking Modes:
+export default class RankingCommand extends BaseCommand {
+ public readonly helpText:string = `Ranking Modes:
!ranking pp - Sets your ranking mode to pp
!ranking score - Sets your ranking mode to score
!ranking acc - Sets your ranking mode to accuracy`;
-
-export class RankingCommand extends BaseCommand {
- public readonly helpText:string = helpText;
public readonly helpDescription:string = "Sets your prefered ranking type";
public exec(channel:Channel, sender:User, args:Array) {
diff --git a/server/commands/RollCommand.ts b/server/commands/RollCommand.ts
index 4b33377..0dca2b1 100644
--- a/server/commands/RollCommand.ts
+++ b/server/commands/RollCommand.ts
@@ -1,8 +1,8 @@
-import { Channel } from "../objects/Channel";
-import { User } from "../objects/User";
-import { BaseCommand } from "./BaseCommand";
+import Channel from "../objects/Channel";
+import User from "../objects/User";
+import BaseCommand from "./BaseCommand";
-export class RollCommand extends BaseCommand {
+export default class RollCommand extends BaseCommand {
public readonly helpDescription:string = "Roll some dice and get a random number between 1 and a number (default 100)";
public readonly helpArguments:Array = ["number"];
diff --git a/server/interfaces/Config.ts b/server/interfaces/Config.ts
index d6d44f1..00e5fa9 100644
--- a/server/interfaces/Config.ts
+++ b/server/interfaces/Config.ts
@@ -1,11 +1,11 @@
-export interface Config {
- express:ExpressConfigSection,
+export default interface Config {
+ http:HttpConfigSection,
prometheus:PrometheusConfigSection,
redis:RedisConfigSection,
database:DatabaseConfigSection
}
-interface ExpressConfigSection {
+interface HttpConfigSection {
port:number,
compression:boolean
}
diff --git a/server/interfaces/ICommand.ts b/server/interfaces/ICommand.ts
index 7bc8bd9..53e8a45 100644
--- a/server/interfaces/ICommand.ts
+++ b/server/interfaces/ICommand.ts
@@ -1,8 +1,8 @@
-import { Channel } from "../objects/Channel";
-import { Shared } from "../objects/Shared";
-import { User } from "../objects/User";
+import Channel from "../objects/Channel";
+import Shared from "../objects/Shared";
+import User from "../objects/User";
-export interface ICommand {
+export default interface ICommand {
shared:Shared,
helpText:string,
helpDescription:string,
diff --git a/server/interfaces/IpZxqResponse.ts b/server/interfaces/IpZxqResponse.ts
index 186a916..2c05280 100644
--- a/server/interfaces/IpZxqResponse.ts
+++ b/server/interfaces/IpZxqResponse.ts
@@ -1,4 +1,4 @@
-export interface IpZxqResponse {
+export default interface IpZxqResponse {
country: string,
loc: string
}
\ No newline at end of file
diff --git a/server/interfaces/MatchData.ts b/server/interfaces/MatchData.ts
index 3f5a6df..2d9bfe4 100644
--- a/server/interfaces/MatchData.ts
+++ b/server/interfaces/MatchData.ts
@@ -1,6 +1,6 @@
-import { MatchDataSlot } from "./MatchDataSlot";
+import MatchDataSlot from "./MatchDataSlot";
-export interface MatchData {
+export default interface MatchData {
matchId:number,
matchType:number,
activeMods:number,
diff --git a/server/interfaces/MatchDataSlot.ts b/server/interfaces/MatchDataSlot.ts
index af75d09..b950c86 100644
--- a/server/interfaces/MatchDataSlot.ts
+++ b/server/interfaces/MatchDataSlot.ts
@@ -1,4 +1,4 @@
-export interface MatchDataSlot {
+export default interface MatchDataSlot {
status:number,
team:number,
playerId:number,
diff --git a/server/interfaces/MatchJoinData.ts b/server/interfaces/MatchJoinData.ts
index ac5dbed..ca0064b 100644
--- a/server/interfaces/MatchJoinData.ts
+++ b/server/interfaces/MatchJoinData.ts
@@ -1,4 +1,4 @@
-export interface MatchJoinData {
+export default interface MatchJoinData {
matchId: number,
gamePassword: string
}
\ No newline at end of file
diff --git a/server/interfaces/MatchScoreData.ts b/server/interfaces/MatchScoreData.ts
index d79787d..5a10306 100644
--- a/server/interfaces/MatchScoreData.ts
+++ b/server/interfaces/MatchScoreData.ts
@@ -1,4 +1,4 @@
-export interface MatchScoreData {
+export default interface MatchScoreData {
time:number,
id:number,
count300:number,
diff --git a/server/interfaces/MatchStartSkipData.ts b/server/interfaces/MatchStartSkipData.ts
index 1c7ab6d..5b149f5 100644
--- a/server/interfaces/MatchStartSkipData.ts
+++ b/server/interfaces/MatchStartSkipData.ts
@@ -1,4 +1,4 @@
-export interface MatchStartSkipData {
+export default interface MatchStartSkipData {
playerId:number,
flag:boolean
}
\ No newline at end of file
diff --git a/server/interfaces/MessageData.ts b/server/interfaces/MessageData.ts
index 321d9ec..8c4735a 100644
--- a/server/interfaces/MessageData.ts
+++ b/server/interfaces/MessageData.ts
@@ -1,4 +1,4 @@
-export interface MessageData {
+export default interface MessageData {
sendingClient: string,
message: string,
target: string,
diff --git a/server/interfaces/OsuPacketWriter.ts b/server/interfaces/OsuPacketWriter.ts
index 88294d6..14c9639 100644
--- a/server/interfaces/OsuPacketWriter.ts
+++ b/server/interfaces/OsuPacketWriter.ts
@@ -1,7 +1,7 @@
-import { MatchData } from "./MatchData"
-import { MessageData } from "./MessageData"
+import MatchData from "./MatchData"
+import MessageData from "./MessageData"
-export interface OsuPacketWriter {
+export default interface OsuPacketWriter {
// Functions
LoginReply(data:number) : OsuPacketWriter,
CommandError() : OsuPacketWriter,
diff --git a/server/interfaces/PlayerScore.ts b/server/interfaces/PlayerScore.ts
index b9d64d6..2fdcec3 100644
--- a/server/interfaces/PlayerScore.ts
+++ b/server/interfaces/PlayerScore.ts
@@ -1,8 +1,8 @@
-import { Slot } from "../objects/Slot";
-import { User } from "../objects/User";
-import { MatchScoreData } from "./MatchScoreData";
+import Slot from "../objects/Slot";
+import User from "../objects/User";
+import MatchScoreData from "./MatchScoreData";
-export interface PlayerScore {
+export default interface PlayerScore {
player:User,
slot:Slot,
score:number,
diff --git a/server/objects/Channel.ts b/server/objects/Channel.ts
index 63b9bd5..a2716b3 100644
--- a/server/objects/Channel.ts
+++ b/server/objects/Channel.ts
@@ -1,10 +1,11 @@
-import { osu } from "../../osuTyping";
-import { Bot } from "../Bot";
-import { Shared } from "../objects/Shared";
-import { DataStream } from "./DataStream";
-import { User } from "./User";
+import osu from "../../osuTyping";
+import Bot from "../Bot";
+import ChatHistory from "../ChatHistory";
+import Shared from "../objects/Shared";
+import DataStream from "./DataStream";
+import User from "./User";
-export class Channel {
+export default class Channel {
public name:string;
public description:string;
public stream:DataStream;
@@ -40,6 +41,9 @@ export class Channel {
senderId: sender.id
});
this.stream.SendWithExclusion(osuPacketWriter.toBuffer, sender);
+ if (this.name === "#osu") {
+ ChatHistory.AddMessage(`${sender.username}: ${message}`);
+ }
}
if (message[0] === "!") {
@@ -63,6 +67,10 @@ export class Channel {
} else {
this.stream.Send(osuPacketWriter.toBuffer);
}
+
+ if (this.name === "#osu") {
+ ChatHistory.AddMessage(`${this.bot.user.username}: ${message}`);
+ }
}
public SendSystemMessage(message:string, sendTo?:User) {
diff --git a/server/objects/DataStream.ts b/server/objects/DataStream.ts
index 686e398..7665764 100644
--- a/server/objects/DataStream.ts
+++ b/server/objects/DataStream.ts
@@ -1,13 +1,13 @@
import { ConsoleHelper } from "../../ConsoleHelper";
-import { Constants } from "../../Constants";
-import { DataStreamArray } from "./DataStreamArray";
-import { User } from "./User";
-import { UserArray } from "./UserArray";
+import Constants from "../../Constants";
+import DataStreamArray from "./DataStreamArray";
+import User from "./User";
+import UserArray from "./UserArray";
import { hexlify } from "../Util";
type DeleteFunction = (dataStream:DataStream) => void;
-export class DataStream {
+export default class DataStream {
private users:UserArray = new UserArray();
public readonly name:string;
private readonly parent:DataStreamArray;
diff --git a/server/objects/DataStreamArray.ts b/server/objects/DataStreamArray.ts
index 2491060..76e907a 100644
--- a/server/objects/DataStreamArray.ts
+++ b/server/objects/DataStreamArray.ts
@@ -1,9 +1,9 @@
import { ConsoleHelper } from "../../ConsoleHelper";
-import { DataStream } from "./DataStream";
-import { FunkyArray } from "./FunkyArray";
-import { User } from "./User";
+import DataStream from "./DataStream";
+import FunkyArray from "./FunkyArray";
+import User from "./User";
-export class DataStreamArray extends FunkyArray {
+export default class DataStreamArray extends FunkyArray {
public CreateStream(name:string, removeWhenEmpty:boolean = true) : DataStream {
const dataStream:DataStream = this.add(name, new DataStream(name, this, removeWhenEmpty));
ConsoleHelper.printStream(`Created stream [${name}]`);
diff --git a/server/objects/Database.ts b/server/objects/Database.ts
index cc6ee9e..3a6f7dc 100644
--- a/server/objects/Database.ts
+++ b/server/objects/Database.ts
@@ -1,7 +1,7 @@
import { ConsoleHelper } from "../../ConsoleHelper";
import { createPool, Pool } from "mysql2";
-export class Database {
+export default class Database {
private connectionPool:Pool;
private static readonly CONNECTION_LIMIT = 128;
diff --git a/server/objects/FunkyArray.ts b/server/objects/FunkyArray.ts
index 8e29b32..cbecedd 100644
--- a/server/objects/FunkyArray.ts
+++ b/server/objects/FunkyArray.ts
@@ -1,4 +1,4 @@
-export class FunkyArray {
+export default class FunkyArray {
private items:any = {};
private itemKeys:Array = Object.keys(this.items);
private iterableArray:Array = new Array();
diff --git a/server/objects/LatLng.ts b/server/objects/LatLng.ts
index 8a494d7..22e6156 100644
--- a/server/objects/LatLng.ts
+++ b/server/objects/LatLng.ts
@@ -1,4 +1,4 @@
-export class LatLng {
+export default class LatLng {
public latitude:number;
public longitude:number;
diff --git a/server/objects/LoginInfo.ts b/server/objects/LoginInfo.ts
index c8712b9..000341b 100644
--- a/server/objects/LoginInfo.ts
+++ b/server/objects/LoginInfo.ts
@@ -1,4 +1,4 @@
-export class LoginInfo {
+export default class LoginInfo {
public username:string;
public password:string;
public version:string;
@@ -19,8 +19,6 @@ export class LoginInfo {
data = data.toString();
}
- console.log(data);
-
const loginData:Array = data.split("\n");
const extraData:Array = loginData[2].split("|");
diff --git a/server/objects/Match.ts b/server/objects/Match.ts
index 0841090..9a529df 100644
--- a/server/objects/Match.ts
+++ b/server/objects/Match.ts
@@ -1,19 +1,19 @@
-import { Channel } from "./Channel";
-import { Shared } from "../objects/Shared";
-import { DataStream } from "./DataStream";
-import { Slot } from "./Slot";
-import { User } from "./User";
-import { StatusUpdate } from "../packets/StatusUpdate";
+import Channel from "./Channel";
+import Shared from "../objects/Shared";
+import DataStream from "./DataStream";
+import Slot from "./Slot";
+import User from "./User";
+import StatusUpdate from "../packets/StatusUpdate";
import { SlotStatus } from "../enums/SlotStatus";
-import { MatchData } from "../interfaces/MatchData";
+import MatchData from "../interfaces/MatchData";
import { Team } from "../enums/Team";
-import { MatchStartSkipData } from "../interfaces/MatchStartSkipData";
+import MatchStartSkipData from "../interfaces/MatchStartSkipData";
import { Mods } from "../enums/Mods";
-import { PlayerScore } from "../interfaces/PlayerScore";
-import { MatchScoreData } from "../interfaces/MatchScoreData";
-import { osu } from "../../osuTyping";
+import PlayerScore from "../interfaces/PlayerScore";
+import MatchScoreData from "../interfaces/MatchScoreData";
+import osu from "../../osuTyping";
-export class Match {
+export default class Match {
// osu! Data
public matchId:number = -1;
public inProgress:boolean = false;
@@ -236,8 +236,6 @@ export class Match {
// Update all users in the match with new match information
this.matchStream.Send(osuPacketWriter.toBuffer);
-
- console.log(this.slots);
}
public moveToSlot(user:User, slotToMoveTo:number) {
@@ -448,7 +446,6 @@ export class Match {
this.matchLoadSlots = new Array();
// Loop through all slots in the match
- console.log(this.slots);
for (let slot of this.slots) {
// Make sure the slot has a user in it
if (slot.player === undefined || slot.status === SlotStatus.Empty || slot.status === SlotStatus.Locked) {
diff --git a/server/objects/MatchArray.ts b/server/objects/MatchArray.ts
index a5fe0c7..ab477d5 100644
--- a/server/objects/MatchArray.ts
+++ b/server/objects/MatchArray.ts
@@ -1,7 +1,7 @@
-import { FunkyArray } from "./FunkyArray";
-import { Match } from "./Match";
+import FunkyArray from "./FunkyArray";
+import Match from "./Match";
-export class MatchArray extends FunkyArray {
+export default class MatchArray extends FunkyArray {
public getById(id:number) : Match | undefined {
for (let match of this.getIterableItems()) {
if (match.matchId === id) {
diff --git a/server/objects/PrivateChannel.ts b/server/objects/PrivateChannel.ts
index a0db624..ce7a971 100644
--- a/server/objects/PrivateChannel.ts
+++ b/server/objects/PrivateChannel.ts
@@ -1,10 +1,10 @@
-import { osu } from "../../osuTyping";
-import { Shared } from "../objects/Shared";
-import { Channel } from "./Channel";
-import { DataStream } from "./DataStream";
-import { User } from "./User";
+import osu from "../../osuTyping";
+import Shared from "../objects/Shared";
+import Channel from "./Channel";
+import DataStream from "./DataStream";
+import User from "./User";
-export class PrivateChannel extends Channel {
+export default class PrivateChannel extends Channel {
private readonly user0:User;
private readonly user1:User;
diff --git a/server/objects/Shared.ts b/server/objects/Shared.ts
index ce3e9cd..d918cde 100644
--- a/server/objects/Shared.ts
+++ b/server/objects/Shared.ts
@@ -1,16 +1,16 @@
-import { ChatManager } from "../ChatManager";
-import { Config } from "../interfaces/Config";
-import { Database } from "../objects/Database";
-import { DataStreamArray } from "../objects/DataStreamArray";
-import { MultiplayerManager } from "../MultiplayerManager";
-import { PrivateChatManager } from "../PrivateChatManager";
+import ChatManager from "../ChatManager";
+import Config from "../interfaces/Config";
+import Database from "../objects/Database";
+import DataStreamArray from "../objects/DataStreamArray";
+import MultiplayerManager from "../MultiplayerManager";
+import PrivateChatManager from "../PrivateChatManager";
import { readFileSync } from "fs";
-import { UserArray } from "../objects/UserArray";
-import { User } from "./User";
-import { LatLng } from "./LatLng";
-import { Bot } from "../Bot";
+import UserArray from "../objects/UserArray";
+import User from "./User";
+import LatLng from "./LatLng";
+import Bot from "../Bot";
-export class Shared {
+export default class Shared {
public readonly chatManager:ChatManager;
public readonly config:Config;
public readonly database:Database;
diff --git a/server/objects/Slot.ts b/server/objects/Slot.ts
index 8dc2ed5..d7ba751 100644
--- a/server/objects/Slot.ts
+++ b/server/objects/Slot.ts
@@ -1,8 +1,8 @@
import { Mods } from "../enums/Mods";
import { SlotStatus } from "../enums/SlotStatus";
-import { User } from "./User";
+import User from "./User";
-export class Slot {
+export default class Slot {
public readonly slotId:number;
public status:SlotStatus;
public team:number;
diff --git a/server/objects/User.ts b/server/objects/User.ts
index 1d936ca..283605b 100644
--- a/server/objects/User.ts
+++ b/server/objects/User.ts
@@ -1,10 +1,10 @@
-import { LatLng } from "./LatLng";
+import LatLng from "./LatLng";
import { RankingModes } from "../enums/RankingModes";
-import { Match } from "./Match";
-import { DataStream } from "./DataStream";
-import { StatusUpdate } from "../packets/StatusUpdate";
-import { Shared } from "../objects/Shared";
-import { Slot } from "./Slot";
+import Match from "./Match";
+import DataStream from "./DataStream";
+import StatusUpdate from "../packets/StatusUpdate";
+import Shared from "../objects/Shared";
+import Slot from "./Slot";
const rankingModes = [
"pp_raw",
@@ -12,7 +12,7 @@ const rankingModes = [
"avg_accuracy"
];
-export class User {
+export default class User {
private static readonly EMPTY_BUFFER = Buffer.alloc(0);
public shared:Shared;
diff --git a/server/objects/UserArray.ts b/server/objects/UserArray.ts
index 702d3b3..21fb33b 100644
--- a/server/objects/UserArray.ts
+++ b/server/objects/UserArray.ts
@@ -1,7 +1,7 @@
-import { FunkyArray } from "./FunkyArray";
-import { User } from "./User";
+import FunkyArray from "./FunkyArray";
+import User from "./User";
-export class UserArray extends FunkyArray {
+export default class UserArray extends FunkyArray {
public getById(id:number) : User | undefined {
for (let user of this.getIterableItems()) {
if (user.id == id)
diff --git a/server/objects/database/UserInfo.ts b/server/objects/database/UserInfo.ts
index 20638a2..ce3d5d3 100644
--- a/server/objects/database/UserInfo.ts
+++ b/server/objects/database/UserInfo.ts
@@ -1,4 +1,4 @@
-export class UserInfo {
+export default class UserInfo {
id:number = Number.MIN_VALUE;
username:string = "";
username_safe:string = "";
diff --git a/server/packets/AddFriend.ts b/server/packets/AddFriend.ts
index 680a3e2..97b9787 100644
--- a/server/packets/AddFriend.ts
+++ b/server/packets/AddFriend.ts
@@ -1,6 +1,6 @@
-import { User } from "../objects/User";
+import User from "../objects/User";
-export function AddFriend(user:User, friendId:number) {
+export default function AddFriend(user:User, friendId:number) {
user.shared.database.query("INSERT INTO friends (user, friendsWith) VALUES (?, ?)", [
user.id, friendId
]);
diff --git a/server/packets/ChangeAction.ts b/server/packets/ChangeAction.ts
index 085d4fa..30a4dd6 100644
--- a/server/packets/ChangeAction.ts
+++ b/server/packets/ChangeAction.ts
@@ -1,7 +1,7 @@
-import { User } from "../objects/User";
-import { StatusUpdate } from "./StatusUpdate";
+import User from "../objects/User";
+import StatusUpdate from "./StatusUpdate";
-export function ChangeAction(user:User, data:any) {
+export default function ChangeAction(user:User, data:any) {
user.updatePresence(data);
if (user.spectatorStream != null) {
diff --git a/server/packets/Logout.ts b/server/packets/Logout.ts
index 121a99b..f43a831 100644
--- a/server/packets/Logout.ts
+++ b/server/packets/Logout.ts
@@ -1,9 +1,9 @@
import { ConsoleHelper } from "../../ConsoleHelper";
-import { Database } from "../objects/Database";
-import { DataStreamArray } from "../objects/DataStreamArray";
-import { User } from "../objects/User";
+import Database from "../objects/Database";
+import DataStreamArray from "../objects/DataStreamArray";
+import User from "../objects/User";
-export async function Logout(user:User) {
+export default async function Logout(user:User) {
if (user.uuid === "bot") throw "Tried to log bot out, WTF???";
const logoutStartTime = Date.now();
diff --git a/server/packets/PrivateMessage.ts b/server/packets/PrivateMessage.ts
index bbaaa7f..69b3d78 100644
--- a/server/packets/PrivateMessage.ts
+++ b/server/packets/PrivateMessage.ts
@@ -1,27 +1,23 @@
-import { MessageData } from "../interfaces/MessageData";
-import { Shared } from "../objects/Shared";
-import { PrivateChannel } from "../objects/PrivateChannel";
-import { User } from "../objects/User";
+import MessageData from "../interfaces/MessageData";
+import Shared from "../objects/Shared";
+import PrivateChannel from "../objects/PrivateChannel";
+import User from "../objects/User";
-export function PrivateMessage(user:User, message:MessageData) {
+export default function PrivateMessage(user:User, message:MessageData) {
const shared:Shared = user.shared;
const sendingTo = shared.users.getByUsername(message.target);
if (!(sendingTo instanceof User)) {
- console.log("Sending User invalid");
return;
}
let channel = shared.privateChatManager.GetChannelByName(`${user.username}${sendingTo.username}`);
if (!(channel instanceof PrivateChannel)) {
- console.log("First find failed");
// Try it the other way around
channel = shared.privateChatManager.GetChannelByName(`${sendingTo.username}${user.username}`);
}
if (!(channel instanceof PrivateChannel)) {
- console.log("Second find failed, creating");
channel = shared.privateChatManager.AddChannel(user, sendingTo);
}
- console.log("sending");
channel.SendMessage(user, message.message);
}
\ No newline at end of file
diff --git a/server/packets/RemoveFriend.ts b/server/packets/RemoveFriend.ts
index 0fb81e8..aa36f9a 100644
--- a/server/packets/RemoveFriend.ts
+++ b/server/packets/RemoveFriend.ts
@@ -1,6 +1,6 @@
-import { User } from "../objects/User";
+import User from "../objects/User";
-export function RemoveFriend(user:User, friendId:number) {
+export default function RemoveFriend(user:User, friendId:number) {
user.shared.database.query("DELETE FROM friends WHERE user = ? AND friendsWith = ? LIMIT 1", [
user.id, friendId
]);
diff --git a/server/packets/StatusUpdate.ts b/server/packets/StatusUpdate.ts
index b2a6a1b..ee9afaf 100644
--- a/server/packets/StatusUpdate.ts
+++ b/server/packets/StatusUpdate.ts
@@ -1,9 +1,9 @@
-import { Shared } from "../objects/Shared";
+import Shared from "../objects/Shared";
import { RankingModes } from "../enums/RankingModes";
-import { User } from "../objects/User";
-import { osu } from "../../osuTyping";
+import User from "../objects/User";
+import osu from "../../osuTyping";
-export function StatusUpdate(arg0:User | Shared, id:number) {
+export default function StatusUpdate(arg0:User | Shared, id:number) {
if (id == 3) return; // Ignore Bot
// Create new osu packet writer
diff --git a/server/packets/TourneyJoinMatchChannel.ts b/server/packets/TourneyJoinMatchChannel.ts
index 40cee45..010e841 100644
--- a/server/packets/TourneyJoinMatchChannel.ts
+++ b/server/packets/TourneyJoinMatchChannel.ts
@@ -1,7 +1,7 @@
-import { osu } from "../../osuTyping";
-import { User } from "../objects/User";
+import osu from "../../osuTyping";
+import User from "../objects/User";
-export function TourneyMatchJoinChannel(user:User, matchId:number) {
+export default function TourneyMatchJoinChannel(user:User, matchId:number) {
const match = user.shared.multiplayerManager.GetMatchById(matchId);
if (match === undefined) {
return;
diff --git a/server/packets/TourneyMatchLeaveChannel.ts b/server/packets/TourneyMatchLeaveChannel.ts
index 481024d..6a8bb63 100644
--- a/server/packets/TourneyMatchLeaveChannel.ts
+++ b/server/packets/TourneyMatchLeaveChannel.ts
@@ -1,6 +1,6 @@
-import { User } from "../objects/User";
+import User from "../objects/User";
-export function TourneyMatchLeaveChannel(user:User, matchId:number) {
+export default function TourneyMatchLeaveChannel(user:User, matchId:number) {
const match = user.shared.multiplayerManager.GetMatchById(matchId);
if (match === undefined) {
return;
diff --git a/server/packets/TourneyMatchSpecialInfo.ts b/server/packets/TourneyMatchSpecialInfo.ts
index 91183be..c3ce745 100644
--- a/server/packets/TourneyMatchSpecialInfo.ts
+++ b/server/packets/TourneyMatchSpecialInfo.ts
@@ -1,10 +1,10 @@
-import { osu } from "../../osuTyping";
-import { Match } from "../objects/Match";
-import { User } from "../objects/User";
-import { StatusUpdate } from "./StatusUpdate";
-import { UserPresence } from "./UserPresence";
+import osu from "../../osuTyping";
+import Match from "../objects/Match";
+import User from "../objects/User";
+import StatusUpdate from "./StatusUpdate";
+import UserPresence from "./UserPresence";
-export function TourneyMatchSpecialInfo(user:User, matchId:number) {
+export default function TourneyMatchSpecialInfo(user:User, matchId:number) {
const match = user.shared.multiplayerManager.GetMatchById(matchId);
if (!(match instanceof Match)) {
return;
diff --git a/server/packets/UserPresence.ts b/server/packets/UserPresence.ts
index dac114d..aa78bf4 100644
--- a/server/packets/UserPresence.ts
+++ b/server/packets/UserPresence.ts
@@ -1,8 +1,8 @@
-import { osu } from "../../osuTyping";
-import { Shared } from "../objects/Shared";
-import { User } from "../objects/User";
+import osu from "../../osuTyping";
+import Shared from "../objects/Shared";
+import User from "../objects/User";
-export function UserPresence(arg0:User | Shared, id:number) {
+export default function UserPresence(arg0:User | Shared, id:number) {
const osuPacketWriter = osu.Bancho.Writer();
let shared:Shared;
if (arg0 instanceof User) {
diff --git a/server/packets/UserPresenceBundle.ts b/server/packets/UserPresenceBundle.ts
index 4ff0bb9..a644ec3 100644
--- a/server/packets/UserPresenceBundle.ts
+++ b/server/packets/UserPresenceBundle.ts
@@ -1,8 +1,8 @@
-import { osu } from "../../osuTyping";
-import { Shared } from "../objects/Shared";
-import { User } from "../objects/User";
+import osu from "../../osuTyping";
+import Shared from "../objects/Shared";
+import User from "../objects/User";
-export function UserPresenceBundle(arg0:User | Shared) : Buffer {
+export default function UserPresenceBundle(arg0:User | Shared) : Buffer {
const osuPacketWriter = osu.Bancho.Writer();
let shared:Shared;
if (arg0 instanceof User) {
diff --git a/server/packets/UserStatsRequest.ts b/server/packets/UserStatsRequest.ts
index 29719e4..978a711 100644
--- a/server/packets/UserStatsRequest.ts
+++ b/server/packets/UserStatsRequest.ts
@@ -1,9 +1,9 @@
-import { User } from "../objects/User";
-import { StatusUpdate } from "./StatusUpdate";
-import { UserPresence } from "./UserPresence";
-import { UserPresenceBundle } from "./UserPresenceBundle";
+import User from "../objects/User";
+import StatusUpdate from "./StatusUpdate";
+import UserPresence from "./UserPresence";
+import UserPresenceBundle from "./UserPresenceBundle";
-export function UserStatsRequest(user:User, data:Array) {
+export default function UserStatsRequest(user:User, data:Array) {
UserPresenceBundle(user);
for (let id of data) {
diff --git a/tooling/cleanup.ts b/tooling/cleanup.ts
new file mode 100644
index 0000000..cba0137
--- /dev/null
+++ b/tooling/cleanup.ts
@@ -0,0 +1,12 @@
+import { readdirSync, rmSync, renameSync } from "fs";
+
+const libFiles = readdirSync("./build");
+
+for (const file of libFiles) {
+ if (!file.startsWith("index.min.js")) {
+ rmSync(`./build/${file}`, { recursive: true });
+ }
+}
+
+//renameSync("./build/combined.js", "./build/index.js");
+//renameSync("./build/combined.d.ts", "./build/index.d.ts");
\ No newline at end of file
diff --git a/tooling/fileSmasher.ts b/tooling/fileSmasher.ts
new file mode 100644
index 0000000..b1ca63b
--- /dev/null
+++ b/tooling/fileSmasher.ts
@@ -0,0 +1,67 @@
+// fileSmasher ~.~
+// for when you're just too lazy to
+// do it properly.
+
+import { readdirSync, lstatSync, readFileSync, writeFileSync } from "fs";
+
+let tsFileData:Array = new Array();
+const tsFirstFileData:Array = new Array();
+const tsLastFileData:Array = new Array();
+const tsEverythingElse:Array = new Array();
+
+function readDir(nam:string) {
+ const files = readdirSync(nam);
+ for (const file of files) {
+ if (nam == "./" && (file.startsWith(".") || file == "tooling" || file == "build" || file == "node_modules" || file == "combined.ts")) {
+ continue;
+ }
+
+ // This is a very dumb way of checking for folders
+ // protip: don't do this.
+ if (lstatSync(`${nam}/${file}`).isDirectory()) {
+ readDir(`${nam}/${file}`);
+ } else if (file.endsWith(".ts")) {
+ if (file == "Binato.ts") {
+ tsLastFileData.push(readFileSync((`${nam}/${file}`).replace("//", "/")).toString());
+ } else if (nam.includes("enum") || nam.includes("packets") || file.includes("FunkyArray") || file.includes("SpectatorManager") || file.includes("Shared")) {
+ tsFirstFileData.push(readFileSync((`${nam}/${file}`).replace("//", "/")).toString());
+ } else {
+ tsEverythingElse.push(readFileSync((`${nam}/${file}`).replace("//", "/")).toString());
+ }
+ }
+ }
+}
+
+readDir("./");
+
+tsFileData = tsFileData.concat(tsFirstFileData).concat(tsEverythingElse).concat(tsLastFileData);
+
+const combinedFiles = tsFileData.join("\n");
+
+const splitLines = combinedFiles.split("\n");
+const resultLines:Array = new Array();
+
+// Insert allowed imports
+resultLines.push(`import { IncomingMessage, ServerResponse } from "http";
+import { Registry, collectDefaultMetrics } from "prom-client";
+import { RedisClientType, createClient } from "redis";
+import { readFileSync, existsSync } from "fs";
+import { randomBytes, pbkdf2 } from "crypto";
+import { createPool, Pool } from "mysql2";
+import * as dyetty from "dyetty";
+import fetch from "node-fetch";
+import http from "http";`);
+
+// Let's process the file to make it usable
+for (const line of splitLines) {
+ // Throw away imports as they aren't needed
+ // TODO: Add allow list for npm module imports
+ if (line.startsWith("import")) {
+ continue;
+ }
+ // Fix up classes, interfaces and such.
+ //resultLines.push(line);
+ resultLines.push(line.replace("export default", "").replace("export class", "class").replace("export interface", "interface").replace("export enum", "enum").replace("export type", "type"));
+}
+
+writeFileSync("./combined.ts", resultLines.join("\n"));
diff --git a/tooling/mangle.ts b/tooling/mangle.ts
new file mode 100644
index 0000000..73da792
--- /dev/null
+++ b/tooling/mangle.ts
@@ -0,0 +1,10 @@
+import { readFileSync, writeFileSync } from "fs";
+import { minify } from "terser";
+
+(async () => {
+ const mangled = await minify(readFileSync("./build/combined.js").toString(), {
+ mangle: true,
+ toplevel: true,
+ });
+ writeFileSync("./build/index.min.js", `${mangled.code}`);
+})();
\ No newline at end of file