Fix pad creation in pad2

This commit is contained in:
yflory
2017-08-21 14:41:56 +02:00
parent 140c6f3776
commit e4020ba8d4
3 changed files with 14 additions and 8 deletions

View File

@@ -22,6 +22,7 @@ define([
console.log('xxx');
var sframeChan;
var hashes;
var secret;
nThen(function (waitFor) {
$(waitFor());
}).nThen(function (waitFor) {
@@ -31,12 +32,15 @@ define([
}));
Cryptpad.ready(waitFor());
}).nThen(function (waitFor) {
Cryptpad.getShareHashes(waitFor(function (err, h) { hashes = h; }));
secret = Cryptpad.getSecrets();
if (!secret.channel) {
// New pad: create a new random channel id
secret.channel = Cryptpad.createChannelId();
}
Cryptpad.getShareHashes(secret, waitFor(function (err, h) { hashes = h; }));
}).nThen(function (waitFor) {
var secret = Cryptpad.getSecrets();
var readOnly = secret.keys && !secret.keys.editKeyStr;
if (!secret.keys) { secret.keys = secret.key; }
var parsed = Cryptpad.parsePadUrl(window.location.href);
parsed.type = parsed.type.replace('pad2', 'pad');
if (!parsed.type) { throw new Error(); }