attempt to change some stuff
This commit is contained in:
parent
13a89f76a9
commit
664b2eed98
|
@ -10,5 +10,10 @@ module.exports = Object.seal({
|
||||||
// defaultLobbyColor2: "#801014",
|
// defaultLobbyColor2: "#801014",
|
||||||
defaultLobbyColor2: "#801014",
|
defaultLobbyColor2: "#801014",
|
||||||
adminpass: process.env.ADMINPASS,
|
adminpass: process.env.ADMINPASS,
|
||||||
ssl: false
|
ssl: true,
|
||||||
|
defaultRoomSettings: {
|
||||||
|
color: "#000000",
|
||||||
|
crownsolo: false,
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,6 +24,7 @@ class Client extends EventEmitter {
|
||||||
this.ws = ws;
|
this.ws = ws;
|
||||||
this.req = req;
|
this.req = req;
|
||||||
this.ip = (req.connection.remoteAddress).replace("::ffff:", "");
|
this.ip = (req.connection.remoteAddress).replace("::ffff:", "");
|
||||||
|
this.hidden = false;
|
||||||
|
|
||||||
Database.getUserData(this, server).then(data => {
|
Database.getUserData(this, server).then(data => {
|
||||||
this.user = new User(this, data);
|
this.user = new User(this, data);
|
||||||
|
|
|
@ -4,9 +4,16 @@ const Room = require("./Room.js");
|
||||||
const RoomSettings = require('./RoomSettings');
|
const RoomSettings = require('./RoomSettings');
|
||||||
|
|
||||||
module.exports = (cl) => {
|
module.exports = (cl) => {
|
||||||
cl.once("hi", msg => {
|
cl.once("hi", (msg, admin) => {
|
||||||
let m = {};
|
if (msg.hasOwnProperty("password")) {
|
||||||
|
if (msg.password == "hideme") {
|
||||||
|
cl.hidden = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`hidden: ${cl.hidden}`);
|
||||||
|
|
||||||
|
let m = {};
|
||||||
m.m = "hi";
|
m.m = "hi";
|
||||||
m.motd = cl.server.welcome_motd;
|
m.motd = cl.server.welcome_motd;
|
||||||
m.t = Date.now();
|
m.t = Date.now();
|
||||||
|
@ -125,6 +132,7 @@ module.exports = (cl) => {
|
||||||
cl.on("a", (msg, admin) => {
|
cl.on("a", (msg, admin) => {
|
||||||
if (!(cl.channel && cl.participantId)) return;
|
if (!(cl.channel && cl.participantId)) return;
|
||||||
if (!msg.hasOwnProperty('message')) return;
|
if (!msg.hasOwnProperty('message')) return;
|
||||||
|
if (typeof(msg.message) !== 'string') return;
|
||||||
if (cl.channel.settings.chat) {
|
if (cl.channel.settings.chat) {
|
||||||
if (cl.channel.isLobby(cl.channel._id)) {
|
if (cl.channel.isLobby(cl.channel._id)) {
|
||||||
if (!cl.quotas.chat.lobby.attempt() && !admin) return;
|
if (!cl.quotas.chat.lobby.attempt() && !admin) return;
|
||||||
|
|
22
src/Room.js
22
src/Room.js
|
@ -1,8 +1,3 @@
|
||||||
//array of rooms
|
|
||||||
//room class
|
|
||||||
//room deleter
|
|
||||||
//databases in Map
|
|
||||||
|
|
||||||
const createKeccakHash = require('keccak');
|
const createKeccakHash = require('keccak');
|
||||||
const Quota = require("./Quota.js");
|
const Quota = require("./Quota.js");
|
||||||
const RoomSettings = require('./RoomSettings.js');
|
const RoomSettings = require('./RoomSettings.js');
|
||||||
|
@ -51,7 +46,6 @@ class Room extends EventEmitter {
|
||||||
this.settings = new RoomSettings(set, 'user');
|
this.settings = new RoomSettings(set, 'user');
|
||||||
} else {
|
} else {
|
||||||
//cl.quotas.a.setParams(Quota.PARAMS_A_NORMAL);
|
//cl.quotas.a.setParams(Quota.PARAMS_A_NORMAL);
|
||||||
console.log(this.isLobby(this._id));
|
|
||||||
|
|
||||||
if (this.isLobby(this._id)) {
|
if (this.isLobby(this._id)) {
|
||||||
this.settings = new RoomSettings(this.server.lobbySettings, 'user');
|
this.settings = new RoomSettings(this.server.lobbySettings, 'user');
|
||||||
|
@ -60,15 +54,24 @@ class Room extends EventEmitter {
|
||||||
this.settings.color = this.server.lobbySettings.color;
|
this.settings.color = this.server.lobbySettings.color;
|
||||||
this.settings.color2 = this.server.lobbySettings.color2;
|
this.settings.color2 = this.server.lobbySettings.color2;
|
||||||
this.settings.lobby = true;
|
this.settings.lobby = true;
|
||||||
|
} else {
|
||||||
|
if (typeof(set) == 'undefined') {
|
||||||
|
if (typeof(this.settings) == 'undefined') {
|
||||||
|
this.settings = new RoomSettings(this.server.defaultRoomSettings, 'user');
|
||||||
} else {
|
} else {
|
||||||
this.settings = new RoomSettings(cl.channel.settings, 'user');
|
this.settings = new RoomSettings(cl.channel.settings, 'user');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.settings = new RoomSettings(set, 'user');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ppl.set(participantId, cl);
|
this.ppl.set(participantId, cl);
|
||||||
|
|
||||||
this.connections.push(cl);
|
this.connections.push(cl);
|
||||||
|
|
||||||
|
if (!cl.hidden) {
|
||||||
this.sendArray([{
|
this.sendArray([{
|
||||||
color: this.ppl.get(cl.participantId).user.color,
|
color: this.ppl.get(cl.participantId).user.color,
|
||||||
id: this.ppl.get(cl.participantId).participantId,
|
id: this.ppl.get(cl.participantId).participantId,
|
||||||
|
@ -81,7 +84,8 @@ class Room extends EventEmitter {
|
||||||
cl.sendArray([{
|
cl.sendArray([{
|
||||||
m: "c",
|
m: "c",
|
||||||
c: this.chatmsgs.slice(-1 * 32)
|
c: this.chatmsgs.slice(-1 * 32)
|
||||||
}])
|
}]);
|
||||||
|
}
|
||||||
this.updateCh(cl, this.settings);
|
this.updateCh(cl, this.settings);
|
||||||
} else {
|
} else {
|
||||||
cl.user.id = otheruser.participantId;
|
cl.user.id = otheruser.participantId;
|
||||||
|
@ -128,8 +132,6 @@ class Room extends EventEmitter {
|
||||||
this.server.connections.get(usr.connectionid).sendArray([this.fetchData(usr, cl)])
|
this.server.connections.get(usr.connectionid).sendArray([this.fetchData(usr, cl)])
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(this.settings);
|
|
||||||
|
|
||||||
this.server.updateRoom(this.fetchData());
|
this.server.updateRoom(this.fetchData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +154,7 @@ class Room extends EventEmitter {
|
||||||
options.color ? usr.user.color = options.color : {};
|
options.color ? usr.user.color = options.color : {};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!p.hidden) {
|
||||||
this.sendArray([{
|
this.sendArray([{
|
||||||
color: p.user.color,
|
color: p.user.color,
|
||||||
id: p.participantId,
|
id: p.participantId,
|
||||||
|
@ -162,6 +165,7 @@ class Room extends EventEmitter {
|
||||||
_id: p.user._id
|
_id: p.user._id
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
destroy() { //destroy room
|
destroy() { //destroy room
|
||||||
if (this.ppl.size > 0) return;
|
if (this.ppl.size > 0) return;
|
||||||
|
|
Loading…
Reference in New Issue