Restrict sending messages in a pad chat to editors only

This commit is contained in:
yflory
2018-12-10 17:47:47 +01:00
parent a2e28e6e25
commit d88dee9a83
7 changed files with 59 additions and 22 deletions

View File

@@ -107,7 +107,6 @@ define([
}
chan.encryptor = Crypto.createEncryptor(secret.keys);
if (!chan.encryptor) { chan.encryptor = Crypto.createEncryptor(secret.keys); }
wc.on('join', function () {
@@ -117,7 +116,7 @@ define([
ctx.emit('MESSAGE', {leave: true, id: peer}, chan.clients);
});
wc.on('message', function (cryptMsg) {
var msg = chan.encryptor.decrypt(cryptMsg, secret.keys.validateKey);
var msg = chan.encryptor.decrypt(cryptMsg, secret.keys && secret.keys.validateKey);
var parsed;
try {
parsed = JSON.parse(msg);