wip
This commit is contained in:
1195
www/pad2/main.js
1195
www/pad2/main.js
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,39 @@
|
||||
|
||||
define([
|
||||
'/common/sframe-ctrl.js',
|
||||
'jquery'
|
||||
], function (SFrameCtrl, $) {
|
||||
'/common/sframe-channel.js',
|
||||
'jquery',
|
||||
'/common/sframe-chainpad-netflux-outer.js',
|
||||
'/bower_components/nthen/index.js',
|
||||
'/common/cryptpad-common.js',
|
||||
'/bower_components/chainpad-crypto/crypto.js'
|
||||
], function (SFrameChannel, $, CpNfOuter, nThen, Cryptpad, Crypto) {
|
||||
console.log('xxx');
|
||||
$(function () {
|
||||
console.log('go');
|
||||
SFrameCtrl.init($('#sbox-iframe')[0], function () {
|
||||
console.log('\n\ndone\n\n');
|
||||
nThen(function (waitFor) {
|
||||
$(waitFor());
|
||||
}).nThen(function (waitFor) {
|
||||
SFrameChannel.init($('#sbox-iframe')[0].contentWindow, waitFor(function () {
|
||||
console.log('sframe initialized');
|
||||
}));
|
||||
Cryptpad.ready(waitFor());
|
||||
}).nThen(function (waitFor) {
|
||||
Cryptpad.onError(function (info) {
|
||||
console.log('error');
|
||||
console.log(info);
|
||||
if (info && info.type === "store") {
|
||||
//onConnectError();
|
||||
}
|
||||
});
|
||||
}).nThen(function (waitFor) {
|
||||
var secret = Cryptpad.getSecrets();
|
||||
var readOnly = secret.keys && !secret.keys.editKeyStr;
|
||||
if (!secret.keys) { secret.keys = secret.key; }
|
||||
|
||||
var outer = CpNfOuter.start({
|
||||
channel: secret.channel,
|
||||
network: Cryptpad.getNetwork(),
|
||||
validateKey: secret.keys.validateKey || undefined,
|
||||
readOnly: readOnly,
|
||||
crypto: Crypto.createEncryptor(secret.keys),
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user