|
|
|
@ -36,31 +36,7 @@ define([
|
|
|
|
|
};
|
|
|
|
|
window.addEventListener('message', onMsg);
|
|
|
|
|
}).nThen(function (/*waitFor*/) {
|
|
|
|
|
var teamId; // XXX
|
|
|
|
|
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 teamId;
|
|
|
|
|
var addRpc = function (sframeChan, Cryptpad) {
|
|
|
|
|
sframeChan.on('Q_SET_TEAM', function (data, cb) {
|
|
|
|
|
teamId = data;
|
|
|
|
@ -72,11 +48,6 @@ define([
|
|
|
|
|
data.teamId = teamId;
|
|
|
|
|
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) {
|
|
|
|
|
if (!teamId) { return void cb({error: 'EINVAL'}); }
|
|
|
|
|
if (data && data.sharedFolder) {
|
|
|
|
@ -109,7 +80,6 @@ define([
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
SFCommonO.start({
|
|
|
|
|
afterSecrets: afterSecrets,
|
|
|
|
|
noHash: true,
|
|
|
|
|
noRealtime: true,
|
|
|
|
|
//driveEvents: true,
|
|
|
|
|