Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

This commit is contained in:
ansuz 2020-02-14 13:49:23 -05:00
commit 58193a1969
5 changed files with 21 additions and 6 deletions

View File

@ -1969,7 +1969,11 @@ define([
first = false; first = false;
} }
msg = msg.replace(/cp\|(([A-Za-z0-9+\/=]+)\|)?/, ''); msg = msg.replace(/cp\|(([A-Za-z0-9+\/=]+)\|)?/, '');
msgs.push(msg); msgs.push({
msg: msg,
author: parsed[2][1],
time: parsed[2][5]
});
} }
}; };

View File

@ -70,7 +70,11 @@ define([
if (!Array.isArray(data.messages)) { return void console.error('Not an array!'); } if (!Array.isArray(data.messages)) { return void console.error('Not an array!'); }
lastKnownHash = data.lastKnownHash; lastKnownHash = data.lastKnownHash;
isComplete = data.isFull; isComplete = data.isFull;
Array.prototype.unshift.apply(allMessages, data.messages); // Destructive concat var messages = (data.messages || []).map(function (obj) {
return obj.msg;
});
if (config.debug) { console.log(data.messages); }
Array.prototype.unshift.apply(allMessages, messages); // Destructive concat
fillChainPad(realtime, allMessages); fillChainPad(realtime, allMessages);
cb (null, realtime, data.isFull); cb (null, realtime, data.isFull);
}); });

View File

@ -859,10 +859,14 @@ define([
}, function (data) { }, function (data) {
cb({ cb({
isFull: data.isFull, isFull: data.isFull,
messages: data.messages.map(function (msg) { messages: data.messages.map(function (obj) {
// The 3rd parameter "true" means we're going to skip signature validation. // 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 // We don't need it since the message is already validated serverside by hk
return crypto.decrypt(msg, true, true); return {
msg: crypto.decrypt(obj.msg, true, true),
author: obj.author,
time: obj.time
};
}), }),
lastKnownHash: data.lastKnownHash lastKnownHash: data.lastKnownHash
}); });

View File

@ -111,10 +111,13 @@ define([
} }
}; };
exp.removeCursors = function () { exp.removeCursors = function (inner) {
for (var id in cursors) { for (var id in cursors) {
deleteCursor(id); deleteCursor(id);
} }
// If diffdom has changed the cursor element somehow, we'll have cursor elements
// in the dom but not in memory: remove them
$(inner).find('.cp-cursor-position').remove();
}; };
exp.cursorGetter = function (hjson) { exp.cursorGetter = function (hjson) {

View File

@ -665,7 +665,7 @@ define([
// We have to remove the cursors before getting the content because they split // We have to remove the cursors before getting the content because they split
// the text nodes and OT/ChainPad would freak out // the text nodes and OT/ChainPad would freak out
cursors.removeCursors(); cursors.removeCursors(inner);
displayMediaTags(framework, inner, mediaTagMap); displayMediaTags(framework, inner, mediaTagMap);
inner.normalize(); inner.normalize();