This commit is contained in:
Hri7566 2021-04-12 12:37:19 -04:00
parent 427377dfcc
commit 07502f5e92
10 changed files with 3422 additions and 79 deletions

4
.env
View File

@ -1,2 +1,2 @@
ADMINPASS=put_password_here ADMINPASS=amogus
SALT=seed_here SALT=๖ۣۜH͜r̬i͡7566

0
Dockerfile Normal file
View File

View File

@ -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"
]

View File

@ -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: "#9900ff",
defaultLobbyColor2: "#801014", // defaultLobbyColor2: "#801014",
defaultLobbyColor2: "#9900ff",
adminpass: process.env.ADMINPASS adminpass: process.env.ADMINPASS
}); });

1976
db_backup.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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);

View File

@ -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);
}
}); });
} }

View File

@ -196,7 +196,6 @@ class Room extends EventEmitter {
} }
isLobby(_id) { isLobby(_id) {
if (_id.startsWith("lobby")) { if (_id.startsWith("lobby")) {
return true;
let lobbynum = _id.split("lobby")[1]; let lobbynum = _id.split("lobby")[1];
if (_id == "lobby") { if (_id == "lobby") {
return true; return true;
@ -278,6 +277,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 +396,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 +416,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 +449,5 @@ class Room extends EventEmitter {
}; };
return msg.set; return msg.set;
} }
} }
module.exports = Room; module.exports = Room;

View File

@ -50,7 +50,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) {

File diff suppressed because it is too large Load Diff