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

This commit is contained in:
yflory
2017-05-15 18:21:25 +02:00
4 changed files with 129 additions and 95 deletions

View File

@@ -744,13 +744,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) {

View File

@@ -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');
}

View File

@@ -44,6 +44,7 @@ define([
chunks.push(box);
Cryptpad.rpc.send('UPLOAD', enc, function (e, msg) {
console.log(box);
cb(e, msg);
});
};
@@ -93,14 +94,14 @@ define([
});
};
Cryptpad.rpc.send('UPLOAD_STATUS', '', function (e, pending) {
Cryptpad.rpc.send('UPLOAD_STATUS', estimate, function (e, pending) {
if (e) {
console.error(e);
return void Cryptpad.alert("something went wrong");
return void Cryptpad.alert("something went wrong"); // TODO translate
}
if (pending[0]) {
return void Cryptpad.confirm('upload pending, abort?', function (yes) {
return void Cryptpad.confirm('upload pending, abort?', function (yes) { // TODO translate
if (!yes) { return; }
Cryptpad.rpc.send('UPLOAD_CANCEL', '', function (e, res) {
if (e) { return void console.error(e); }