Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
commit
1b671edce9
|
@ -13,8 +13,6 @@ define(function () {
|
|||
out.type.slide = 'Presentación';
|
||||
out.type.whiteboard = 'Pizarra';
|
||||
|
||||
out.common_connectionLost = "<b>Connexión perdida</b><br>El documento está ahora en modo solo lectura hasta que la conexión vuelva.";
|
||||
|
||||
out.disconnected = "Desconectado";
|
||||
out.synchronizing = "Sincronización";
|
||||
out.reconnecting = "Reconectando...";
|
||||
|
@ -429,15 +427,12 @@ define(function () {
|
|||
out.upload_success = "Tu archivo ({0}) ha sido subido con éxito y fue añadido a tu drive.";
|
||||
|
||||
// 1.7.0 - Hodag
|
||||
out.comingSoon = "Próximamente..."; // "Coming soon..."
|
||||
out.comingSoon = "Próximamente...";
|
||||
out.newVersion = ["<b>CryptPad ha sido actualizado!</b>",
|
||||
"Puedes ver lo que ha cambiada aquí (en inglés):",
|
||||
"<a href=\"https://github.com/xwiki-labs/cryptpad/releases/tag/{0}\" target=\"_blank\">Notas de versión para CryptPad {0}</a>"].join("<br>");
|
||||
out.pinLimitReachedAlert = ["Has llegado a tu limite de espacio. Nuevos pads no serán guardados en tu CryptDrive.",
|
||||
"Puedes eliminar pads de tu CryptDrive o <a href=\"https://accounts.cryptpad.fr/#!on={0}\" target=\"_blank\">suscribirte a una oferta premium</a> para obtener más espacio."].join("<br>");
|
||||
"Puedes ver lo que ha cambiado aquí (en inglés):",
|
||||
"<a href=\"https://github.com/xwiki-labs/cryptpad/releases/tag/{0}\" target=\"_blank\">Notas de versión para CryptPad {0}</a>"].join("<br>");
|
||||
out.pinLimitReachedAlertNoAccounts = "Has llegado a tu limite de espacio";
|
||||
out.previewButtonTitle = "Mostrar/esconder la vista previa Markdown";
|
||||
out.fm_info_trash = "Vacía tu papelera para liberar espaci en tu CryptDrive.";
|
||||
out.fm_info_anonymous = "No estás conectado, así que estos pads pueden ser borrados (<a href=\"https://blog.cryptpad.fr/2017/05/17/You-gotta-log-in/\" target=\"_blank\">¿por qué?</a>). <a href=\"/register/\">Registrate</a> o <a href=\"/login/\">Inicia sesión</a> para asegurarlos.";
|
||||
out.fm_alert_anonymous = "Hola, estás usando CryptPad anónimamente. Está bien, pero tus pads pueden ser borrados después de un périodo de inactividad. Hemos desactivado funciones avanzadas de CryptDrive para usuarios anónimos porque queremos ser claros que no es un lugar seguro para almacenar cosas. Puedes <a href=\"https://blog.cryptpad.fr/2017/05/17/You-gotta-log-in/\" target=\"_blank\">leer este articulo</a> (en inglés) sobre por qué hacemos esto y por qué deberías <a href=\"/register/\">Registrarte</a> e <a href=\"/login/\">Iniciar sesión</a>.";
|
||||
out.fm_error_cantPin = "Error del servidor. Por favor, recarga la página e intentalo de nuevo.";
|
||||
|
@ -457,5 +452,20 @@ define(function () {
|
|||
out.poll_locked = "Cerrado";
|
||||
out.poll_unlocked = "Abierto";
|
||||
|
||||
// 1.8.0 - Idopogo
|
||||
|
||||
out.common_connectionLost = "<b>Connexión perdida</b><br>El documento está ahora en modo solo lectura hasta que la conexión vuelva.";
|
||||
out.updated_0_common_connectionLost = out.common_connectionLost;
|
||||
out.supportCryptpad = "Ayudar a CryptPad";
|
||||
out.pinLimitReachedAlert = ["Has llegado a tu limite de espacio. Nuevos pads no serán guardados en tu CryptDrive.",
|
||||
"Puedes eliminar pads de tu CryptDrive o <a href=\"https://accounts.cryptpad.fr/#!on={0}\" target=\"_blank\">suscribirte a una oferta premium</a> para obtener más espacio."].join("<br>");
|
||||
out.updated_0_pinLimitReachedAlert = out.pinLimitReachedAlert;
|
||||
out.fm_info_trash = "Vacía tu papelera para liberar espaci en tu CryptDrive.";
|
||||
out.updated_0_fm_info_trash = out.fm_info_trash;
|
||||
|
||||
out.fs_migration = "Tu CryptDrive fue actualizado a una nueva versión.<br><strong>Por favor, recarga la página.</strong>";
|
||||
out.login_notRegistered = "¿No estás registrado?";
|
||||
out.upload_mustLogin = "Tienes que estar conectado para subir archivos";
|
||||
|
||||
return out;
|
||||
});
|
||||
|
|
|
@ -30,7 +30,9 @@ define([
|
|||
Clipboard: Clipboard,
|
||||
donateURL: 'https://accounts.cryptpad.fr/#/donate?on=' + origin,
|
||||
upgradeURL: 'https://accounts.cryptpad.fr/#/?on=' + origin,
|
||||
account: {},
|
||||
account: {
|
||||
usage: 0,
|
||||
},
|
||||
};
|
||||
|
||||
// constants
|
||||
|
@ -744,7 +746,11 @@ define([
|
|||
|
||||
common.getPinnedUsage = function (cb) {
|
||||
if (!pinsReady()) { return void cb('[RPC_NOT_READY]'); }
|
||||
rpc.getFileListSize(cb);
|
||||
|
||||
rpc.getFileListSize(function (err, bytes) {
|
||||
common.account.usage = typeof(bytes) === 'number'? bytes: 0;
|
||||
cb(err, bytes);
|
||||
});
|
||||
};
|
||||
|
||||
common.getFileSize = function (href, cb) {
|
||||
|
@ -759,6 +765,9 @@ define([
|
|||
if (!pinsReady()) { return void cb('[RPC_NOT_READY]'); }
|
||||
rpc.updatePinLimits(function (e, limit, plan, note) {
|
||||
if (e) { return cb(e); }
|
||||
common.account.limit = limit;
|
||||
common.account.plan = plan;
|
||||
common.account.note = note;
|
||||
cb(e, limit, plan, note);
|
||||
});
|
||||
};
|
||||
|
@ -767,6 +776,9 @@ define([
|
|||
if (!pinsReady()) { return void cb('[RPC_NOT_READY]'); }
|
||||
rpc.getLimit(function (e, limit, plan, note) {
|
||||
if (e) { return cb(e); }
|
||||
common.account.limit = limit;
|
||||
common.account.plan = plan;
|
||||
common.account.note = note;
|
||||
cb(void 0, limit, plan, note);
|
||||
});
|
||||
};
|
||||
|
@ -783,8 +795,8 @@ define([
|
|||
return void cb (null, false, data);
|
||||
};
|
||||
var todo = function (e, used) {
|
||||
usage = used; //common.bytesToMegabytes(used);
|
||||
if (e) { return void cb(e); }
|
||||
usage = used;
|
||||
common.getPinLimit(andThen);
|
||||
};
|
||||
common.getPinnedUsage(todo);
|
||||
|
@ -806,41 +818,63 @@ define([
|
|||
};
|
||||
|
||||
var LIMIT_REFRESH_RATE = 30000; // milliseconds
|
||||
common.createUsageBar = function (cb, alwaysDisplayUpgrade) {
|
||||
var todo = function (err, state, data) {
|
||||
common.createUsageBar = function (cb) {
|
||||
// getPinnedUsage updates common.account.usage, and other values
|
||||
// so we can just use those and only check for errors
|
||||
var todo = function (err) {
|
||||
var $container = $('<span>', {'class':'limit-container'});
|
||||
if (!data) {
|
||||
if (err) {
|
||||
return void window.setTimeout(function () {
|
||||
common.isOverPinLimit(todo);
|
||||
common.getPinnedUsage(todo);
|
||||
}, LIMIT_REFRESH_RATE);
|
||||
}
|
||||
|
||||
var unit = Util.magnitudeOfBytes(data.limit);
|
||||
var unit = Util.magnitudeOfBytes(common.account.limit);
|
||||
|
||||
var usage = unit === 'GB'? Util.bytesToGigabytes(data.usage):
|
||||
Util.bytesToMegabytes(data.usage);
|
||||
var limit = unit === 'GB'? Util.bytesToGigabytes(data.limit):
|
||||
Util.bytesToMegabytes(data.limit);
|
||||
var usage = unit === 'GB'? Util.bytesToGigabytes(common.account.usage):
|
||||
Util.bytesToMegabytes(common.account.usage);
|
||||
var limit = unit === 'GB'? Util.bytesToGigabytes(common.account.limit):
|
||||
Util.bytesToMegabytes(common.account.limit);
|
||||
|
||||
var $limit = $('<span>', {'class': 'cryptpad-limit-bar'}).appendTo($container);
|
||||
var quota = usage/limit;
|
||||
var width = Math.floor(Math.min(quota, 1)*200); // the bar is 200px width
|
||||
var $usage = $('<span>', {'class': 'usage'}).css('width', width+'px');
|
||||
|
||||
if (Config.noSubscriptionButton !== true &&
|
||||
(quota >= 0.8 || alwaysDisplayUpgrade) &&
|
||||
data.plan !== "power")
|
||||
{
|
||||
// TODO show donate url if applicable
|
||||
var makeDonateButton = function () {
|
||||
var $upgradeLink = $('<a>', {
|
||||
href: common.upgradeLink,
|
||||
href: common.donateURL,
|
||||
rel: "noreferrer noopener",
|
||||
target: "_blank",
|
||||
}).appendTo($container);
|
||||
$('<button>', {
|
||||
'class': 'upgrade buttonSuccess',
|
||||
}).text(Messages.supportCryptpad).appendTo($upgradeLink);
|
||||
};
|
||||
|
||||
var makeUpgradeButton = function () {
|
||||
var $upgradeLink = $('<a>', {
|
||||
href: common.upgradeURL,
|
||||
rel: "noreferrer noopener",
|
||||
target: "_blank",
|
||||
}).appendTo($container);
|
||||
$('<button>', {
|
||||
'class': 'upgrade buttonSuccess',
|
||||
title: Messages.upgradeTitle
|
||||
}).text(Messages.upgrade).appendTo($upgradeLink);
|
||||
}).text(Messages.upgradeAccount).appendTo($upgradeLink);
|
||||
};
|
||||
|
||||
if (!Config.removeDonateButton) {
|
||||
if (!common.isLoggedIn() || !Config.allowSubscriptions) {
|
||||
// user is not logged in, or subscriptions are disallowed
|
||||
makeDonateButton();
|
||||
} else if (!common.account.plan) {
|
||||
// user is logged in and subscriptions are allowed
|
||||
// and they don't have one. show upgrades
|
||||
makeUpgradeButton();
|
||||
} else {
|
||||
// they have a plan. show nothing
|
||||
}
|
||||
}
|
||||
|
||||
var prettyUsage;
|
||||
|
@ -861,11 +895,11 @@ define([
|
|||
$text.text(usage + ' / ' + prettyLimit);
|
||||
$limit.append($usage).append($text);
|
||||
window.setTimeout(function () {
|
||||
common.isOverPinLimit(todo);
|
||||
common.getPinnedUsage(todo);
|
||||
}, LIMIT_REFRESH_RATE);
|
||||
cb(err, $container);
|
||||
};
|
||||
common.isOverPinLimit(todo);
|
||||
common.getPinnedUsage(todo);
|
||||
};
|
||||
|
||||
common.createButton = function (type, rightside, data, callback) {
|
||||
|
|
|
@ -120,7 +120,7 @@ define([
|
|||
exp.getFileListSize = function (cb) {
|
||||
rpc.send('GET_TOTAL_SIZE', undefined, function (e, response) {
|
||||
if (e) { return void cb(e); }
|
||||
if (response && response.length) {
|
||||
if (response && response.length && typeof(response[0]) === 'number') {
|
||||
cb(void 0, response[0]);
|
||||
} else {
|
||||
cb('INVALID_RESPONSE');
|
||||
|
|
|
@ -94,7 +94,7 @@ types of messages:
|
|||
delete ctx.pending[txid];
|
||||
}
|
||||
else {
|
||||
console.log("received message for txid with no callback");
|
||||
console.error("received message for txid with no callback");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -626,7 +626,13 @@ define([
|
|||
});
|
||||
}
|
||||
};
|
||||
Cryptpad.isOverPinLimit(todo);
|
||||
var limit = Cryptpad.account.limit;
|
||||
var usage = Cryptpad.account.usage;
|
||||
if (typeof(limit) !== 'number' || typeof(usage) !== 'number') {
|
||||
todo("invalid types");
|
||||
} else if (Cryptpad.isLoggedIn() && usage >= limit) {
|
||||
todo(void 0, true);
|
||||
} else { todo(void 0, false); }
|
||||
return $limit;
|
||||
};
|
||||
|
||||
|
|
|
@ -2726,7 +2726,7 @@ define([
|
|||
if (err) { return void logError(err); }
|
||||
$leftside.html('');
|
||||
$leftside.append($limitContainer);
|
||||
}, true);
|
||||
});
|
||||
|
||||
/* add a history button */
|
||||
var histConfig = {
|
||||
|
|
Loading…
Reference in New Issue