Fix pad creation in pad2
This commit is contained in:
@@ -1803,13 +1803,15 @@ define([
|
|||||||
return $userAdmin;
|
return $userAdmin;
|
||||||
};
|
};
|
||||||
|
|
||||||
common.getShareHashes = function (cb) {
|
common.getShareHashes = function (secret, cb) {
|
||||||
|
if (!window.location.hash) {
|
||||||
|
var hashes = common.getHashes(secret.channel, secret);
|
||||||
|
return void cb(null, hashes);
|
||||||
|
}
|
||||||
common.getRecentPads(function (err, recent) {
|
common.getRecentPads(function (err, recent) {
|
||||||
var parsed = parsePadUrl(window.location.href);
|
var parsed = parsePadUrl(window.location.href);
|
||||||
if (!parsed.type || !parsed.hashData) { return void cb('E_INVALID_HREF'); }
|
if (!parsed.type || !parsed.hashData) { return void cb('E_INVALID_HREF'); }
|
||||||
var secret = common.getSecrets(parsed.type, parsed.hash);
|
var hashes = common.getHashes(secret.channel, secret);
|
||||||
var channel = common.base64ToHex(parsed.hashData.channel);
|
|
||||||
var hashes = common.getHashes(channel, secret);
|
|
||||||
var options = [];
|
var options = [];
|
||||||
|
|
||||||
// If we have a stronger version in drive, add it and add a redirect button
|
// If we have a stronger version in drive, add it and add a redirect button
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ define(['jquery'], function ($) {
|
|||||||
|
|
||||||
exp.defaultTitle = Common.getDefaultTitle();
|
exp.defaultTitle = Common.getDefaultTitle();
|
||||||
|
|
||||||
exp.title = document.title; // TOOD slides
|
exp.title = document.title;
|
||||||
|
|
||||||
cfg = cfg || {};
|
cfg = cfg || {};
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ define([
|
|||||||
console.log('xxx');
|
console.log('xxx');
|
||||||
var sframeChan;
|
var sframeChan;
|
||||||
var hashes;
|
var hashes;
|
||||||
|
var secret;
|
||||||
nThen(function (waitFor) {
|
nThen(function (waitFor) {
|
||||||
$(waitFor());
|
$(waitFor());
|
||||||
}).nThen(function (waitFor) {
|
}).nThen(function (waitFor) {
|
||||||
@@ -31,12 +32,15 @@ define([
|
|||||||
}));
|
}));
|
||||||
Cryptpad.ready(waitFor());
|
Cryptpad.ready(waitFor());
|
||||||
}).nThen(function (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) {
|
}).nThen(function (waitFor) {
|
||||||
var secret = Cryptpad.getSecrets();
|
|
||||||
var readOnly = secret.keys && !secret.keys.editKeyStr;
|
var readOnly = secret.keys && !secret.keys.editKeyStr;
|
||||||
if (!secret.keys) { secret.keys = secret.key; }
|
if (!secret.keys) { secret.keys = secret.key; }
|
||||||
|
|
||||||
var parsed = Cryptpad.parsePadUrl(window.location.href);
|
var parsed = Cryptpad.parsePadUrl(window.location.href);
|
||||||
parsed.type = parsed.type.replace('pad2', 'pad');
|
parsed.type = parsed.type.replace('pad2', 'pad');
|
||||||
if (!parsed.type) { throw new Error(); }
|
if (!parsed.type) { throw new Error(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user