fix stuff
This commit is contained in:
parent
cf01a3ee0a
commit
afdb3c71b9
|
@ -135,10 +135,8 @@ class Channel extends EventEmitter {
|
||||||
let col = getTimeColor();
|
let col = getTimeColor();
|
||||||
let col2 = new Color(col.r - 0x40, col.g - 0x40, col.b - 0x40);
|
let col2 = new Color(col.r - 0x40, col.g - 0x40, col.b - 0x40);
|
||||||
|
|
||||||
this.settings.changeSettings({
|
this.settings.color = col.toHexa();
|
||||||
color: col.toHexa(),
|
this.settings.color2 = col.toHexa();
|
||||||
color2: col2.toHexa()
|
|
||||||
});
|
|
||||||
|
|
||||||
for (let key in this.settings) {
|
for (let key in this.settings) {
|
||||||
this.server.lobbySettings[key] = this.settings[key];
|
this.server.lobbySettings[key] = this.settings[key];
|
||||||
|
|
|
@ -122,9 +122,9 @@ class Client extends EventEmitter {
|
||||||
userset(name, admin) {
|
userset(name, admin) {
|
||||||
if (name.length > 40 && !admin) return;
|
if (name.length > 40 && !admin) return;
|
||||||
if (!this.quotas.userset.attempt()) return;
|
if (!this.quotas.userset.attempt()) return;
|
||||||
|
if (!this.user.hasFlag('freeze_name', true)) {
|
||||||
this.user.name = name;
|
this.user.name = name;
|
||||||
Database.getUserData(this, this.server).then((usr) => {
|
Database.getUserData(this, this.server).then((usr) => {
|
||||||
if (!this.user.hasFlag('freeze_name', true)) {
|
|
||||||
Database.updateUser(this.user._id, this.user);
|
Database.updateUser(this.user._id, this.user);
|
||||||
|
|
||||||
this.server.rooms.forEach((room) => {
|
this.server.rooms.forEach((room) => {
|
||||||
|
@ -132,8 +132,8 @@ class Client extends EventEmitter {
|
||||||
name: name
|
name: name
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -218,7 +218,15 @@ class Client extends EventEmitter {
|
||||||
|
|
||||||
let channels = [];
|
let channels = [];
|
||||||
this.server.rooms.forEach(ch => {
|
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 = [];
|
let users = [];
|
||||||
|
|
|
@ -247,7 +247,8 @@ module.exports = (cl) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
cl.on("admin message", msg => {
|
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 (!msg.hasOwnProperty('password') || !msg.hasOwnProperty('msg')) return;
|
||||||
if (typeof msg.msg != 'object') return;
|
if (typeof msg.msg != 'object') return;
|
||||||
if (msg.password !== cl.server.adminpass) return;
|
if (msg.password !== cl.server.adminpass) return;
|
||||||
|
@ -258,7 +259,8 @@ module.exports = (cl) => {
|
||||||
// TODO move all admin messages to their own stream
|
// TODO move all admin messages to their own stream
|
||||||
cl.on('color', (msg, admin) => {
|
cl.on('color', (msg, admin) => {
|
||||||
if (!admin) return;
|
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;
|
if (!msg.hasOwnProperty('id') && !msg.hasOwnProperty('_id')) return;
|
||||||
cl.server.connections.forEach(c => {
|
cl.server.connections.forEach(c => {
|
||||||
if (c.destroied) return;
|
if (c.destroied) return;
|
||||||
|
|
Loading…
Reference in New Issue