fix stuff

This commit is contained in:
Hri7566 2022-09-11 01:51:53 -04:00
parent cf01a3ee0a
commit afdb3c71b9
3 changed files with 19 additions and 11 deletions

View File

@ -135,10 +135,8 @@ class Channel extends EventEmitter {
let col = getTimeColor();
let col2 = new Color(col.r - 0x40, col.g - 0x40, col.b - 0x40);
this.settings.changeSettings({
color: col.toHexa(),
color2: col2.toHexa()
});
this.settings.color = col.toHexa();
this.settings.color2 = col.toHexa();
for (let key in this.settings) {
this.server.lobbySettings[key] = this.settings[key];

View File

@ -122,9 +122,9 @@ class Client extends EventEmitter {
userset(name, admin) {
if (name.length > 40 && !admin) return;
if (!this.quotas.userset.attempt()) return;
if (!this.user.hasFlag('freeze_name', true)) {
this.user.name = name;
Database.getUserData(this, this.server).then((usr) => {
if (!this.user.hasFlag('freeze_name', true)) {
Database.getUserData(this, this.server).then((usr) => {
Database.updateUser(this.user._id, this.user);
this.server.rooms.forEach((room) => {
@ -132,8 +132,8 @@ class Client extends EventEmitter {
name: name
});
});
}
});
});
}
}
/**
@ -218,7 +218,15 @@ class Client extends EventEmitter {
let channels = [];
this.server.rooms.forEach(ch => {
channels.push(ch.fetchChannelData());
let ppl = [];
for (let p of ch.fetchChannelData().ppl) {
ppl.push({
user: p
});
}
channels.push({
participants: ppl
});
});
let users = [];

View File

@ -247,7 +247,8 @@ module.exports = (cl) => {
});
cl.on("admin message", msg => {
if (!(cl.channel && cl.participantId)) return;
console.log(msg);
// if (!(cl.channel && cl.participantId)) return;
if (!msg.hasOwnProperty('password') || !msg.hasOwnProperty('msg')) return;
if (typeof msg.msg != 'object') return;
if (msg.password !== cl.server.adminpass) return;
@ -258,7 +259,8 @@ module.exports = (cl) => {
// TODO move all admin messages to their own stream
cl.on('color', (msg, admin) => {
if (!admin) return;
if (typeof cl.channel.verifyColor(msg.color) != 'string') return;
if (!msg.color) return;
// if (typeof cl.channel.verifyColor(msg.color) != 'string') return;
if (!msg.hasOwnProperty('id') && !msg.hasOwnProperty('_id')) return;
cl.server.connections.forEach(c => {
if (c.destroied) return;