Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

This commit is contained in:
yflory
2017-05-04 16:08:21 +02:00
6 changed files with 339 additions and 78 deletions

View File

@@ -721,7 +721,7 @@ define([
};
var getPinLimit = common.getPinLimit = function (cb) {
cb(void 0, 1000);
cb(void 0, typeof(AppConfig.pinLimit) === 'number'? AppConfig.pinLimit: 1000);
};
var isOverPinLimit = common.isOverPinLimit = function (cb) {

View File

@@ -102,9 +102,16 @@ types of messages:
timeouts: {}, // timeouts
pending: {}, // callbacks
cookie: null,
connected: true,
};
var send = function (type, msg, cb) {
if (!ctx.connected && type !== 'COOKIE') {
return void window.setTimeout(function () {
cb('DISCONNECTED');
});
}
// construct a signed message...
var data = [type, msg];
@@ -127,6 +134,17 @@ types of messages:
onMsg(ctx, msg);
});
network.on('disconnect', function (reason) {
ctx.connected = false;
});
network.on('reconnect', function (uid) {
send('COOKIE', "", function (e, msg) {
if (e) { return void cb(e); }
ctx.connected = true;
});
});
send('COOKIE', "", function (e, msg) {
if (e) { return void cb(e); }
// callback to provide 'send' method to whatever needs it