Merge branch 'staging' into ooPassword

This commit is contained in:
yflory
2019-11-25 16:51:06 +01:00
78 changed files with 1459 additions and 304 deletions

View File

@@ -575,7 +575,8 @@ define([
support: Util.find(store.proxy, ['mailboxes', 'support', 'channel']),
pendingFriends: store.proxy.friends_pending || {},
supportPrivateKey: Util.find(store.proxy, ['mailboxes', 'supportadmin', 'keys', 'curvePrivate']),
teams: teams
teams: teams,
plan: account.plan
}
};
cb(JSON.parse(JSON.stringify(metadata)));

View File

@@ -20,11 +20,11 @@ define([
}
profile.edit = Hash.getEditHashFromKeys(secret);
profile.view = Hash.getViewHashFromKeys(secret);
cb();
setTimeout(cb);
});
return;
}
cb();
setTimeout(cb);
};
var openChannel = function (ctx) {

View File

@@ -21,7 +21,8 @@ define([
// No version: visible edit
// Version 2: encrypted edit links
SF.checkMigration = function (secondaryKey, proxy, uo, cb) {
SF.checkMigration = function (secondaryKey, proxy, uo, _cb) {
var cb = Util.once(Util.mkAsync(_cb));
var drive = proxy.drive || proxy;
// View access: can't migrate
if (!secondaryKey) { return void cb(); }
@@ -82,7 +83,7 @@ define([
};
SF.load = function (config, id, data, _cb) {
var cb = Util.once(_cb);
var cb = Util.once(Util.mkAsync(_cb));
var network = config.network;
var store = config.store;
var isNew = config.isNew;
@@ -188,7 +189,7 @@ define([
return;
}
sf.teams.forEach(function (obj) {
var leave = function () { SF.leave(secret.channel, teamId); };
var leave = function () { SF.leave(secret.channel, obj.store.id); };
/*
var uo = obj.store.manager.addProxy(obj.id, rt, leave, obj.secondaryKey);
// NOTE: Shared folder migration, disable for now
@@ -300,6 +301,7 @@ define([
*/
SF.loadSharedFolders = function (Store, network, store, userObject, waitFor) {
var shared = Util.find(store.proxy, ['drive', UserObject.SHARED_FOLDERS]) || {};
var w = waitFor();
nThen(function (waitFor) {
Object.keys(shared).forEach(function (id) {
var sf = shared[id];
@@ -309,7 +311,9 @@ define([
isNewChannel: Store.isNewChannel
}, id, sf, waitFor());
});
}).nThen(waitFor());
}).nThen(function () {
setTimeout(w);
});
};
return SF;

View File

@@ -25,10 +25,6 @@ define([
var Nacl = window.nacl;
var initializeTeams = function (ctx, cb) {
cb();
};
var registerChangeEvents = function (ctx, team, proxy, fId) {
if (!team) { return; }
if (!fId) {
@@ -340,7 +336,7 @@ define([
};
var openChannel = function (ctx, teamData, id, _cb) {
var cb = Util.once(_cb);
var cb = Util.once(Util.mkAsync(_cb));
var hash = teamData.hash || teamData.roHash;
var secret = Hash.getSecrets('team', hash, teamData.password);
@@ -1279,10 +1275,6 @@ define([
var teams = store.proxy.teams = store.proxy.teams || {};
initializeTeams(ctx, waitFor(function (err) {
if (err) { return; }
}));
// Listen for changes in our access rights (if another worker receives edit access)
ctx.store.proxy.on('change', ['teams'], function (o, n, p) {
if (p[2] !== 'hash') { return; }

View File

@@ -45,6 +45,8 @@ define([
var ids = id ? [id] : exp.findChannels([channel]);
ids.forEach(function (i) {
var data = exp.getFileData(i, true);
var oldHref = exp.getHref(data);
if (oldHref === href) { return; }
data.href = exp.cryptor.encrypt(href);
});
};