forked from Hri7566/mpp-server-dev2
something
This commit is contained in:
parent
9c44d8d519
commit
23c9971688
|
@ -82,7 +82,6 @@ class Client extends EventEmitter {
|
||||||
chown: new RateLimitChain(quotas.chown.amount, quotas.chown.time),
|
chown: new RateLimitChain(quotas.chown.amount, quotas.chown.time),
|
||||||
userset: new RateLimitChain(quotas.userset.amount, quotas.userset.time),
|
userset: new RateLimitChain(quotas.userset.amount, quotas.userset.time),
|
||||||
kickban: new RateLimitChain(quotas.kickban.amount, quotas.kickban.time),
|
kickban: new RateLimitChain(quotas.kickban.amount, quotas.kickban.time),
|
||||||
|
|
||||||
note: new Quota(Quota.PARAMS_LOBBY),
|
note: new Quota(Quota.PARAMS_LOBBY),
|
||||||
chset: new Quota(Quota.PARAMS_USED_A_LOT),
|
chset: new Quota(Quota.PARAMS_USED_A_LOT),
|
||||||
"+ls": new Quota(Quota.PARAMS_USED_A_LOT),
|
"+ls": new Quota(Quota.PARAMS_USED_A_LOT),
|
||||||
|
@ -129,4 +128,4 @@ class Client extends EventEmitter {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = Client;
|
module.exports = Client;
|
||||||
|
|
|
@ -192,7 +192,7 @@ module.exports = (cl) => {
|
||||||
let dbentry = user.userdb.get(uSr._id);
|
let dbentry = user.userdb.get(uSr._id);
|
||||||
if (!dbentry) return;
|
if (!dbentry) return;
|
||||||
dbentry.color = msg.color;
|
dbentry.color = 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
|
||||||
|
@ -204,4 +204,4 @@ module.exports = (cl) => {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Room extends EventEmitter {
|
||||||
//cl.quotas.a.setParams(Quota.PARAMS_A_NORMAL);
|
//cl.quotas.a.setParams(Quota.PARAMS_A_NORMAL);
|
||||||
}
|
}
|
||||||
this.ppl.set(participantId, cl);
|
this.ppl.set(participantId, cl);
|
||||||
|
|
||||||
this.connections.push(cl);
|
this.connections.push(cl);
|
||||||
this.sendArray([{
|
this.sendArray([{
|
||||||
color: this.ppl.get(cl.participantId).user.color,
|
color: this.ppl.get(cl.participantId).user.color,
|
||||||
|
@ -110,17 +110,13 @@ class Room extends EventEmitter {
|
||||||
options.name ? this.ppl.get(pid).user.name = options.name : {};
|
options.name ? this.ppl.get(pid).user.name = options.name : {};
|
||||||
options._id ? this.ppl.get(pid).user._id = options._id : {};
|
options._id ? this.ppl.get(pid).user._id = options._id : {};
|
||||||
options.color ? this.ppl.get(pid).user.color = options.color : {};
|
options.color ? this.ppl.get(pid).user.color = options.color : {};
|
||||||
options.noteColor ? this.ppl.get(pid).user.noteColor = options.noteColor : {};
|
|
||||||
this.connections.filter((ofo) => ofo.participantId == p.participantId).forEach((usr) => {
|
this.connections.filter((ofo) => ofo.participantId == p.participantId).forEach((usr) => {
|
||||||
options.name ? usr.user.name = options.name : {};
|
options.name ? usr.user.name = options.name : {};
|
||||||
options._id ? usr.user._id = options._id : {};
|
options._id ? usr.user._id = options._id : {};
|
||||||
options.color ? usr.user.color = options.color : {};
|
options.color ? usr.user.color = options.color : {};
|
||||||
options.noteColor ? usr.user.noteColor = options.noteColor : {};
|
|
||||||
})
|
})
|
||||||
this.sendArray([{
|
this.sendArray([{
|
||||||
color: p.user.color,
|
color: p.user.color,
|
||||||
noteColor: p.user.noteColor,
|
|
||||||
//noteColor: "#000",
|
|
||||||
id: p.participantId,
|
id: p.participantId,
|
||||||
m: "p",
|
m: "p",
|
||||||
name: p.user.name,
|
name: p.user.name,
|
||||||
|
@ -429,4 +425,4 @@ class Room extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
module.exports = Room;
|
module.exports = Room;
|
||||||
|
|
|
@ -18,7 +18,6 @@ class User {
|
||||||
if (typeof usertofind == 'object' && (usertofind.hasOwnProperty('name') && usertofind.name != this.server.defaultUsername)) return;
|
if (typeof usertofind == 'object' && (usertofind.hasOwnProperty('name') && usertofind.name != this.server.defaultUsername)) return;
|
||||||
userdb.set(_id, {
|
userdb.set(_id, {
|
||||||
"color": `#${ColorEncoder.intToRGB(ColorEncoder.hashCode(_id)).toLowerCase()}`,
|
"color": `#${ColorEncoder.intToRGB(ColorEncoder.hashCode(_id)).toLowerCase()}`,
|
||||||
"noteColor": `#${ColorEncoder.intToRGB(ColorEncoder.hashCode(_id)).toLowerCase()}`,
|
|
||||||
"name": this.server.defaultUsername,
|
"name": this.server.defaultUsername,
|
||||||
"_id": _id,
|
"_id": _id,
|
||||||
"ip": this.cl.ip
|
"ip": this.cl.ip
|
||||||
|
@ -28,7 +27,6 @@ class User {
|
||||||
let user = userdb.get(_id);
|
let user = userdb.get(_id);
|
||||||
return {
|
return {
|
||||||
"color": user.color,
|
"color": user.color,
|
||||||
"noteColor": user.noteColor,
|
|
||||||
"name": user.name,
|
"name": user.name,
|
||||||
"_id": user._id,
|
"_id": user._id,
|
||||||
}
|
}
|
||||||
|
@ -52,4 +50,4 @@ class User {
|
||||||
return [...strMap.entries()].reduce((obj, [key, value]) => (obj[key] = value, obj), {});
|
return [...strMap.entries()].reduce((obj, [key, value]) => (obj[key] = value, obj), {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = User;
|
module.exports = User;
|
||||||
|
|
Loading…
Reference in New Issue