From 2be78deb93e279b096a3435808ff7912b53400f6 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 19 Jul 2018 17:07:14 +0200 Subject: [PATCH] Fix Drive history --- www/common/sframe-common-outer.js | 15 ++++++++++++--- www/drive/main.js | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 8fefceb02..bb86c44f4 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -421,10 +421,19 @@ define([ }); }); sframeChan.on('Q_GET_HISTORY_RANGE', function (data, cb) { - var crypto = Crypto.createEncryptor(secret.keys); + var nSecret = secret; + if (cfg.isDrive) { + var hash = Utils.LocalStore.getUserHash() || Utils.LocalStore.getFSHash(); + if (hash) { + nSecret = Utils.Hash.getSecrets('drive', hash); + } + } + var channel = nSecret.channel; + var validate = nSecret.keys.validateKey; + var crypto = Crypto.createEncryptor(nSecret.keys); Cryptpad.getHistoryRange({ - channel: secret.channel, - validateKey: secret.keys.validateKey, + channel: channel, + validateKey: validate, lastKnownHash: data.lastKnownHash }, function (data) { cb({ diff --git a/www/drive/main.js b/www/drive/main.js index 21b563da9..b2912b211 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -102,7 +102,8 @@ define([ noHash: true, noRealtime: true, driveEvents: true, - addRpc: addRpc + addRpc: addRpc, + isDrive: true, }); }); });