diff --git a/api/v1/gateway/index.js b/api/v1/gateway/index.js index e647e9d..275ff02 100644 --- a/api/v1/gateway/index.js +++ b/api/v1/gateway/index.js @@ -128,8 +128,9 @@ GatewayServer.prototype.eventSetup = function() { socket.user = { username: data.username, _id: user._id, - token, // Maybe not secure - permissionLevel + token, // NOTE(hippoz): Maybe not secure + permissionLevel, + color: user.color }; console.log(`[*] [gateway] [handshake] User ${data.username} has successfully authenticated`); return callback(); @@ -168,7 +169,8 @@ GatewayServer.prototype.eventSetup = function() { const messageObject = { author: { username: socket.user.username, - _id: socket.user._id + _id: socket.user._id, + color: socket.user.color }, category: { title: categoryTitle, @@ -236,7 +238,8 @@ GatewayServer.prototype._getSocketsInRoom = async function(room) { updatedClientList.push({ user: { username: client.user.username, - _id: client.user._id + _id: client.user._id, + color: client.user.color } }); }); diff --git a/api/v1/users.js b/api/v1/users.js index 26a1340..08f345c 100755 --- a/api/v1/users.js +++ b/api/v1/users.js @@ -53,7 +53,8 @@ app.post('/account/create', [ username, email, password: hashedPassword, - role: startingRole + role: startingRole, + color: User.generateColorFromUsername(username) }); const userObject = await user.getPublicObject(); diff --git a/app/app.html b/app/app.html index 23f9d77..8477e53 100755 --- a/app/app.html +++ b/app/app.html @@ -142,7 +142,7 @@