This commit is contained in:
Hri7566 2022-01-26 01:44:26 +01:00
parent e45582efea
commit 95d2567145
4 changed files with 1968 additions and 48 deletions

2006
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@
"level": "^7.0.0",
"mongoose": "^5.12.7",
"node-json-color-stringify": "^1.1.0",
"nodemon": "^2.0.15",
"ws": "^7.2.3"
}
}

View File

@ -38,7 +38,6 @@ module.exports = (cl) => {
cl.on("ch", msg => {
if (typeof(msg.set) !== 'object') msg.set = {};
console.log(msg);
if (typeof(msg._id) == "string") {
if (msg._id.length > 512) return;
@ -67,13 +66,13 @@ module.exports = (cl) => {
});
cl.on("m", (msg, admin) => {
if (!cl.hasOwnProperty('room')) return;
if (!cl.hasOwnProperty('channel')) return;
if (!cl.quotas.cursor.attempt() && !admin) return;
if (!(cl.channel && cl.participantId)) return;
if (!msg.hasOwnProperty("x")) msg.x = null;
if (!msg.hasOwnProperty("y")) msg.y = null;
if (parseInt(msg.x) == NaN) msg.x = null;
if (parseInt(msg.y) == NaN) msg.y = null;
if (isNaN(parseFloat(msg.x))) msg.x = null;
if (isNaN(parseFloat(msg.y))) msg.y = null;
cl.channel.emit("m", cl, msg.x, msg.y);
});

View File

@ -13,7 +13,7 @@ class Server extends EventEmitter {
this.logger = new Logger("Server");
if (config.ssl == true) {
if (config.ssl == "true") {
this.https_server = https.createServer({
key: fs.readFileSync('ssl/privkey.pem', 'utf8'),
cert: fs.readFileSync('ssl/cert.pem'),