From d88dee9a834483036a3d4664e2851dabca281fbc Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 10 Dec 2018 17:47:47 +0100 Subject: [PATCH] Restrict sending messages in a pad chat to editors only --- www/common/common-hash.js | 1 + www/common/common-messenger.js | 58 +++++++++++++++++++++++++-------- www/common/outer/async-store.js | 3 ++ www/common/outer/cursor.js | 3 +- www/common/sframe-common.js | 7 ++-- www/common/toolbar3.js | 2 +- www/contacts/messenger-ui.js | 7 ++-- 7 files changed, 59 insertions(+), 22 deletions(-) diff --git a/www/common/common-hash.js b/www/common/common-hash.js index d5066b757..e089852cc 100644 --- a/www/common/common-hash.js +++ b/www/common/common-hash.js @@ -12,6 +12,7 @@ define([ var hexToBase64 = Util.hexToBase64; var base64ToHex = Util.base64ToHex; Hash.encodeBase64 = Nacl.util.encodeBase64; + Hash.decodeBase64 = Nacl.util.decodeBase64; // This implementation must match that on the server // it's used for a checksum diff --git a/www/common/common-messenger.js b/www/common/common-messenger.js index 081cd311f..b400d1dae 100644 --- a/www/common/common-messenger.js +++ b/www/common/common-messenger.js @@ -26,6 +26,15 @@ define([ return JSON.parse(JSON.stringify(o)); }; + var convertToUint8 = function (obj) { + var l = Object.keys(obj).length; + var u = new Uint8Array(l); + for (var i = 0; i