|
|
@ -36,31 +36,7 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
window.addEventListener('message', onMsg);
|
|
|
|
window.addEventListener('message', onMsg);
|
|
|
|
}).nThen(function (/*waitFor*/) {
|
|
|
|
}).nThen(function (/*waitFor*/) {
|
|
|
|
var teamId; // XXX
|
|
|
|
var teamId;
|
|
|
|
var afterSecrets = function (Cryptpad, Utils, secret, cb) {
|
|
|
|
|
|
|
|
return void cb();
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
var hash = window.location.hash.slice(1);
|
|
|
|
|
|
|
|
if (hash && Utils.LocalStore.isLoggedIn()) {
|
|
|
|
|
|
|
|
return; // XXX How to add a shared folder?
|
|
|
|
|
|
|
|
// Add a shared folder!
|
|
|
|
|
|
|
|
Cryptpad.addSharedFolder(teamId, secret, function (id) {
|
|
|
|
|
|
|
|
window.CryptPad_newSharedFolder = id;
|
|
|
|
|
|
|
|
cb();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
} else if (hash) {
|
|
|
|
|
|
|
|
var id = Utils.Util.createRandomInteger();
|
|
|
|
|
|
|
|
window.CryptPad_newSharedFolder = id;
|
|
|
|
|
|
|
|
var data = {
|
|
|
|
|
|
|
|
href: Utils.Hash.getRelativeHref(window.location.href),
|
|
|
|
|
|
|
|
password: secret.password
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
return void Cryptpad.loadSharedFolder(id, data, cb);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cb();
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
var addRpc = function (sframeChan, Cryptpad) {
|
|
|
|
var addRpc = function (sframeChan, Cryptpad) {
|
|
|
|
sframeChan.on('Q_SET_TEAM', function (data, cb) {
|
|
|
|
sframeChan.on('Q_SET_TEAM', function (data, cb) {
|
|
|
|
teamId = data;
|
|
|
|
teamId = data;
|
|
|
@ -72,11 +48,6 @@ define([
|
|
|
|
data.teamId = teamId;
|
|
|
|
data.teamId = teamId;
|
|
|
|
Cryptpad.userObjectCommand(data, cb);
|
|
|
|
Cryptpad.userObjectCommand(data, cb);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// XXX no drive restore in teams? you could restore old keys...
|
|
|
|
|
|
|
|
/*sframeChan.on('Q_DRIVE_RESTORE', function (data, cb) {
|
|
|
|
|
|
|
|
data.teamId = teamId;
|
|
|
|
|
|
|
|
Cryptpad.restoreDrive(data, cb);
|
|
|
|
|
|
|
|
});*/
|
|
|
|
|
|
|
|
sframeChan.on('Q_DRIVE_GETOBJECT', function (data, cb) {
|
|
|
|
sframeChan.on('Q_DRIVE_GETOBJECT', function (data, cb) {
|
|
|
|
if (!teamId) { return void cb({error: 'EINVAL'}); }
|
|
|
|
if (!teamId) { return void cb({error: 'EINVAL'}); }
|
|
|
|
if (data && data.sharedFolder) {
|
|
|
|
if (data && data.sharedFolder) {
|
|
|
@ -109,7 +80,6 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
SFCommonO.start({
|
|
|
|
SFCommonO.start({
|
|
|
|
afterSecrets: afterSecrets,
|
|
|
|
|
|
|
|
noHash: true,
|
|
|
|
noHash: true,
|
|
|
|
noRealtime: true,
|
|
|
|
noRealtime: true,
|
|
|
|
//driveEvents: true,
|
|
|
|
//driveEvents: true,
|
|
|
|