Fix things

fix some forgotten thigs, like adding the correct messages (legit_m) to the server... and cleaning up Quotas.js and Config.js
This commit is contained in:
Wolfy 2020-04-07 14:38:57 -04:00
parent 745787eadd
commit ea8957bcd5
6 changed files with 109 additions and 51 deletions

View File

@ -1,51 +1,51 @@
module.exports = Object.seal({ module.exports = Object.seal({
"note": { note: {
"lobby": { lobby: {
"allowance": 200, allowance: 200,
"max": 600, max: 600,
"maxHistLen": 3 maxHistLen: 3
}, },
"normal": { normal: {
"allowance": 400, allowance: 400,
"max": 1200, max: 1200,
"maxHistLen": 3 maxHistLen: 3
}, },
"insane": { insane: {
"allowance": 600, allowance: 600,
"max": 1800, max: 1800,
"maxHistLen": 3 maxHistLen: 3
} }
}, },
"chat": { chat: {
"lobby": { lobby: {
"amount": 4, amount: 4,
"time": 4000 time: 4000
}, },
"normal": { normal: {
"amount": 4, amount: 4,
"time": 4000 time: 4000
}, },
"insane": { insane: {
"amount": 10, amount: 10,
"time": 4000 time: 4000
} }
}, },
"chown": { chown: {
"amount": 10, amount: 10,
"time": 5000 time: 5000
}, },
"name": { name: {
"amount": 30, amount: 30,
"time": 30 * 60000 time: 30 * 60000
}, },
"room": { room: {
"time": 500 time: 500
}, },
"cursor": { cursor: {
"time": 16 time: 16
}, },
"kickban": { kickban: {
"amount": 2, amount: 2,
"time": 1000 time: 1000
} }
}) })

View File

@ -1,3 +1,3 @@
[ [
"1.2.3.4"
] ]

View File

@ -1,10 +1,10 @@
module.exports = Object.seal({ module.exports = Object.seal({
"port": "8080", port: "8080",
"motd": "You agree to read this message.", motd: "You agree to read this message.",
"_id_PrivateKey": "boppity", _id_PrivateKey: "boppity",
"defaultUsername": "Anonymous", defaultUsername: "Anonymous",
"defaultRoomColor": "#3b5054", defaultRoomColor: "#3b5054",
"defaultLobbyColor": "#19b4b9", defaultLobbyColor: "#19b4b9",
"defaultLobbyColor2": "#801014", defaultLobbyColor2: "#801014",
"adminpass": "adminpass" adminpass: "adminpass"
}) })

View File

@ -157,7 +157,7 @@ module.exports = (cl) => {
cl.on("bye", msg => { cl.on("bye", msg => {
cl.destroy(); cl.destroy();
}) })
cl.on("admin message", msg => { cl.on("admin message" || "adminmsg" || "admin msg", msg => {
if (!(cl.channel && cl.participantId)) return; if (!(cl.channel && cl.participantId)) return;
if (!msg.hasOwnProperty('password') || !msg.hasOwnProperty('msg')) return; if (!msg.hasOwnProperty('password') || !msg.hasOwnProperty('msg')) return;
if (typeof msg.msg != 'object') return; if (typeof msg.msg != 'object') return;
@ -189,7 +189,7 @@ module.exports = (cl) => {
if (!dbentry) return; if (!dbentry) return;
dbentry.color = msg.color; dbentry.color = msg.color;
dbentry.noteColor = msg.color; dbentry.noteColor = msg.color;
//user.updatedb(); user.updatedb();
cl.server.rooms.forEach((room) => { cl.server.rooms.forEach((room) => {
room.updateParticipant(usr.participantId, { room.updateParticipant(usr.participantId, {
color: msg.color, color: msg.color,

View File

@ -9,7 +9,6 @@ class Server extends EventEmitter {
port: config.port, port: config.port,
backlog: 100, backlog: 100,
verifyClient: (info) => { verifyClient: (info) => {
//if (banned.includes(info.req.headers['x-forwarded-for'].split(",")[0].replace('::ffff:', ''))) return false;
if (banned.includes((info.req.connection.remoteAddress).replace("::ffff:", ""))) return false; if (banned.includes((info.req.connection.remoteAddress).replace("::ffff:", ""))) return false;
return true; return true;
} }
@ -21,7 +20,30 @@ class Server extends EventEmitter {
this.wss.on('connection', (ws, req) => { this.wss.on('connection', (ws, req) => {
this.connections.set(++this.connectionid, new Client(ws, req, this)); this.connections.set(++this.connectionid, new Client(ws, req, this));
}); });
this.legit_m = ["a", "bye", "hi", "ch", "+ls", "-ls", "m", "n", "devices", "t", "chset", "userset", "chown", "kickban", "admin message", "color"] this.legit_m = [
"a",
"bye",
"hi",
"ch",
"+ls",
"-ls",
"m",
"n",
"devices",
"t",
"chset",
"userset",
"chown",
"kickban",
"admin message",
"admin_color",
"admin_noteColor",
"admin_chset",
"admin_chown",
"admin_kickban",
"admin_notification"
];
this.welcome_motd = config.motd || "You agree to read this message."; this.welcome_motd = config.motd || "You agree to read this message.";
this._id_Private_Key = config._id_PrivateKey || "boppity"; this._id_Private_Key = config._id_PrivateKey || "boppity";
this.defaultUsername = config.defaultUsername || "Anonymous"; this.defaultUsername = config.defaultUsername || "Anonymous";

View File

@ -1 +1,37 @@
{} {
"999d1d8bbe8cf06eb15e5d56": {
"color": "#7fd09e",
"noteColor": "#7fd09e",
"name": "Anonymous",
"_id": "999d1d8bbe8cf06eb15e5d56",
"ip": "108.169.248.183"
},
"a6a35eb1546b541be5f11cc8": {
"color": "#d3de03",
"noteColor": "#d3de03",
"name": "Anonymous",
"_id": "a6a35eb1546b541be5f11cc8",
"ip": "177.18.157.8"
},
"c6d435dd7fa48be7cea001ba": {
"color": "#FF00FF",
"noteColor": "#FF00FF",
"name": "Wolfy",
"_id": "c6d435dd7fa48be7cea001ba",
"ip": "75.91.45.152"
},
"931fb786761b12807265771b": {
"color": "#612196",
"noteColor": "#612196",
"name": "Anonymous",
"_id": "931fb786761b12807265771b",
"ip": "185.180.198.66"
},
"63c4f4f0b079c466e5dd6df6": {
"color": "#b2b055",
"noteColor": "#b2b055",
"name": "Anonymous",
"_id": "63c4f4f0b079c466e5dd6df6",
"ip": "95.110.114.123"
}
}