diff --git a/bower.json b/bower.json index bfc74af20..c680abdd6 100644 --- a/bower.json +++ b/bower.json @@ -40,7 +40,7 @@ "less": "^2.7.2", "bootstrap": "#v4.0.0-alpha.6", "diff-dom": "2.1.1", - "nthen": "^0.1.5" + "nthen": "^0.1.5", "open-sans-fontface": "^1.4.2" } } diff --git a/www/common/sframe-chainpad-netflux-outer.js b/www/common/sframe-chainpad-netflux-outer.js index 01b26d494..904cb9521 100644 --- a/www/common/sframe-chainpad-netflux-outer.js +++ b/www/common/sframe-chainpad-netflux-outer.js @@ -29,6 +29,7 @@ define([], function () { var readOnly = conf.readOnly || false; var network = conf.network; var sframeChan = conf.sframeChan; + var onConnect = conf.onConnect || function () { }; conf = undefined; var initializing = true; @@ -40,7 +41,7 @@ define([], function () { messageFromInner(message, cb); }); - var onReady = function () { + var onReady = function (wc) { // Trigger onReady only if not ready yet. This is important because the history keeper sends a direct // message through "network" when it is synced, and it triggers onReady for each channel joined. if (!initializing) { return; } @@ -131,6 +132,9 @@ define([], function () { wcObject.wc = wc; channel = wc.id; + onConnect(wc); + onConnect = function () { }; + // Add the existing peers in the userList sframeChan.event('EV_RT_CONNECT', { myID: wc.myID, members: wc.members, readOnly: readOnly }); diff --git a/www/pad2/main.js b/www/pad2/main.js index 62cc64922..e4874a532 100644 --- a/www/pad2/main.js +++ b/www/pad2/main.js @@ -641,7 +641,7 @@ define([ } } } else { - Title.updateTitle(Cryptpad.initialName || Title.defaultTitle); + //Title.updateTitle(Cryptpad.initialName || Title.defaultTitle); documentBody.innerHTML = Messages.initialState; } diff --git a/www/pad2/outer.js b/www/pad2/outer.js index 2b88bb420..526035d3d 100644 --- a/www/pad2/outer.js +++ b/www/pad2/outer.js @@ -18,6 +18,10 @@ define([ })); Cryptpad.ready(waitFor()); }).nThen(function (waitFor) { + var secret = Cryptpad.getSecrets(); + var readOnly = secret.keys && !secret.keys.editKeyStr; + if (!secret.keys) { secret.keys = secret.key; } + var parsed = Cryptpad.parsePadUrl(window.location.href); parsed.type = parsed.type.replace('pad2', 'pad'); if (!parsed.type) { throw new Error(); } @@ -55,10 +59,6 @@ define([ } }); - var secret = Cryptpad.getSecrets(); - var readOnly = secret.keys && !secret.keys.editKeyStr; - if (!secret.keys) { secret.keys = secret.key; } - CpNfOuter.start({ sframeChan: sframeChan, channel: secret.channel, @@ -66,6 +66,10 @@ define([ validateKey: secret.keys.validateKey || undefined, readOnly: readOnly, crypto: Crypto.createEncryptor(secret.keys), + onConnect: function (wc) { + if (readOnly) { return; } + Cryptpad.replaceHash(Cryptpad.getEditHashFromKeys(wc.id, secret.keys)); + } }); }); }); \ No newline at end of file