diff --git a/www/common/common-hash.js b/www/common/common-hash.js index cc4344413..0fd85f909 100644 --- a/www/common/common-hash.js +++ b/www/common/common-hash.js @@ -162,6 +162,17 @@ Version 1 /code/#/1/edit/3Ujt4F2Sjnjbis6CoYWpoQ/usn4+9CqVja8Q7RZOGTfRgqI */ + var getVersionHash = function (hashArr) { + var k; + // Check if we have a ownerKey for this pad + hashArr.some(function (data) { + if (/^hash=/.test(data)) { + k = data.slice(5); + return true; + } + }); + return k; + }; var getOwnerKey = function (hashArr) { var k; // Check if we have a ownerKey for this pad @@ -183,6 +194,7 @@ Version 1 parsed.password = options.indexOf('p') !== -1; parsed.present = options.indexOf('present') !== -1; parsed.embed = options.indexOf('embed') !== -1; + parsed.versionHash = getVersionHash(options); parsed.ownerKey = getOwnerKey(options); }; @@ -194,6 +206,7 @@ Version 1 embed: parsed.embed, present: parsed.present, ownerKey: parsed.ownerKey, + versionHash: parsed.versionHash, password: parsed.password }; }; @@ -213,6 +226,7 @@ Version 1 if (parsed.password || opts.password) { hash += 'p/'; } if (opts.embed) { hash += 'embed/'; } if (opts.present) { hash += 'present/'; } + var versionHash = typeof(opts.versionHash) !== "undefined" ? opts.versionHash : parsed.versionHash; return hash; }; diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index b5be30fa1..01122f89d 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -2035,6 +2035,7 @@ define([ } msg = msg.replace(/cp\|(([A-Za-z0-9+\/=]+)\|)?/, ''); msgs.push({ + serverHash: msg.slice(0,64), msg: msg, author: parsed[2][1], time: parsed[2][5] diff --git a/www/common/sframe-common-history.js b/www/common/sframe-common-history.js index d3d298197..399357106 100644 --- a/www/common/sframe-common-history.js +++ b/www/common/sframe-common-history.js @@ -71,9 +71,6 @@ define([ lastKnownHash = data.lastKnownHash; isComplete = data.isFull; var messages = (data.messages || []).map(function (obj) { - if (!config.debug) { - return obj.msg; - } return obj; }); if (config.debug) { console.log(data.messages); } @@ -160,7 +157,7 @@ define([ if (cb) { cb(); } }); }; - get = function (i) { + get = function (i, blockOnly) { i = parseInt(i); if (isNaN(i)) { return; } if (i > 0) { i = 0; } @@ -169,6 +166,8 @@ define([ loadMore(); } var idx = states.length - 1 + i; + if (blockOnly) { return states[idx]; } + var val = states[idx].getContent().doc; c = i; if (typeof onUpdate === "function") { onUpdate(); } @@ -237,6 +236,10 @@ define([ 'class': 'cp-toolbar-history-fast-next fa fa-fast-forward buttonPrimary', title: Messages.history_next }).appendTo($hist); + var $share = $('