Improve history to load it chunk by chunk

This commit is contained in:
yflory
2018-06-19 16:59:59 +02:00
parent 60db53a993
commit 29f577dfc6
9 changed files with 314 additions and 107 deletions

View File

@@ -420,6 +420,24 @@ define([
}));
});
});
sframeChan.on('Q_GET_HISTORY_RANGE', function (data, cb) {
var crypto = Crypto.createEncryptor(secret.keys);
Cryptpad.getHistoryRange({
channel: secret.channel,
validateKey: secret.keys.validateKey,
lastKnownHash: data.lastKnownHash
}, function (data) {
cb({
isFull: data.isFull,
messages: data.messages.map(function (msg) {
// The 3rd parameter "true" means we're going to skip signature validation.
// We don't need it since the message is already validated serverside by hk
return crypto.decrypt(msg, true, true);
}),
lastKnownHash: data.lastKnownHash
});
});
});
sframeChan.on('Q_GET_PAD_ATTRIBUTE', function (data, cb) {
var href;