From 49294fc0c32a6e217a8eb8c6355b7cabe2366245 Mon Sep 17 00:00:00 2001 From: Weblate Date: Fri, 7 Feb 2020 17:25:22 +0100 Subject: [PATCH 1/8] Translated using Weblate (English) Currently translated at 100.0% (1204 of 1204 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ --- www/common/translations/messages.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 76e72cc2e..d3fbd1c65 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -936,7 +936,7 @@ "feedback_about": "If you're reading this, you were probably curious why CryptPad is requesting web pages when you perform certain actions", "feedback_privacy": "We care about your privacy, and at the same time we want CryptPad to be very easy to use. We use this file to figure out which UI features matter to our users, by requesting it along with a parameter specifying which action was taken.", "feedback_optout": "If you would like to opt out, visit your user settings page, where you'll find a checkbox to enable or disable user feedback", - "creation_404": "This pad not longer exists. Use the following form to create a new pad.", + "creation_404": "This pad no longer exists. Use the following form to create a new pad.", "creation_ownedTitle": "Type of pad", "creation_owned": "Owned pad", "creation_ownedTrue": "Owned pad", From 1332f33a1a79da6afb7bdb981a404c76996c6b67 Mon Sep 17 00:00:00 2001 From: Weblate Date: Fri, 7 Feb 2020 17:25:22 +0100 Subject: [PATCH 2/8] Translated using Weblate (French) Currently translated at 100.0% (1204 of 1204 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/fr/ --- www/common/translations/messages.fr.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/translations/messages.fr.json b/www/common/translations/messages.fr.json index 694b218d6..79740780a 100644 --- a/www/common/translations/messages.fr.json +++ b/www/common/translations/messages.fr.json @@ -1294,7 +1294,7 @@ "imprint": "Mentions légales", "isContact": "{0} est dans vos contacts", "isNotContact": "{0} n'est pas dans vos contacts", - "settings_safeLinksHint": "CryptPad inclut dans ses liens les clés permettant de décrypter vos pads. Toute personne ayant accès à votre historique de navigation peut potentiellement lire vos données. Cela inclut les extensions de navigateur intrusives et les navigateurs qui synchronisent votre historique entre les appareils. L'activation des \"liens sécurisés\" empêche les clés d'entrer dans votre historique de navigation ou d'être affichées dans votre barre d'adresse quand cela est possible. Nous vous recommandons vivement d'activer cette fonction et d'utiliser le menu {0} Partager.", + "settings_safeLinksHint": "CryptPad inclut dans ses liens les clés permettant de déchiffrer vos pads. Toute personne ayant accès à votre historique de navigation peut potentiellement lire vos données. Cela inclut les extensions de navigateur intrusives et les navigateurs qui synchronisent votre historique entre les appareils. L'activation des \"liens sécurisés\" empêche les clés d'entrer dans votre historique de navigation ou d'être affichées dans votre barre d'adresse quand cela est possible. Nous vous recommandons vivement d'activer cette fonction et d'utiliser le menu {0} Partager.", "profile_login": "Vous devez vous connecter pour ajouter cet utilisateur à vos contacts", "dontShowAgain": "Ne plus demander", "safeLinks_error": "Le lien utilisé ne permet pas d'ouvrir ce document", From f23649c1ce9b34342b48d79920ef88a16ff9c16b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Fri, 7 Feb 2020 16:28:29 +0000 Subject: [PATCH 3/8] remove obsolete keys --- www/common/translations/messages.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index d3fbd1c65..c3ac1e275 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -184,7 +184,6 @@ "okButton": "OK (enter)", "cancel": "Cancel", "cancelButton": "Cancel (esc)", - "doNotAskAgain": "Don't ask me again (Esc)", "show_help_button": "Show help", "hide_help_button": "Hide help", "help_button": "Help", @@ -956,7 +955,6 @@ "creation_noTemplate": "No template", "creation_newTemplate": "New template", "creation_create": "Create", - "creation_saveSettings": "Don't show this again", "creation_settings": "View more settings", "creation_rememberHelp": "Visit your Settings page to reset this preference", "creation_owners": "Owners", @@ -1028,7 +1026,6 @@ "crowdfunding_popup_text": "

We need your help!

To ensure that CryptPad is actively developed, consider supporting the project via the OpenCollective page, where you can see our Roadmap and Funding goals.", "crowdfunding_popup_yes": "Go to OpenCollective", "crowdfunding_popup_no": "Not now", - "crowdfunding_popup_never": "Don't ask me again", "survey": "CryptPad survey", "markdown_toc": "Contents", "fm_expirablePad": "Expires: {0}", From 4d2538c79684ec9a17944d1c09f265648f710dcb Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 10 Feb 2020 10:46:20 +0100 Subject: [PATCH 4/8] Make hidden hashes disabled by default --- www/common/common-ui-elements.js | 2 +- www/common/drive-ui.js | 2 +- www/common/sframe-common-outer.js | 4 ++-- www/settings/inner.js | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index feec4f243..9e8448c6f 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -657,7 +657,7 @@ define([ // Use hidden hash if needed (we're an owner of this pad so we know it is stored) var useUnsafe = Util.find(priv, ['settings', 'security', 'unsafeLinks']); var href = (priv.readOnly && data.roHref) ? data.roHref : data.href; - if (!useUnsafe) { + if (useUnsafe === false) { var newParsed = Hash.parsePadUrl(href); var newSecret = Hash.getSecrets(newParsed.type, newParsed.hash, newPass); var newHash = Hash.getHiddenHashFromKeys(parsed.type, newSecret, {}); diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index ff15e091f..51f3c015d 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -1037,7 +1037,7 @@ define([ var href = isRo ? data.roHref : (data.href || data.roHref); var priv = metadataMgr.getPrivateData(); var useUnsafe = Util.find(priv, ['settings', 'security', 'unsafeLinks']); - if (useUnsafe) { + if (useUnsafe !== false) { // true of undefined: use unsafe links return void window.open(APP.origin + href); } diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index fa9afaed8..a7af0f6b6 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -646,7 +646,7 @@ define([ var opts = parsed.getOptions(); var hash = Utils.Hash.getHiddenHashFromKeys(parsed.type, secret, opts); var useUnsafe = Utils.Util.find(settings, ['security', 'unsafeLinks']); - if (!useUnsafe && window.history && window.history.replaceState) { + if (useUnsafe === false && window.history && window.history.replaceState) { if (!/^#/.test(hash)) { hash = '#' + hash; } window.history.replaceState({}, window.document.title, hash); } @@ -684,7 +684,7 @@ define([ var opts = parsed.getOptions(); var hash = Utils.Hash.getHiddenHashFromKeys(parsed.type, secret, opts); var useUnsafe = Utils.Util.find(settings, ['security', 'unsafeLinks']); - if (!useUnsafe && window.history && window.history.replaceState) { + if (useUnsafe === false && window.history && window.history.replaceState) { if (!/^#/.test(hash)) { hash = '#' + hash; } window.history.replaceState({}, window.document.title, hash); } diff --git a/www/settings/inner.js b/www/settings/inner.js index 683a3e222..7de5b7752 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -573,10 +573,11 @@ define([ var $cbox = $(UI.createCheckbox('cp-settings-safe-links', Messages.settings_safeLinksCheckbox, - true, { label: {class: 'noTitle'} })); + false, { label: {class: 'noTitle'} })); var spinner = UI.makeSpinner($cbox); + // Checkbox: "Enable safe links" var $checkbox = $cbox.find('input').on('change', function () { spinner.spin(); var val = !$checkbox.is(':checked'); @@ -587,7 +588,7 @@ define([ common.getAttribute(['security', 'unsafeLinks'], function (e, val) { if (e) { return void console.error(e); } - if (!val) { + if (val === false) { $checkbox.attr('checked', 'checked'); } }); From 243abc3e535b94522280774ca3fd412516fc9581 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 10 Feb 2020 11:16:44 +0100 Subject: [PATCH 5/8] Change default settings for hidden hash --- www/common/outer/async-store.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index c544754ba..d3b1dce6e 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -32,6 +32,16 @@ define([ NetConfig, AppConfig, Crypto, ChainPad, CpNetflux, Listmap, nThen, Saferphore) { + // Default settings for new users + var NEW_USER_SETTINGS = { + drive: { + hideDuplicate: true + }, + general: { + allowUserFeedback: true // XXX corner popup in settings? + } + }; + var create = function () { var Store = window.Cryptpad_Store = {}; var postMessage = function () {}; @@ -2270,7 +2280,7 @@ define([ if (!store.loggedIn) { return void cb(); } Store.pinPads(null, data, cb); }; - if (!proxy.settings) { proxy.settings = {}; } + if (!proxy.settings) { proxy.settings = NEW_USER_SETTINGS; } if (!proxy.friends_pending) { proxy.friends_pending = {}; } var manager = store.manager = ProxyManager.create(proxy.drive, { onSync: function (cb) { onSync(null, cb); }, @@ -2355,13 +2365,7 @@ define([ } } - if (!proxy.settings || !proxy.settings.general || - typeof(proxy.settings.general.allowUserFeedback) !== 'boolean') { - proxy.settings = proxy.settings || {}; - proxy.settings.general = proxy.settings.general || {}; - proxy.settings.general.allowUserFeedback = true; - } - returned.feedback = proxy.settings.general.allowUserFeedback; + returned.feedback = Util.find(proxy, ['settings', 'general', 'allowUserFeedback']); Feedback.init(returned.feedback); if (typeof(cb) === 'function') { cb(returned); } From 7ca92526e77270d59cb7000fbd3d56b797682c66 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 10 Feb 2020 11:17:01 +0100 Subject: [PATCH 6/8] Remove 'Owned pads' category from the drive --- www/common/drive-ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 51f3c015d..8bf50bb3b 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -587,7 +587,7 @@ define([ var displayedCategories = [ROOT, TRASH, SEARCH, RECENT]; // PCS enabled: display owned pads - if (AppConfig.displayCreationScreen) { displayedCategories.push(OWNED); } + //if (AppConfig.displayCreationScreen) { displayedCategories.push(OWNED); } // Templates enabled: display template category if (AppConfig.enableTemplates) { displayedCategories.push(TEMPLATE); } // Tags used: display Tags category From 09076f39ffa441a53545822e038c851252a35a6a Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 10 Feb 2020 12:01:00 +0100 Subject: [PATCH 7/8] Fix and reenable folder to SF conversion --- www/common/drive-ui.js | 7 ++----- www/common/proxy-manager.js | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 8bf50bb3b..78510b6dd 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -1204,8 +1204,6 @@ define([ hide.push('collapseall'); } containsFolder = true; - hide.push('share'); // XXX CONVERT - hide.push('savelocal'); // XXX CONVERT hide.push('openro'); hide.push('openincode'); hide.push('properties'); @@ -4054,8 +4052,7 @@ define([ if (manager.isFolder(el) && !manager.isSharedFolder(el)) { // Folder // if folder is inside SF - return UI.warn('ERROR: Temporarily disabled'); // XXX CONVERT - /*if (manager.isInSharedFolder(paths[0].path)) { + if (manager.isInSharedFolder(paths[0].path)) { return void UI.alert(Messages.convertFolderToSF_SFParent); } // if folder already contains SF @@ -4085,7 +4082,7 @@ define([ var owned = Util.isChecked($(convertContent).find('#cp-upload-owned')); manager.convertFolderToSharedFolder(paths[0].path, owned, password, refresh); }); - }*/ + } } else { // File var sf = manager.isSharedFolder(el); data = sf ? manager.getSharedFolderData(el) : manager.getFileData(el); diff --git a/www/common/proxy-manager.js b/www/common/proxy-manager.js index 67ce14816..2fa3751f7 100644 --- a/www/common/proxy-manager.js +++ b/www/common/proxy-manager.js @@ -587,14 +587,10 @@ define([ // convert a folder to a Shared Folder var _convertFolderToSharedFolder = function (Env, data, cb) { - return void cb({ - error: 'DISABLED' - }); // XXX CONVERT - /*var path = data.path; + var path = data.path; var folderElement = Env.user.userObject.find(path); // don't try to convert top-level elements (trash, root, etc) to shared-folders - // TODO also validate that you're in root (not templates, etc) - if (data.path.length <= 1) { + if (path.length <= 1 || path[0] !== UserObject.ROOT) { return void cb({ error: 'E_INVAL_PATH', }); @@ -664,6 +660,21 @@ define([ newPath: newPath, copy: false, }, waitFor()); + }).nThen(function (waitFor) { + // Move the owned pads from the old folder to root + var paths = []; + Object.keys(folderElement).forEach(function (el) { + if (!Env.user.userObject.isFile(folderElement[el])) { return; } + var data = Env.user.userObject.getFileData(folderElement[el]); + if (!data || !_ownedByMe(Env, data.owners)) { return; } + // This is an owned pad: move it to ROOT before deleting the initial folder + paths.push(path.concat(el)); + }); + _move(Env, { + paths: paths, + newPath: [UserObject.ROOT], + copy: false, + }, waitFor()); }).nThen(function () { // migrate metadata var sharedFolderElement = Env.user.proxy[UserObject.SHARED_FOLDERS][SFId]; @@ -680,7 +691,7 @@ define([ Env.user.userObject.delete([path], function () { cb(); }); - });*/ + }); }; // Delete permanently some pads or folders From 8afb0255c14a2131ebe5a3fc5785790edea1dc7d Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 10 Feb 2020 13:27:07 +0100 Subject: [PATCH 8/8] Fix team creation --- lib/historyKeeper.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/historyKeeper.js b/lib/historyKeeper.js index ff7b531e9..7a10d9f42 100644 --- a/lib/historyKeeper.js +++ b/lib/historyKeeper.js @@ -908,13 +908,13 @@ module.exports.create = function (cfg, cb) { } // unauthenticated RPC calls have a different message format - if (msg[0] === "WRITE_PRIVATE_MESSAGE" && output && output.channel) { + if (msg[0] === "WRITE_PRIVATE_MESSAGE" && Array.isArray(output) && output[1] && output[1].channel) { // clients don't validate messages sent by the historyKeeper // so this broadcast needs to come from a different id // we pass 'null' to indicate that it's not coming from a real user // to ensure that they know not to trust this message - Server.getChannelUserList(output.channel).forEach(function (userId) { - Server.send(userId, output.message); + Server.getChannelUserList(output[1].channel).forEach(function (userId) { + Server.send(userId, output[1].message); }); // rpc and anonRpc expect their responses to be of a certain length