diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index e6a48ebe2..91d000efb 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -743,13 +743,20 @@ define([ common.updatePinLimit = function (cb) { if (!pinsReady()) { return void cb('[RPC_NOT_READY]'); } - rpc.updatePinLimits(cb); + rpc.updatePinLimits(function (e, limit) { + if (e) { return cb(e); } + var MB = common.bytesToMegabytes(limit); + cb(e, MB); + }); }; common.getPinLimit = function (cb) { if (!pinsReady()) { return void cb('[RPC_NOT_READY]'); } - cb(void 0, typeof(AppConfig.pinLimit) === 'number'? AppConfig.pinLimit: 1000); - //rpc.getLimit(cb); TODO + rpc.getLimit(function (e, limit) { + if (e) { return cb(e); } + var MB = common.bytesToMegabytes(limit); + cb(void 0, MB); + }); }; common.isOverPinLimit = function (cb) { diff --git a/www/common/pinpad.js b/www/common/pinpad.js index efa915ec7..a7c5c72ee 100644 --- a/www/common/pinpad.js +++ b/www/common/pinpad.js @@ -125,7 +125,7 @@ define([ exp.updatePinLimits = function (cb) { rpc.send('UPDATE_LIMITS', undefined, function (e, response) { if (e) { return void cb(e); } - if (response && typeof response === "number") { + if (response && response.length && typeof(response[0]) === "number") { cb (void 0, response); } else { cb('INVALID_RESPONSE'); @@ -136,8 +136,8 @@ define([ exp.getLimit = function (cb) { rpc.send('GET_LIMIT', undefined, function (e, response) { if (e) { return void cb(e); } - if (response && typeof response === "number") { - cb (void 0, response); + if (response && response.length && typeof(response[0]) === "number") { + cb (void 0, response[0]); } else { cb('INVALID_RESPONSE'); }