Merge branch 'staging' into fix

pull/1/head
ansuz 6 years ago
commit 0ee41bbec6

@ -26,7 +26,8 @@ var getLanguage = messages._getLanguage = function () {
var l = getBrowserLanguage(); var l = getBrowserLanguage();
// Edge returns 'fr-FR' --> transform it to 'fr' and check again // Edge returns 'fr-FR' --> transform it to 'fr' and check again
return map[l] ? l : return map[l] ? l :
(map[l.split('-')[0]] ? l.split('-')[0] : 'en'); (map[l.split('-')[0]] ? l.split('-')[0] :
(map[l.split('_')[0]] ? l.split('_')[0] : 'en'));
}; };
var language = getLanguage(); var language = getLanguage();

@ -146,7 +146,7 @@ define([
//h('a.nav-item.nav-link', { href: '/what-is-cryptpad.html'}, Msg.topbar_whatIsCryptpad), // Moved the FAQ //h('a.nav-item.nav-link', { href: '/what-is-cryptpad.html'}, Msg.topbar_whatIsCryptpad), // Moved the FAQ
//h('a.nav-item.nav-link', { href: '/faq.html'}, Msg.faq_link), //h('a.nav-item.nav-link', { href: '/faq.html'}, Msg.faq_link),
h('a.nav-item.nav-link', { href: 'https://blog.cryptpad.fr/'}, Msg.blog), h('a.nav-item.nav-link', { href: 'https://blog.cryptpad.fr/'}, Msg.blog),
h('a.nav-item.nav-link', { href: '/features.html'}, Msg.features), h('a.nav-item.nav-link', { href: '/features.html'}, Msg.pricing),
h('a.nav-item.nav-link', { href: '/privacy.html'}, Msg.privacy), h('a.nav-item.nav-link', { href: '/privacy.html'}, Msg.privacy),
//h('a.nav-item.nav-link', { href: '/contact.html'}, Msg.contact), //h('a.nav-item.nav-link', { href: '/contact.html'}, Msg.contact),
//h('a.nav-item.nav-link', { href: '/about.html'}, Msg.about), //h('a.nav-item.nav-link', { href: '/about.html'}, Msg.about),

@ -21,14 +21,14 @@ define([
target: '_blank', target: '_blank',
rel: 'noopener noreferrer' rel: 'noopener noreferrer'
}, h('button.cp-features-register-button', Msg.features_f_subscribe)); }, h('button.cp-features-register-button', Msg.features_f_subscribe));
$(premiumButton).click(function (e) { /*$(premiumButton).click(function (e) {
if (LocalStore.isLoggedIn()) { return; } if (LocalStore.isLoggedIn()) { return; }
// Not logged in: go to /login with a redirect to this page // Not logged in: go to /login with a redirect to this page
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
sessionStorage.redirectTo = '/features.html'; sessionStorage.redirectTo = '/features.html';
window.location.href = '/login/'; window.location.href = '/login/';
}); });*/
return h('div#cp-main', [ return h('div#cp-main', [
Pages.infopageTopbar(), Pages.infopageTopbar(),
h('div.container-fluid.cp_cont_features',[ h('div.container-fluid.cp_cont_features',[
@ -43,6 +43,10 @@ define([
h('div.card-body',[ h('div.card-body',[
h('h3.text-center',Msg.features_anon) h('h3.text-center',Msg.features_anon)
]), ]),
h('div.card-body.cp-pricing',[
h('div.text-center', '0€'),
h('div.text-center', Msg.features_noData),
]),
h('ul.list-group.list-group-flush', h('ul.list-group.list-group-flush',
['apps', 'core', 'file0', 'cryptdrive0', 'storage0'].map(function (f) { ['apps', 'core', 'file0', 'cryptdrive0', 'storage0'].map(function (f) {
return h('li.list-group-item', [ return h('li.list-group-item', [
@ -61,6 +65,10 @@ define([
h('div.card-body',[ h('div.card-body',[
h('h3.text-center',Msg.features_registered) h('h3.text-center',Msg.features_registered)
]), ]),
h('div.card-body.cp-pricing',[
h('div.text-center', '0€'),
h('div.text-center', Msg.features_noData),
]),
h('ul.list-group.list-group-flush', [ h('ul.list-group.list-group-flush', [
['anon', 'social', 'file1', 'cryptdrive1', 'devices', 'storage1'].map(function (f) { ['anon', 'social', 'file1', 'cryptdrive1', 'devices', 'storage1'].map(function (f) {
return h('li.list-group-item', [ return h('li.list-group-item', [
@ -87,6 +95,13 @@ define([
h('div.card-body',[ h('div.card-body',[
h('h3.text-center',Msg.features_premium) h('h3.text-center',Msg.features_premium)
]), ]),
h('div.card-body.cp-pricing',[
h('div.text-center', h('a', {
href: accounts.upgradeURL,
target: '_blank'
}, Msg._getKey('features_pricing', ['5', '10', '15']))),
h('div.text-center', Msg.features_emailRequired),
]),
h('ul.list-group.list-group-flush', [ h('ul.list-group.list-group-flush', [
['reg', 'storage2', 'support', 'supporter'].map(function (f) { ['reg', 'storage2', 'support', 'supporter'].map(function (f) {
return h('li.list-group-item', [ return h('li.list-group-item', [

@ -68,7 +68,7 @@
} }
} }
.cp-fileupload-table-progress { .cp-fileupload-table-progress {
min-width: 8em; min-width: 12em;
max-width: 16em; max-width: 16em;
position: relative; position: relative;
text-align: center; text-align: center;

@ -47,6 +47,12 @@
h3 { h3 {
margin: 0; margin: 0;
} }
&.cp-pricing {
div {
font-size: 1.2em;
color: @cryptpad_color_blue;
}
}
} }
} }
h3 { h3 {

@ -1501,7 +1501,7 @@ define([
UIElements.getAvatar = function (hash) { UIElements.getAvatar = function (hash) {
return avatars[hash]; return avatars[hash];
}; };
UIElements.displayAvatar = function (Common, $container, href, name, cb) { UIElements.displayAvatar = function (common, $container, href, name, cb) {
var displayDefault = function () { var displayDefault = function () {
var text = getFirstEmojiOrCharacter(name); var text = getFirstEmojiOrCharacter(name);
var $avatar = $('<span>', {'class': 'cp-avatar-default'}).text(text); var $avatar = $('<span>', {'class': 'cp-avatar-default'}).text(text);
@ -1537,12 +1537,14 @@ define([
return; return;
} }
// No password for avatars // No password for avatars
var privateData = common.getMetadataMgr().getPrivateData();
var origin = privateData.fileHost || privateData.origin;
var secret = Hash.getSecrets('file', parsed.hash); var secret = Hash.getSecrets('file', parsed.hash);
if (secret.keys && secret.channel) { if (secret.keys && secret.channel) {
var hexFileName = secret.channel; var hexFileName = secret.channel;
var cryptKey = Hash.encodeBase64(secret.keys && secret.keys.cryptKey); var cryptKey = Hash.encodeBase64(secret.keys && secret.keys.cryptKey);
var src = Hash.getBlobPathFromHex(hexFileName); var src = Hash.getBlobPathFromHex(hexFileName);
Common.getFileSize(hexFileName, function (e, data) { common.getFileSize(hexFileName, function (e, data) {
if (e || !data) { if (e || !data) {
displayDefault(); displayDefault();
return void console.error(e || "404 avatar"); return void console.error(e || "404 avatar");
@ -1550,9 +1552,9 @@ define([
if (typeof data !== "number") { return void displayDefault(); } if (typeof data !== "number") { return void displayDefault(); }
if (Util.bytesToMegabytes(data) > 0.5) { return void displayDefault(); } if (Util.bytesToMegabytes(data) > 0.5) { return void displayDefault(); }
var $img = $('<media-tag>').appendTo($container); var $img = $('<media-tag>').appendTo($container);
$img.attr('src', src); $img.attr('src', origin + src);
$img.attr('data-crypto-key', 'cryptpad:' + cryptKey); $img.attr('data-crypto-key', 'cryptpad:' + cryptKey);
UIElements.displayMediatagImage(Common, $img, function (err, $image, img) { UIElements.displayMediatagImage(common, $img, function (err, $image, img) {
if (err) { return void console.error(err); } if (err) { return void console.error(err); }
centerImage($img, $image, img); centerImage($img, $image, img);
}); });
@ -1859,6 +1861,15 @@ define([
content: $userAdminContent.html() content: $userAdminContent.html()
}); });
} }
options.push({
tag: 'a',
attributes: {
'target': '_blank',
'href': origin+'/index.html',
'class': 'fa fa-home'
},
content: h('span', Messages.homePage)
});
if (padType !== 'drive' || (!accountName && priv.newSharedFolder)) { if (padType !== 'drive' || (!accountName && priv.newSharedFolder)) {
options.push({ options.push({
tag: 'a', tag: 'a',
@ -1870,6 +1881,7 @@ define([
content: h('span', Messages.login_accessDrive) content: h('span', Messages.login_accessDrive)
}); });
} }
options.push({ tag: 'hr' });
// Add the change display name button if not in read only mode // Add the change display name button if not in read only mode
if (config.changeNameButtonCls && config.displayChangeName && !AppConfig.disableProfile) { if (config.changeNameButtonCls && config.displayChangeName && !AppConfig.disableProfile) {
options.push({ options.push({
@ -1892,6 +1904,7 @@ define([
content: h('span', Messages.settingsButton) content: h('span', Messages.settingsButton)
}); });
} }
options.push({ tag: 'hr' });
// Add administration panel link if the user is an admin // Add administration panel link if the user is an admin
if (priv.edPublic && Array.isArray(Config.adminKeys) && Config.adminKeys.indexOf(priv.edPublic) !== -1) { if (priv.edPublic && Array.isArray(Config.adminKeys) && Config.adminKeys.indexOf(priv.edPublic) !== -1) {
options.push({ options.push({
@ -1907,6 +1920,16 @@ define([
content: h('span', Messages.supportPage || 'Support') content: h('span', Messages.supportPage || 'Support')
}); });
} }
options.push({
tag: 'a',
attributes: {
'target': '_blank',
'href': origin+'/features.html',
'class': 'fa fa-star-o'
},
content: h('span', priv.plan ? Messages.settings_cat_subscription : Messages.pricing)
});
options.push({ tag: 'hr' });
// Add login or logout button depending on the current status // Add login or logout button depending on the current status
if (accountName) { if (accountName) {
options.push({ options.push({

@ -416,8 +416,12 @@ define([
"Backspace": function () { "Backspace": function () {
var cursor = doc.getCursor(); var cursor = doc.getCursor();
var line = doc.getLine(cursor.line); var line = doc.getLine(cursor.line);
if (line.substring(0, cursor.ch).trim() === "") { editor.execCommand("indentLess"); } var beforeCursor = line.substring(0, cursor.ch);
else { editor.execCommand("delCharBefore"); } if (beforeCursor && beforeCursor.trim() === "") {
editor.execCommand("indentLess");
} else {
editor.execCommand("delCharBefore");
}
}, },
}); });

@ -301,7 +301,7 @@ define([
]); ]);
$(content).find('#cp-upload-owned').on('change', function () { $(content).find('#cp-upload-owned').on('change', function () {
var val = Util.isCheked($(content).find('#cp-upload-owned')); var val = Util.isChecked($(content).find('#cp-upload-owned'));
if (val) { if (val) {
$(content).find('#cp-upload-store').prop('checked', true).prop('disabled', true); $(content).find('#cp-upload-store').prop('checked', true).prop('disabled', true);
} else { } else {
@ -533,8 +533,7 @@ define([
createUploader(config.dropArea, config.hoverArea, config.body); createUploader(config.dropArea, config.hoverArea, config.body);
// XXX an X is still displayed when downloading, even though we can't cancel (at the moment) // TODO implement the ability to cancel downloads :D
// XXX implement the abiality to cancel downloads :D
var updateProgressbar = function (file, data, downloadFunction, cb) { var updateProgressbar = function (file, data, downloadFunction, cb) {
if (queue.inProgress) { return; } if (queue.inProgress) { return; }
queue.inProgress = true; queue.inProgress = true;
@ -625,10 +624,10 @@ define([
}); });
*/ */
/*
$row.find('.cp-fileupload-table-cancel') $row.find('.cp-fileupload-table-cancel')
.html('') .html('')
.append($cancel); */ .append(h('span.fa.fa-minus'));
//.append($cancel);
}; };
File.downloadFile = function (fData, cb) { File.downloadFile = function (fData, cb) {

@ -505,7 +505,7 @@ define([
}; };
var shortcuts = []; var shortcuts = [];
funcs.addShortcuts = function (w) { funcs.addShortcuts = function (w, isApp) {
w = w || window; w = w || window;
if (shortcuts.indexOf(w) !== -1) { return; } if (shortcuts.indexOf(w) !== -1) { return; }
shortcuts.push(w); shortcuts.push(w);
@ -513,7 +513,7 @@ define([
// Ctrl || Meta (mac) // Ctrl || Meta (mac)
if (e.ctrlKey || (navigator.platform === "MacIntel" && e.metaKey)) { if (e.ctrlKey || (navigator.platform === "MacIntel" && e.metaKey)) {
// Ctrl+E: New pad modal // Ctrl+E: New pad modal
if (e.which === 69) { if (e.which === 69 && isApp) {
e.preventDefault(); e.preventDefault();
return void funcs.createNewPadModal(); return void funcs.createNewPadModal();
} }
@ -619,22 +619,24 @@ define([
ctx.metadataMgr.onReady(waitFor()); ctx.metadataMgr.onReady(waitFor());
funcs.addShortcuts();
}).nThen(function () { }).nThen(function () {
var privateData = ctx.metadataMgr.getPrivateData();
funcs.addShortcuts(window, Boolean(privateData.app));
try { try {
var feedback = ctx.metadataMgr.getPrivateData().feedbackAllowed; var feedback = privateData.feedbackAllowed;
Feedback.init(feedback); Feedback.init(feedback);
} catch (e) { Feedback.init(false); } } catch (e) { Feedback.init(false); }
try { try {
var forbidden = ctx.metadataMgr.getPrivateData().disabledApp; var forbidden = privateData.disabledApp;
if (forbidden) { if (forbidden) {
UI.alert(Messages.disabledApp, function () { UI.alert(Messages.disabledApp, function () {
funcs.gotoURL('/drive/'); funcs.gotoURL('/drive/');
}, {forefront: true}); }, {forefront: true});
return; return;
} }
var mustLogin = ctx.metadataMgr.getPrivateData().registeredOnly; var mustLogin = privateData.registeredOnly;
if (mustLogin) { if (mustLogin) {
UI.alert(Messages.mustLogin, function () { UI.alert(Messages.mustLogin, function () {
funcs.setLoginRedirect(function () { funcs.setLoginRedirect(function () {
@ -648,7 +650,7 @@ define([
} }
try { try {
window.CP_DEV_MODE = ctx.metadataMgr.getPrivateData().devMode; window.CP_DEV_MODE = privateData.devMode;
} catch (e) {} } catch (e) {}
ctx.sframeChan.on('EV_LOGOUT', function () { ctx.sframeChan.on('EV_LOGOUT', function () {
@ -658,7 +660,7 @@ define([
} }
}); });
UI.addLoadingScreen({hideTips: true}); UI.addLoadingScreen({hideTips: true});
var origin = ctx.metadataMgr.getPrivateData().origin; var origin = privateData.origin;
var href = origin + "/login/"; var href = origin + "/login/";
var onLogoutMsg = Messages._getKey('onLogout', ['<a href="' + href + '" target="_blank">', '</a>']); var onLogoutMsg = Messages._getKey('onLogout', ['<a href="' + href + '" target="_blank">', '</a>']);
UI.errorLoadingScreen(onLogoutMsg, true); UI.errorLoadingScreen(onLogoutMsg, true);

@ -1124,5 +1124,14 @@
"requestEdit_accepted": "{1} hat dir Bearbeitungsrechte für das Pad <b>{0}</b> gegeben", "requestEdit_accepted": "{1} hat dir Bearbeitungsrechte für das Pad <b>{0}</b> gegeben",
"requestEdit_sent": "Anfrage gesendet", "requestEdit_sent": "Anfrage gesendet",
"uploadFolderButton": "Ordner hochladen", "uploadFolderButton": "Ordner hochladen",
"properties_unknownUser": "{0} unbekannte(r) Benutzer" "properties_unknownUser": "{0} unbekannte(r) Benutzer",
"fm_morePads": "Mehr",
"fc_openInCode": "Im Code-Editor öffnen",
"uploadFolder_modal_title": "Optionen für Ordnerupload",
"uploadFolder_modal_filesPassword": "Passwort für Dateien",
"uploadFolder_modal_owner": "Eigene Dateien",
"uploadFolder_modal_forceSave": "Dateien im CryptDrive speichern",
"convertFolderToSF_SFParent": "Dieser Ordner kann an seinem aktuellen Ort nicht einen geteilten Ordner umgewandelt werden. Verschiebe ihn zunächst aus dem übergeordneten geteilten Ordner heraus.",
"convertFolderToSF_SFChildren": "Dieser Ordner kann nicht in einen geteilten Ordner umgewandelt werden, weil er bereits geteilte Ordner enthält. Verschiebe diese geteilten Ordner zunächst an einen anderen Ort.",
"convertFolderToSF_confirm": "Dieser Ordner muss in einen geteilten Ordner umgewandelt werden, damit ihn andere sehen können. Fortfahren?"
} }

@ -1126,13 +1126,15 @@
"requestEdit_sent": "Demande envoyée", "requestEdit_sent": "Demande envoyée",
"uploadFolderButton": "Importer un dossier", "uploadFolderButton": "Importer un dossier",
"properties_unknownUser": "{0} utilisateur(s) inconnu(s)", "properties_unknownUser": "{0} utilisateur(s) inconnu(s)",
"fm_morePads": "Plus de pads", "fm_morePads": "Plus",
"fc_openInCode": "Ouvrir dans l'application Code", "fc_openInCode": "Ouvrir dans l'application Code",
"uploadFolder_modal_title": "Options d'importation du dossier", "uploadFolder_modal_title": "Options d'importation du dossier",
"uploadFolder_modal_filesPassword": "Mot de passe des fichiers", "uploadFolder_modal_filesPassword": "Mot de passe des fichiers",
"uploadFolder_modal_owner": "Être propriétaire des fichiers", "uploadFolder_modal_owner": "Être propriétaire des fichiers",
"uploadFolder_modal_forceSave": "Stocker les fichiers dans votre CryptDrive", "uploadFolder_modal_forceSave": "Stocker les fichiers dans votre CryptDrive",
"convertFolderToSF_SFParent": "Impossible de convertir ce dossier en dossier partagé car il se situe à l'interieur d'un autre dossier partagé. Veuillez le déplacer à l'extérieur afin de continuer.", "convertFolderToSF_SFParent": "Impossible de convertir ce dossier en dossier partagé car il se situe à l'intérieur d'un autre dossier partagé. Veuillez le déplacer à l'extérieur afin de continuer.",
"convertFolderToSF_SFChildren": "Impossible de convertir ce dossier en dossier partagé car il contient déjà d'autres dossiers partagés. Veuillez déplacer ces dossiers à l'extérieur afin de continuer.", "convertFolderToSF_SFChildren": "Impossible de convertir ce dossier en dossier partagé car il contient déjà d'autres dossiers partagés. Veuillez déplacer ces dossiers à l'extérieur afin de continuer.",
"convertFolderToSF_confirm": "Ce dossier va être converti en dossier partagé afin de pouvoir être accessible par d'autres utilisateurs. Continuer ?" "convertFolderToSF_confirm": "Ce dossier va être converti en dossier partagé afin de pouvoir être accessible par d'autres utilisateurs. Continuer ?",
"pricing": "Tarification",
"homePage": "Page d'accueil"
} }

@ -322,7 +322,7 @@
"fm_newButtonTitle": "Create a new pad or folder, import a file in the current folder", "fm_newButtonTitle": "Create a new pad or folder, import a file in the current folder",
"fm_newFolder": "New folder", "fm_newFolder": "New folder",
"fm_newFile": "New pad", "fm_newFile": "New pad",
"fm_morePads": "More pads", "fm_morePads": "More",
"fm_folder": "Folder", "fm_folder": "Folder",
"fm_sharedFolder": "Shared folder", "fm_sharedFolder": "Shared folder",
"fm_folderName": "Folder name", "fm_folderName": "Folder name",
@ -1134,5 +1134,7 @@
"requestEdit_accepted": "{1} granted you edit rights for the pad <b>{0}</b>", "requestEdit_accepted": "{1} granted you edit rights for the pad <b>{0}</b>",
"requestEdit_sent": "Request sent", "requestEdit_sent": "Request sent",
"uploadFolderButton": "Upload folder", "uploadFolderButton": "Upload folder",
"properties_unknownUser": "{0} unknown user(s)" "properties_unknownUser": "{0} unknown user(s)",
"pricing": "Pricing",
"homePage": "Home page"
} }

@ -59,6 +59,7 @@ define([
var secret; var secret;
var metadataMgr = common.getMetadataMgr(); var metadataMgr = common.getMetadataMgr();
var priv = metadataMgr.getPrivateData(); var priv = metadataMgr.getPrivateData();
var fileHost = priv.fileHost || priv.origin;
if (!priv.filehash) { if (!priv.filehash) {
uploadMode = true; uploadMode = true;
@ -88,7 +89,7 @@ define([
if (!uploadMode) { if (!uploadMode) {
var hexFileName = secret.channel; var hexFileName = secret.channel;
var src = Hash.getBlobPathFromHex(hexFileName); var src = fileHost + Hash.getBlobPathFromHex(hexFileName);
var key = secret.keys && secret.keys.cryptKey; var key = secret.keys && secret.keys.cryptKey;
var cryptKey = Nacl.util.encodeBase64(key); var cryptKey = Nacl.util.encodeBase64(key);

@ -122,9 +122,13 @@
#cp-app-profile-invite-button { #cp-app-profile-invite-button {
float: right; float: right;
} }
#cp-app-profile-viewprofile-button { .cp-app-profile-viewprofile-button {
margin-bottom: 20px; margin-bottom: 20px;
float: right; float: right;
margin-left: 5px;
&> span {
margin-left: 10px;
}
} }
#cp-app-profile-description { #cp-app-profile-description {
position: relative; position: relative;

@ -9,6 +9,7 @@ define([
'/common/common-interface.js', '/common/common-interface.js',
'/common/common-ui-elements.js', '/common/common-ui-elements.js',
'/common/common-realtime.js', '/common/common-realtime.js',
'/common/clipboard.js',
'/common/hyperscript.js', '/common/hyperscript.js',
'/customize/messages.js', '/customize/messages.js',
'/customize/application_config.js', '/customize/application_config.js',
@ -36,6 +37,7 @@ define([
UI, UI,
UIElements, UIElements,
Realtime, Realtime,
Clipboard,
h, h,
Messages, Messages,
AppConfig, AppConfig,
@ -96,15 +98,20 @@ define([
var hash = common.getMetadataMgr().getPrivateData().hashes.viewHash; var hash = common.getMetadataMgr().getPrivateData().hashes.viewHash;
var url = APP.origin + '/profile/#' + hash; var url = APP.origin + '/profile/#' + hash;
var $button = $('<button>', { $('<button>', {
'class': 'btn btn-success', 'class': 'btn btn-success '+VIEW_PROFILE_BUTTON,
id: VIEW_PROFILE_BUTTON, }).text(Messages.profile_viewMyProfile).click(function () {
})
.text(Messages.profile_viewMyProfile)
.click(function () {
window.open(url, '_blank'); window.open(url, '_blank');
}); }).appendTo($container);
$container.append($button);
$('<button>', {
'class': 'btn btn-success '+VIEW_PROFILE_BUTTON,
}).append(h('i.fa.fa-shhare-alt'))
.append(h('span', Messages.shareButton))
.click(function () {
var success = Clipboard.copy(url);
if (success) { UI.log(Messages.shareSuccess); }
}).appendTo($container);
}; };
var addDisplayName = function ($container) { var addDisplayName = function ($container) {

Loading…
Cancel
Save