|
|
@ -1122,6 +1122,20 @@ define([
|
|
|
|
var onReady = ctx.onReadyHandlers[teamId];
|
|
|
|
var onReady = ctx.onReadyHandlers[teamId];
|
|
|
|
var team = ctx.teams[teamId];
|
|
|
|
var team = ctx.teams[teamId];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (teamData.channel !== data.channel || teamData.password !== data.password) { return void cb(false); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update our proxy
|
|
|
|
|
|
|
|
if (state) {
|
|
|
|
|
|
|
|
teamData.hash = data.hash;
|
|
|
|
|
|
|
|
teamData.keys.drive.edPrivate = data.keys.drive.edPrivate;
|
|
|
|
|
|
|
|
teamData.keys.chat.edit = data.keys.chat.edit;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
delete teamData.hash;
|
|
|
|
|
|
|
|
delete teamData.keys.drive.edPrivate;
|
|
|
|
|
|
|
|
delete teamData.keys.chat.edit;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Team not ready yet: try again onReady
|
|
|
|
if (!team && Array.isArray(onReady)) {
|
|
|
|
if (!team && Array.isArray(onReady)) {
|
|
|
|
onReady.push({
|
|
|
|
onReady.push({
|
|
|
|
cb: function () {
|
|
|
|
cb: function () {
|
|
|
@ -1131,14 +1145,11 @@ define([
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// No team and not initialized at all...
|
|
|
|
if (!team) { return void cb(false); }
|
|
|
|
if (!team) { return void cb(false); }
|
|
|
|
|
|
|
|
|
|
|
|
if (teamData.channel !== data.channel || teamData.password !== data.password) { return void cb(false); }
|
|
|
|
// Team is initialized and ready: update the loaded elements
|
|
|
|
|
|
|
|
|
|
|
|
if (state) {
|
|
|
|
if (state) {
|
|
|
|
teamData.hash = data.hash;
|
|
|
|
|
|
|
|
teamData.keys.drive.edPrivate = data.keys.drive.edPrivate;
|
|
|
|
|
|
|
|
teamData.keys.chat.edit = data.keys.chat.edit;
|
|
|
|
|
|
|
|
initRpc(ctx, team, teamData.keys.drive, function () {
|
|
|
|
initRpc(ctx, team, teamData.keys.drive, function () {
|
|
|
|
team.manager.addPin(team.pin, team.unpin);
|
|
|
|
team.manager.addPin(team.pin, team.unpin);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -1149,9 +1160,6 @@ define([
|
|
|
|
var crypto = Crypto.createEncryptor(secret.keys);
|
|
|
|
var crypto = Crypto.createEncryptor(secret.keys);
|
|
|
|
team.listmap.setReadOnly(false, crypto);
|
|
|
|
team.listmap.setReadOnly(false, crypto);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
delete teamData.hash;
|
|
|
|
|
|
|
|
delete teamData.keys.drive.edPrivate;
|
|
|
|
|
|
|
|
delete teamData.keys.chat.edit;
|
|
|
|
|
|
|
|
delete team.secondaryKey;
|
|
|
|
delete team.secondaryKey;
|
|
|
|
if (team.rpc && team.rpc.destroy) {
|
|
|
|
if (team.rpc && team.rpc.destroy) {
|
|
|
|
team.rpc.destroy();
|
|
|
|
team.rpc.destroy();
|
|
|
|