diff --git a/src/public/main.js b/src/public/main.js index 2923fba..45ccddf 100644 --- a/src/public/main.js +++ b/src/public/main.js @@ -285,6 +285,10 @@ $(function() { removeChatTyping(data); }); + socket.on('first', function() { + $('.modal').modal('show'); + }); + setUsername(); $('span.key-btn').click(function() { diff --git a/src/room.js b/src/room.js index d765400..97bf3cf 100644 --- a/src/room.js +++ b/src/room.js @@ -24,6 +24,10 @@ class Room { socket.on('add user', (username) => { if (addedUser) return; + if (this.numUsers === 0) { + socket.emit('first'); + } + // we store the username in the socket session for this client socket.username = username; ++this.numUsers; diff --git a/src/views/index.mustache b/src/views/index.mustache index 258e96c..7dbfbe7 100644 --- a/src/views/index.mustache +++ b/src/views/index.mustache @@ -30,7 +30,7 @@
Enter your key below
+This is your chat encryption key. Anyone who is in this chat room must use the same key to decrypt chat messages. This key is NOT stored nor transmitted to the server. If the key does not match, other clients will see encrypted messages. You may change the key as many times as you want.