Fix the history mode with readOnly and old URLs

This commit is contained in:
yflory
2017-06-19 14:41:31 +02:00
parent f1aef66fc9
commit 1ad1b78c64
2 changed files with 14 additions and 1 deletions

View File

@@ -37,6 +37,17 @@ define([
var parsed = config.href ? common.parsePadUrl(config.href) : {};
var secret = common.getSecrets(parsed.type, parsed.hash);
History.readOnly = 1;
if (!secret.keys) {
secret.keys = secret.key;
History.readOnly = 2;
}
else if (!secret.keys.validateKey) {
secret.keys.validateKey = true;
History.readOnly = 0;
}
var crypto = Crypto.createEncryptor(secret.keys);
var to = window.setTimeout(function () {
@@ -185,6 +196,7 @@ define([
'class':'revertHistory buttonSuccess',
title: Messages.history_restoreTitle
}).text(Messages.history_restore).appendTo($nav);
if (!History.readOnly) { $rev.hide(); }
onUpdate = function () {
$cur.attr('max', states.length);