diff --git a/www/common/common-hash.js b/www/common/common-hash.js index 2bbf2c7e2..d7d95e78a 100644 --- a/www/common/common-hash.js +++ b/www/common/common-hash.js @@ -125,7 +125,7 @@ Version 1 url += ret.type + '/'; if (!ret.hashData) { return url; } if (ret.hashData.type !== 'pad') { return url + '#' + ret.hash; } - if (ret.hashData.version !== 1) { throw new Error("Only v1 hashes are managed here."); } + if (ret.hashData.version !== 1) { return url + '#' + ret.hash; } url += '#/' + ret.hashData.version + '/' + ret.hashData.mode + '/' + ret.hashData.channel.replace(/\//g, '-') + diff --git a/www/common/sframe-chainpad-netflux-outer.js b/www/common/sframe-chainpad-netflux-outer.js index 4fd3a2c61..5d8337251 100644 --- a/www/common/sframe-chainpad-netflux-outer.js +++ b/www/common/sframe-chainpad-netflux-outer.js @@ -24,6 +24,7 @@ define([], function () { var channel = conf.channel; var Crypto = conf.crypto; var validateKey = conf.validateKey; + var isNewHash = conf.isNewHash; var readOnly = conf.readOnly || false; var padRpc = conf.padRpc; var sframeChan = conf.sframeChan; @@ -40,7 +41,7 @@ define([], function () { // shim between chainpad and netflux var msgIn = function (msg) { try { - var decryptedMsg = Crypto.decrypt(msg, validateKey); + var decryptedMsg = Crypto.decrypt(msg, isNewHash); return decryptedMsg; } catch (err) { console.error(err); diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 4fcd0e298..a5ad06e03 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -138,7 +138,6 @@ define([ // Check if the pad exists on server if (!window.location.hash) { isNewFile = true; return; } Cryptpad.getFileSize(window.location.href, waitFor(function (err, size) { - console.log(size); if (size) { isNewFile = false; return; @@ -146,9 +145,12 @@ define([ isNewFile = true; })); }).nThen(function () { - console.log(isNewFile); var readOnly = secret.keys && !secret.keys.editKeyStr; - if (!secret.keys) { secret.keys = secret.key; } + var isNewHash = true; + if (!secret.keys) { + isNewHash = false; + secret.keys = secret.key; + } var parsed = Utils.Hash.parsePadUrl(window.location.href); if (!parsed.type) { throw new Error(); } var defaultTitle = Utils.Hash.getDefaultName(parsed); @@ -581,6 +583,7 @@ define([ channel: secret.channel, padRpc: Cryptpad.padRpc, validateKey: secret.keys.validateKey || undefined, + isNewHash: isNewHash, readOnly: readOnly, crypto: Crypto.createEncryptor(secret.keys), onConnect: function (wc) { diff --git a/www/profile/main.js b/www/profile/main.js index 22823d0d9..234e28d8a 100644 --- a/www/profile/main.js +++ b/www/profile/main.js @@ -93,7 +93,6 @@ define([ getSecrets: getSecrets, noHash: true, // Don't add the hash in the URL if it doesn't already exist addRpc: addRpc, - noRealtime: !localStorage.User_hash }); }); });