forked from Hri7566/mpp-server-dev2
fix color
This commit is contained in:
parent
90790fbef2
commit
245f628ad6
|
@ -1,5 +1,5 @@
|
||||||
module.exports = Object.seal({
|
module.exports = Object.seal({
|
||||||
port: 8443,
|
port: 4000,
|
||||||
motd: "big th0nk",
|
motd: "big th0nk",
|
||||||
_id_PrivateKey: process.env.SALT,
|
_id_PrivateKey: process.env.SALT,
|
||||||
defaultUsername: "Anonymous",
|
defaultUsername: "Anonymous",
|
||||||
|
@ -10,7 +10,7 @@ module.exports = Object.seal({
|
||||||
// defaultLobbyColor2: "#801014",
|
// defaultLobbyColor2: "#801014",
|
||||||
defaultLobbyColor2: "#801014",
|
defaultLobbyColor2: "#801014",
|
||||||
adminpass: process.env.ADMINPASS,
|
adminpass: process.env.ADMINPASS,
|
||||||
ssl: true,
|
ssl: false,
|
||||||
defaultRoomSettings: {
|
defaultRoomSettings: {
|
||||||
color: "#000000",
|
color: "#000000",
|
||||||
crownsolo: false,
|
crownsolo: false,
|
||||||
|
|
|
@ -2,6 +2,7 @@ const Quota = require('./Quota');
|
||||||
const User = require("./User.js");
|
const User = require("./User.js");
|
||||||
const Room = require("./Room.js");
|
const Room = require("./Room.js");
|
||||||
const RoomSettings = require('./RoomSettings');
|
const RoomSettings = require('./RoomSettings');
|
||||||
|
const Database = require('./Database');
|
||||||
|
|
||||||
module.exports = (cl) => {
|
module.exports = (cl) => {
|
||||||
cl.once("hi", (msg, admin) => {
|
cl.once("hi", (msg, admin) => {
|
||||||
|
@ -11,8 +12,6 @@ module.exports = (cl) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`hidden: ${cl.hidden}`);
|
|
||||||
|
|
||||||
let m = {};
|
let m = {};
|
||||||
m.m = "hi";
|
m.m = "hi";
|
||||||
m.motd = cl.server.welcome_motd;
|
m.motd = cl.server.welcome_motd;
|
||||||
|
@ -191,7 +190,7 @@ module.exports = (cl) => {
|
||||||
if(!cl.quotas.userset.attempt()) return;
|
if(!cl.quotas.userset.attempt()) return;
|
||||||
cl.user.name = msg.set.name;
|
cl.user.name = msg.set.name;
|
||||||
let user = new User(cl);
|
let user = new User(cl);
|
||||||
user.getUserData().then((usr) => {
|
Database.getUserData().then((usr) => {
|
||||||
let dbentry = user.userdb.get(cl.user._id);
|
let dbentry = user.userdb.get(cl.user._id);
|
||||||
if (!dbentry) return;
|
if (!dbentry) return;
|
||||||
dbentry.name = msg.set.name;
|
dbentry.name = msg.set.name;
|
||||||
|
@ -238,14 +237,15 @@ module.exports = (cl) => {
|
||||||
if (!msg.hasOwnProperty('id') && !msg.hasOwnProperty('_id')) return;
|
if (!msg.hasOwnProperty('id') && !msg.hasOwnProperty('_id')) return;
|
||||||
cl.server.connections.forEach((usr) => {
|
cl.server.connections.forEach((usr) => {
|
||||||
if ((usr.channel && usr.participantId && usr.user) && (usr.user._id == msg._id || (usr.participantId == msg.id))) {
|
if ((usr.channel && usr.participantId && usr.user) && (usr.user._id == msg._id || (usr.participantId == msg.id))) {
|
||||||
let user = new User(usr);
|
if (!usr.hasOwnProperty('user')) return;
|
||||||
user.cl.user.color = msg.color;
|
let user = new User(usr, usr.user);
|
||||||
user.getUserData().then((uSr) => {
|
user.color = msg.color;
|
||||||
|
Database.getUserData(cl, cl.server).then((uSr) => {
|
||||||
if (!uSr._id) return;
|
if (!uSr._id) return;
|
||||||
let dbentry = user.userdb.get(uSr._id);
|
let dbentry = Database.userdb.get(uSr._id);
|
||||||
if (!dbentry) return;
|
if (!dbentry) return;
|
||||||
dbentry.color = msg.color;
|
dbentry.color = msg.color;
|
||||||
user.updatedb();
|
Database.update();
|
||||||
cl.server.rooms.forEach((room) => {
|
cl.server.rooms.forEach((room) => {
|
||||||
room.updateParticipant(usr.user._id, {
|
room.updateParticipant(usr.user._id, {
|
||||||
color: msg.color
|
color: msg.color
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Server extends EventEmitter {
|
||||||
this.https_server.listen(config.port);
|
this.https_server.listen(config.port);
|
||||||
} else {
|
} else {
|
||||||
this.wss = new WebSocket.Server({
|
this.wss = new WebSocket.Server({
|
||||||
port: 8443,
|
port: config.port,
|
||||||
backlog: 100,
|
backlog: 100,
|
||||||
verifyClient: (info) => {
|
verifyClient: (info) => {
|
||||||
if (banned.includes((info.req.connection.remoteAddress).replace("::ffff:", ""))) return false;
|
if (banned.includes((info.req.connection.remoteAddress).replace("::ffff:", ""))) return false;
|
||||||
|
|
Loading…
Reference in New Issue