From f414d480a9541a849b06fffbe42b6cef1b120a4b Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 28 Apr 2017 18:23:41 +0200 Subject: [PATCH] Add the history mode to the CryptDrive --- customize.dist/src/less/toolbar.less | 6 +-- customize.dist/toolbar.css | 18 ++++---- www/common/common-history.js | 16 +++---- www/common/userObject.js | 2 +- www/drive/main.js | 62 +++++++++++++++++++++++++++- 5 files changed, 82 insertions(+), 22 deletions(-) diff --git a/customize.dist/src/less/toolbar.less b/customize.dist/src/less/toolbar.less index 40f895c24..055bb14ed 100644 --- a/customize.dist/src/less/toolbar.less +++ b/customize.dist/src/less/toolbar.less @@ -42,7 +42,7 @@ } button { - &#shareButton, &.btn.btn-success { + &#shareButton, &.buttonSuccess { // Bootstrap 4 colors color: #fff; background: @toolbar-green; @@ -58,7 +58,7 @@ margin-left: 5px; } } - &#newdoc, &.btn.btn-primary { + &#newdoc, &.buttonPrimary { // Bootstrap 4 colors color: #fff; background: #0275d8; @@ -443,7 +443,7 @@ display: inline-block; vertical-align: middle; text-align: center; - input { width: 50px; } + input { width: 75px; } } .gotoInput { vertical-align: middle; diff --git a/customize.dist/toolbar.css b/customize.dist/toolbar.css index 76eeb5b4d..37cdd8501 100644 --- a/customize.dist/toolbar.css +++ b/customize.dist/toolbar.css @@ -125,41 +125,41 @@ border-color: #ccc; } .cryptpad-toolbar button#shareButton, -.cryptpad-toolbar button.btn.btn-success { +.cryptpad-toolbar button.buttonSuccess { color: #fff; background: #5cb85c; border-color: #5cb85c; } .cryptpad-toolbar button#shareButton:hover, -.cryptpad-toolbar button.btn.btn-success:hover { +.cryptpad-toolbar button.buttonSuccess:hover { background: #449d44; border: 1px solid #419641; } .cryptpad-toolbar button#shareButton span, -.cryptpad-toolbar button.btn.btn-success span { +.cryptpad-toolbar button.buttonSuccess span { color: #fff; } .cryptpad-toolbar button#shareButton .large, -.cryptpad-toolbar button.btn.btn-success .large { +.cryptpad-toolbar button.buttonSuccess .large { margin-left: 5px; } .cryptpad-toolbar button#newdoc, -.cryptpad-toolbar button.btn.btn-primary { +.cryptpad-toolbar button.buttonPrimary { color: #fff; background: #0275d8; border-color: #0275d8; } .cryptpad-toolbar button#newdoc:hover, -.cryptpad-toolbar button.btn.btn-primary:hover { +.cryptpad-toolbar button.buttonPrimary:hover { background: #025aa5; border: 1px solid #01549b; } .cryptpad-toolbar button#newdoc span, -.cryptpad-toolbar button.btn.btn-primary span { +.cryptpad-toolbar button.buttonPrimary span { color: #fff; } .cryptpad-toolbar button#newdoc .large, -.cryptpad-toolbar button.btn.btn-primary .large { +.cryptpad-toolbar button.buttonPrimary .large { margin-left: 5px; } .cryptpad-toolbar button.hidden { @@ -516,7 +516,7 @@ text-align: center; } .cryptpad-toolbar-history .goto input { - width: 50px; + width: 75px; } .cryptpad-toolbar-history .gotoInput { vertical-align: middle; diff --git a/www/common/common-history.js b/www/common/common-history.js index 2cd5b7707..3d98a9797 100644 --- a/www/common/common-history.js +++ b/www/common/common-history.js @@ -18,12 +18,13 @@ define([ return states; }; - var loadHistory = function (common, cb) { + var loadHistory = function (config, common, cb) { var network = common.getNetwork(); var hkn = network.historyKeeper; - var wcId = common.hrefToHexChannelId(window.location.href); + var wcId = common.hrefToHexChannelId(config.href || window.location.href); + console.log(wcId); var createRealtime = function(chan) { return ChainPad.create({ userName: 'history', @@ -35,7 +36,8 @@ define([ }; var realtime = createRealtime(); - var secret = common.getSecrets(); + var hash = config.href ? common.parsePadUrl(config.href).hash : undefined; + var secret = common.getSecrets(hash); var crypto = Crypto.createEncryptor(secret.keys); var to = window.setTimeout(function () { @@ -134,12 +136,12 @@ define([ $right.hide(); $cke.hide(); var $prev =$('