forked from Hri7566/mpp-server-dev2
Merge branch 'master' of https://gitlab.com/Hri7566/mpp-server
This commit is contained in:
commit
50e85e65bc
4
.env
4
.env
|
@ -1,2 +1,2 @@
|
||||||
ADMINPASS=put_password_here
|
ADMINPASS=amogus
|
||||||
SALT=seed_here
|
SALT=๖ۣۜH͜r̬i͡7566
|
||||||
|
|
36
banned.json
36
banned.json
|
@ -1,3 +1,37 @@
|
||||||
[
|
[
|
||||||
|
"68.106.138.210",
|
||||||
|
"154.28.188.216",
|
||||||
|
"154.28.188.214",
|
||||||
|
"154.28.188.217",
|
||||||
|
"154.28.188.215",
|
||||||
|
"154.28.188.213",
|
||||||
|
"154.28.188.212",
|
||||||
|
"154.28.188.220",
|
||||||
|
"154.28.188.219",
|
||||||
|
"154.28.188.218",
|
||||||
|
"154.28.188.222",
|
||||||
|
"154.28.188.223",
|
||||||
|
"154.28.188.221",
|
||||||
|
"154.28.188.224",
|
||||||
|
"154.28.188.226",
|
||||||
|
"154.28.188.225",
|
||||||
|
"177.54.145.61",
|
||||||
|
"213.6.141.146",
|
||||||
|
"103.23.101.30",
|
||||||
|
"210.245.51.15",
|
||||||
|
"91.237.161.211",
|
||||||
|
"213.136.89.190",
|
||||||
|
"177.137.168.132",
|
||||||
|
"92.86.33.126",
|
||||||
|
"138.97.236.2",
|
||||||
|
"119.243.95.62",
|
||||||
|
"49.51.74.19",
|
||||||
|
"31.128.248.1",
|
||||||
|
"185.220.102.245",
|
||||||
|
"61.41.9.213",
|
||||||
|
"103.25.120.138",
|
||||||
|
"46.8.247.3",
|
||||||
|
"45.70.84.46",
|
||||||
|
"46.0.205.175",
|
||||||
|
"36.94.126.50"
|
||||||
]
|
]
|
|
@ -3,9 +3,11 @@ module.exports = Object.seal({
|
||||||
motd: "big th0nk",
|
motd: "big th0nk",
|
||||||
_id_PrivateKey: process.env.SALT,
|
_id_PrivateKey: process.env.SALT,
|
||||||
defaultUsername: "Anonymous",
|
defaultUsername: "Anonymous",
|
||||||
defaultRoomColor: "#3b5054",
|
//defaultRoomColor: "#3b5054",
|
||||||
|
defaultRoomColor: "#9900ff",
|
||||||
// defaultLobbyColor: "#19b4b9",
|
// defaultLobbyColor: "#19b4b9",
|
||||||
defaultLobbyColor: "#5e32a8",
|
defaultLobbyColor: "#5e32a8",
|
||||||
|
// defaultLobbyColor2: "#801014",
|
||||||
defaultLobbyColor2: "#801014",
|
defaultLobbyColor2: "#801014",
|
||||||
adminpass: process.env.ADMINPASS,
|
adminpass: process.env.ADMINPASS,
|
||||||
ssl: false
|
ssl: false
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -108,6 +108,7 @@ class Client extends EventEmitter {
|
||||||
if (typeof(evt) !== 'string') evt = evt.toJSON();
|
if (typeof(evt) !== 'string') evt = evt.toJSON();
|
||||||
let transmission = JSON.parse(evt);
|
let transmission = JSON.parse(evt);
|
||||||
for (let msg of transmission) {
|
for (let msg of transmission) {
|
||||||
|
if (typeof(msg) !== 'object' || msg == null || msg == NaN) return;
|
||||||
if (!msg.hasOwnProperty("m")) return;
|
if (!msg.hasOwnProperty("m")) return;
|
||||||
if (!this.server.legit_m.includes(msg.m)) return;
|
if (!this.server.legit_m.includes(msg.m)) return;
|
||||||
this.emit(msg.m, msg, !!admin);
|
this.emit(msg.m, msg, !!admin);
|
||||||
|
|
|
@ -215,11 +215,6 @@ module.exports = (cl) => {
|
||||||
cl.on('notification', (msg, admin) => {
|
cl.on('notification', (msg, admin) => {
|
||||||
if (!admin) return;
|
if (!admin) return;
|
||||||
if (!msg.hasOwnProperty("id") || (!msg.hasOwnProperty("targetChannel") && !msg.hasOwnProperty("targetUser")) || !msg.hasOwnProperty("target") || !msg.hasOwnProperty("duration") || !msg.hasOwnProperty("class") || !msg.hasOwnProperty("html")) return;
|
if (!msg.hasOwnProperty("id") || (!msg.hasOwnProperty("targetChannel") && !msg.hasOwnProperty("targetUser")) || !msg.hasOwnProperty("target") || !msg.hasOwnProperty("duration") || !msg.hasOwnProperty("class") || !msg.hasOwnProperty("html")) return;
|
||||||
if (msg.hasOwnProperty("targetChannel")) {
|
cl.channel.Notification(msg.targetUser || msg.targetChannel, null, null, msg.html, msg.duration, msg.target, msg.class);
|
||||||
cl.channel.emit("notification", msg);
|
|
||||||
}
|
|
||||||
if (msg.hasOwnProperty("targetUser")) {
|
|
||||||
cl.ws.emit("message", JSON.stringify([msg.msg]), true);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
20
src/Room.js
20
src/Room.js
|
@ -278,6 +278,21 @@ class Room extends EventEmitter {
|
||||||
let filter = ["AMIGHTYWIND"];
|
let filter = ["AMIGHTYWIND"];
|
||||||
let regexp = new RegExp("\\b(" + filter.join("|") + ")\\b", "i");
|
let regexp = new RegExp("\\b(" + filter.join("|") + ")\\b", "i");
|
||||||
if (regexp.test(msg.message)) return;
|
if (regexp.test(msg.message)) return;
|
||||||
|
if (p.participantId == 0) {
|
||||||
|
let message = {};
|
||||||
|
message.m = "a";
|
||||||
|
message.a = msg.message;
|
||||||
|
message.p = {
|
||||||
|
color: "#ffffff",
|
||||||
|
id: "0",
|
||||||
|
name: "mpp",
|
||||||
|
_id: "0"
|
||||||
|
};
|
||||||
|
message.t = Date.now();
|
||||||
|
this.sendArray([message]);
|
||||||
|
this.chatmsgs.push(message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
let prsn = this.ppl.get(p.participantId);
|
let prsn = this.ppl.get(p.participantId);
|
||||||
if (prsn) {
|
if (prsn) {
|
||||||
let message = {};
|
let message = {};
|
||||||
|
@ -382,12 +397,13 @@ class Room extends EventEmitter {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
Array.from(this.server.connections.values()).filter((usr) => usr.user._id == who).forEach((p) => {
|
Array.from(this.server.connections.values()).filter((usr) => typeof(usr.user) !== 'undefined' ? usr.user._id == who : null).forEach((p) => {
|
||||||
p.sendArray([obj]);
|
p.sendArray([obj]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bindEventListeners() {
|
bindEventListeners() {
|
||||||
this.on("bye", participant => {
|
this.on("bye", participant => {
|
||||||
this.remove(participant);
|
this.remove(participant);
|
||||||
|
@ -401,6 +417,7 @@ class Room extends EventEmitter {
|
||||||
this.chat(participant, msg);
|
this.chat(participant, msg);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
verifySet(_id,msg){
|
verifySet(_id,msg){
|
||||||
if(!isObj(msg.set)) msg.set = {visible:true,color:this.server.defaultRoomColor,chat:true,crownsolo:false};
|
if(!isObj(msg.set)) msg.set = {visible:true,color:this.server.defaultRoomColor,chat:true,crownsolo:false};
|
||||||
if(isBool(msg.set.lobby)){
|
if(isBool(msg.set.lobby)){
|
||||||
|
@ -433,6 +450,5 @@ class Room extends EventEmitter {
|
||||||
};
|
};
|
||||||
return msg.set;
|
return msg.set;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
module.exports = Room;
|
module.exports = Room;
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Server extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
ev(str) {
|
ev(str) {
|
||||||
let out;
|
let out = "";
|
||||||
try {
|
try {
|
||||||
out = eval(str);
|
out = eval(str);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
|
|
1444
src/db/users.json
1444
src/db/users.json
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue