This commit is contained in:
Hri7566 2022-01-26 01:44:26 +01:00
parent 0cf80d62db
commit 862d09f37b
5 changed files with 1971 additions and 51 deletions

6
.env
View File

@ -1,4 +1,4 @@
ADMINPASS=amogus ADMINPASS=burgerass
SALT=๖ۣۜH͜r̬i͡7566 SALT=๖ۣۜH͜r̬i͡7566
MONGO_URL=mongodb+srv://admin:Phillies11@mpp.2akwi.mongodb.net/mpp?retryWrites=true&w=majority MONGO_URL=mongodb://127.0.0.1/?authSource=admin&readPreference=primary&appname=MongoDB%20Compass&ssl=false
SSL=false SSL=true

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", "level": "^7.0.0",
"mongoose": "^5.12.7", "mongoose": "^5.12.7",
"node-json-color-stringify": "^1.1.0", "node-json-color-stringify": "^1.1.0",
"nodemon": "^2.0.15",
"ws": "^7.2.3" "ws": "^7.2.3"
} }
} }

View File

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

View File

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