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

pull/1/head
Caleb James DeLisle 7 years ago
commit 1713167a5d

@ -129,7 +129,9 @@ define(function () {
out.saveTemplatePrompt = "Choisir un titre pour ce modèle"; out.saveTemplatePrompt = "Choisir un titre pour ce modèle";
out.templateSaved = "Modèle enregistré !"; out.templateSaved = "Modèle enregistré !";
out.selectTemplate = "Sélectionner un modèle ou appuyer sur Échap"; out.selectTemplate = "Sélectionner un modèle ou appuyer sur Échap";
out.useTemplate = "Vous posséder des modèles pour ce type de pad, souhaitez-vous en utiliser un?"; out.useTemplate = "Commencer avec un modèle?";
out.useTemplateOK = 'Choisir un modèle (Entrée)';
out.useTemplateCancel = 'Document vierge (Échap)';
out.previewButtonTitle = "Afficher ou cacher la prévisualisation de Markdown"; out.previewButtonTitle = "Afficher ou cacher la prévisualisation de Markdown";

@ -20,6 +20,10 @@ It also contains information on keeping your instance of CryptPad up to date.
See [Cryptpad-Docker](docs/cryptpad-docker.md) See [Cryptpad-Docker](docs/cryptpad-docker.md)
## Setup using Ansible
See [Ansible Role for Cryptpad](https://github.com/systemli/ansible-role-cryptpad)
# Security # Security
CryptPad is *private*, not *anonymous*. Privacy protects your data, anonymity protects you. CryptPad is *private*, not *anonymous*. Privacy protects your data, anonymity protects you.

@ -36,8 +36,9 @@ define([
return $('button.ok').last(); return $('button.ok').last();
}; };
var listenForKeys = UI.listenForKeys = function (yes, no) { var listenForKeys = UI.listenForKeys = function (yes, no, el) {
var handler = function (e) { var handler = function (e) {
e.stopPropagation();
switch (e.which) { switch (e.which) {
case 27: // cancel case 27: // cancel
if (typeof(no) === 'function') { no(e); } if (typeof(no) === 'function') { no(e); }
@ -48,7 +49,7 @@ define([
} }
}; };
$(window).keyup(handler); $(el || window).keydown(handler);
return handler; return handler;
}; };
@ -114,7 +115,9 @@ define([
}; };
dialog.frame = function (content) { dialog.frame = function (content) {
return h('div.alertify', [ return h('div.alertify', {
tabindex: 1,
}, [
h('div.dialog', [ h('div.dialog', [
h('div', content), h('div', content),
]) ])
@ -229,6 +232,7 @@ define([
var close = Util.once(function () { var close = Util.once(function () {
$(frame).fadeOut(150, function () { $(this).remove(); }); $(frame).fadeOut(150, function () { $(this).remove(); });
stopListening(listener); stopListening(listener);
cb();
}); });
listener = listenForKeys(close, close); listener = listenForKeys(close, close);
var $ok = $(ok).click(close); var $ok = $(ok).click(close);
@ -237,7 +241,6 @@ define([
setTimeout(function () { setTimeout(function () {
$ok.focus(); $ok.focus();
UI.notify(); UI.notify();
if (!document.hasFocus()) { window.focus(); }
}); });
}; };
@ -283,7 +286,6 @@ define([
setTimeout(function () { setTimeout(function () {
input.select().focus(); input.select().focus();
UI.notify(); UI.notify();
if (!document.hasFocus()) { window.focus(); }
}); });
}; };
@ -330,10 +332,10 @@ define([
document.body.appendChild(frame); document.body.appendChild(frame);
setTimeout(function () { setTimeout(function () {
UI.notify(); UI.notify();
$(frame).find('.ok').focus();
if (typeof(opt.done) === 'function') { if (typeof(opt.done) === 'function') {
opt.done($ok.closest('.dialog')); opt.done($ok.closest('.dialog'));
} }
if (!document.hasFocus()) { window.focus(); }
}); });
}; };

@ -654,10 +654,8 @@ define([
if (workgroup || (!Cryptpad.isLoggedIn() && !config.testMode)) { return; } if (workgroup || (!Cryptpad.isLoggedIn() && !config.testMode)) { return; }
var filesList = getFiles([ROOT, 'hrefArray', TRASH]); var filesList = getFiles([ROOT, 'hrefArray', TRASH]);
var fData = files[FILES_DATA];
getFiles([FILES_DATA]).forEach(function (id) { getFiles([FILES_DATA]).forEach(function (id) {
if (filesList.indexOf(id) === -1) { if (filesList.indexOf(id) === -1) {
removePadAttribute(fData[id].href);
spliceFileData(id); spliceFileData(id);
} }
}); });
@ -1014,7 +1012,7 @@ define([
var toClean = []; var toClean = [];
us.forEach(function (el, idx) { us.forEach(function (el, idx) {
if (!isFile(el, true) || rootFiles.indexOf(el) !== -1) { if (!isFile(el, true) || rootFiles.indexOf(el) !== -1) {
toClean.push(idx); toClean.push(el);
} }
if (typeof el === "string") { if (typeof el === "string") {
// We have an old file (href) which is not in filesData: add it // We have an old file (href) which is not in filesData: add it
@ -1026,12 +1024,15 @@ define([
var data = files[FILES_DATA][el]; var data = files[FILES_DATA][el];
if (!data) { if (!data) {
debug("An element in TEMPLATE doesn't have associated data", el); debug("An element in TEMPLATE doesn't have associated data", el);
toClean.push(idx); toClean.push(el);
} }
} }
}); });
toClean.forEach(function (idx) { toClean.forEach(function (el) {
var idx = us.indexOf(el);
if (idx !== -1) {
us.splice(idx, 1); us.splice(idx, 1);
}
}); });
}; };
var migrateAttributes = function (el, id, parsed) { var migrateAttributes = function (el, id, parsed) {

@ -495,6 +495,15 @@ span {
width: 100%; width: 100%;
margin-top: 5px; margin-top: 5px;
} }
.state {
position: absolute;
top: 3px;
right: 3px;
.fa {
margin:0;
font-size: 18px;
}
}
} }
.listElement { .listElement {
display: none; display: none;
@ -566,7 +575,12 @@ span {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
box-sizing: border-box; box-sizing: border-box;
&.icon { &.state {
.fa:not(:last-child) {
margin-right: 5px;
}
}
&.icon, &.state {
width: 30px; width: 30px;
} }
&.type, &.atime, &.ctime { &.type, &.atime, &.ctime {

@ -176,6 +176,8 @@ define([
var $backupIcon = $('<span>', {"class": "fa fa-life-ring"}); var $backupIcon = $('<span>', {"class": "fa fa-life-ring"});
var $searchIcon = $('<span>', {"class": "fa fa-search searchIcon"}); var $searchIcon = $('<span>', {"class": "fa fa-search searchIcon"});
var $addIcon = $('<span>', {"class": "fa fa-plus"}); var $addIcon = $('<span>', {"class": "fa fa-plus"});
var $renamedIcon = $('<span>', {"class": "fa fa-flag"});
var $readonlyIcon = $('<span>', {"class": "fa fa-eye"});
var history = { var history = {
isHistoryMode: false, isHistoryMode: false,
@ -1119,19 +1121,27 @@ define([
var data = filesOp.getFileData(element); var data = filesOp.getFileData(element);
if (!data) { return void logError("No data for the file", element); } if (!data) { return void logError("No data for the file", element); }
var hrefData = Cryptpad.parsePadUrl(data.href);
var $state = $('<span>', {'class': 'state'});
if (hrefData.hashData && hrefData.hashData.mode === 'view') {
var $ro = $readonlyIcon.clone().appendTo($state);
$ro.attr('title', Messages.readonly);
}
if (data.filename && data.filename !== data.title) {
var $renamed = $renamedIcon.clone().appendTo($state);
$renamed.attr('title', "TODO: you've set a custom name for this pad. Its shared title is:\n<b>{0}</b>");
}
var name = filesOp.getTitle(element); var name = filesOp.getTitle(element);
// The element with the class '.name' is underlined when the 'li' is hovered // The element with the class '.name' is underlined when the 'li' is hovered
var $name = $('<span>', {'class': 'name'}).text(name); var $name = $('<span>', {'class': 'name'}).text(name);
$span.html(''); $span.html('');
$span.append($name); $span.append($name);
$span.append($state);
var hrefData = Cryptpad.parsePadUrl(data.href);
var type = Messages.type[hrefData.type] || hrefData.type; var type = Messages.type[hrefData.type] || hrefData.type;
var $type = $('<span>', {'class': 'type listElement'}).text(type); var $type = $('<span>', {'class': 'type listElement'}).text(type);
if (hrefData.hashData && hrefData.hashData.mode === 'view') {
$type.append(' (' + Messages.readonly+ ')');
}
var $adate = $('<span>', {'class': 'atime listElement'}).text(getDate(data.atime)); var $adate = $('<span>', {'class': 'atime listElement'}).text(getDate(data.atime));
var $cdate = $('<span>', {'class': 'ctime listElement'}).text(getDate(data.ctime)); var $cdate = $('<span>', {'class': 'ctime listElement'}).text(getDate(data.ctime));
$span.append($type); $span.append($type);
@ -1147,9 +1157,10 @@ define([
var sf = filesOp.hasSubfolder(element); var sf = filesOp.hasSubfolder(element);
var files = filesOp.hasFile(element); var files = filesOp.hasFile(element);
var $name = $('<span>', {'class': 'name'}).text(key); var $name = $('<span>', {'class': 'name'}).text(key);
var $state = $('<span>', {'class': 'state'});
var $subfolders = $('<span>', {'class': 'folders listElement'}).text(sf); var $subfolders = $('<span>', {'class': 'folders listElement'}).text(sf);
var $files = $('<span>', {'class': 'files listElement'}).text(files); var $files = $('<span>', {'class': 'files listElement'}).text(files);
$span.append($name).append($subfolders).append($files); $span.append($name).append($state).append($subfolders).append($files);
}; };
// This is duplicated in cryptpad-common, it should be unified // This is duplicated in cryptpad-common, it should be unified
@ -1542,9 +1553,11 @@ define([
//var $fohElement = $('<span>', {'class': 'element'}).appendTo($folderHeader); //var $fohElement = $('<span>', {'class': 'element'}).appendTo($folderHeader);
var $fhIcon = $('<span>', {'class': 'icon'}); var $fhIcon = $('<span>', {'class': 'icon'});
var $name = $('<span>', {'class': 'name foldername clickable'}).text(Messages.fm_folderName).click(onSortByClick); var $name = $('<span>', {'class': 'name foldername clickable'}).text(Messages.fm_folderName).click(onSortByClick);
var $state = $('<span>', {'class': 'state'});
var $subfolders = $('<span>', {'class': 'folders listElement'}).text(Messages.fm_numberOfFolders); var $subfolders = $('<span>', {'class': 'folders listElement'}).text(Messages.fm_numberOfFolders);
var $files = $('<span>', {'class': 'files listElement'}).text(Messages.fm_numberOfFiles); var $files = $('<span>', {'class': 'files listElement'}).text(Messages.fm_numberOfFiles);
$fohElement.append($fhIcon).append($name).append($subfolders).append($files); $fohElement.append($fhIcon).append($name).append($state)
.append($subfolders).append($files);
addFolderSortIcon($fohElement); addFolderSortIcon($fohElement);
return $fohElement; return $fohElement;
}; };
@ -1566,11 +1579,12 @@ define([
//var $fihElement = $('<span>', {'class': 'element'}).appendTo($fileHeader); //var $fihElement = $('<span>', {'class': 'element'}).appendTo($fileHeader);
var $fhIcon = $('<span>', {'class': 'icon'}); var $fhIcon = $('<span>', {'class': 'icon'});
var $fhName = $('<span>', {'class': 'name filename clickable'}).text(Messages.fm_fileName).click(onSortByClick); var $fhName = $('<span>', {'class': 'name filename clickable'}).text(Messages.fm_fileName).click(onSortByClick);
var $fhState = $('<span>', {'class': 'state'});
var $fhType = $('<span>', {'class': 'type clickable'}).text(Messages.fm_type).click(onSortByClick); var $fhType = $('<span>', {'class': 'type clickable'}).text(Messages.fm_type).click(onSortByClick);
var $fhAdate = $('<span>', {'class': 'atime clickable'}).text(Messages.fm_lastAccess).click(onSortByClick); var $fhAdate = $('<span>', {'class': 'atime clickable'}).text(Messages.fm_lastAccess).click(onSortByClick);
var $fhCdate = $('<span>', {'class': 'ctime clickable'}).text(Messages.fm_creation).click(onSortByClick); var $fhCdate = $('<span>', {'class': 'ctime clickable'}).text(Messages.fm_creation).click(onSortByClick);
// If displayTitle is false, it means the "name" is the title, so do not display the "name" header // If displayTitle is false, it means the "name" is the title, so do not display the "name" header
$fihElement.append($fhIcon).append($fhName).append($fhType); $fihElement.append($fhIcon).append($fhName).append($fhState).append($fhType);
if (!isWorkgroup()) { if (!isWorkgroup()) {
$fihElement.append($fhAdate).append($fhCdate); $fihElement.append($fhAdate).append($fhCdate);
} }

@ -115,6 +115,15 @@ define([
var doesAccept = $checkAcceptTerms[0].checked; var doesAccept = $checkAcceptTerms[0].checked;
/* basic validation */ /* basic validation */
if (!Cred.isLongEnoughPassword(passwd)) {
var warning = Messages._getKey('register_passwordTooShort', [
Cred.MINIMUM_PASSWORD_LENGTH
]);
return void Cryptpad.alert(warning, function () {
registering = false;
});
}
if (passwd !== confirmPassword) { // do their passwords match? if (passwd !== confirmPassword) { // do their passwords match?
return void Cryptpad.alert(Messages.register_passwordsDontMatch); return void Cryptpad.alert(Messages.register_passwordsDontMatch);
} }

Loading…
Cancel
Save