accidentally merge uncommitted work with staging, resolve merge conflicts

pull/1/head
ansuz 5 years ago
commit 86b9cc2de1

@ -234,6 +234,18 @@ var createUser = function (config, cb) {
return void cb(err); return void cb(err);
} }
})); }));
}).nThen(function (w) {
// some basic sanity checks...
user.rpc.getServerHash(w(function (err, hash) {
if (err) {
w.abort();
return void cb(err);
}
if (hash !== EMPTY_ARRAY_HASH) {
console.error("EXPECTED EMPTY ARRAY HASH");
process.exit(1);
}
}));
}).nThen(function () { }).nThen(function () {
user.cleanup = function (cb) { user.cleanup = function (cb) {

@ -657,7 +657,7 @@ define([
// Use hidden hash if needed (we're an owner of this pad so we know it is stored) // 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 useUnsafe = Util.find(priv, ['settings', 'security', 'unsafeLinks']);
var href = (priv.readOnly && data.roHref) ? data.roHref : data.href; var href = (priv.readOnly && data.roHref) ? data.roHref : data.href;
if (!useUnsafe) { if (useUnsafe === false) {
var newParsed = Hash.parsePadUrl(href); var newParsed = Hash.parsePadUrl(href);
var newSecret = Hash.getSecrets(newParsed.type, newParsed.hash, newPass); var newSecret = Hash.getSecrets(newParsed.type, newParsed.hash, newPass);
var newHash = Hash.getHiddenHashFromKeys(parsed.type, newSecret, {}); var newHash = Hash.getHiddenHashFromKeys(parsed.type, newSecret, {});

@ -587,7 +587,7 @@ define([
var displayedCategories = [ROOT, TRASH, SEARCH, RECENT]; var displayedCategories = [ROOT, TRASH, SEARCH, RECENT];
// PCS enabled: display owned pads // PCS enabled: display owned pads
if (AppConfig.displayCreationScreen) { displayedCategories.push(OWNED); } //if (AppConfig.displayCreationScreen) { displayedCategories.push(OWNED); }
// Templates enabled: display template category // Templates enabled: display template category
if (AppConfig.enableTemplates) { displayedCategories.push(TEMPLATE); } if (AppConfig.enableTemplates) { displayedCategories.push(TEMPLATE); }
// Tags used: display Tags category // Tags used: display Tags category
@ -1037,7 +1037,7 @@ define([
var href = isRo ? data.roHref : (data.href || data.roHref); var href = isRo ? data.roHref : (data.href || data.roHref);
var priv = metadataMgr.getPrivateData(); var priv = metadataMgr.getPrivateData();
var useUnsafe = Util.find(priv, ['settings', 'security', 'unsafeLinks']); 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); return void window.open(APP.origin + href);
} }
@ -1204,8 +1204,6 @@ define([
hide.push('collapseall'); hide.push('collapseall');
} }
containsFolder = true; containsFolder = true;
hide.push('share'); // XXX CONVERT
hide.push('savelocal'); // XXX CONVERT
hide.push('openro'); hide.push('openro');
hide.push('openincode'); hide.push('openincode');
hide.push('properties'); hide.push('properties');
@ -4054,8 +4052,7 @@ define([
if (manager.isFolder(el) && !manager.isSharedFolder(el)) { // Folder if (manager.isFolder(el) && !manager.isSharedFolder(el)) { // Folder
// if folder is inside SF // 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); return void UI.alert(Messages.convertFolderToSF_SFParent);
} }
// if folder already contains SF // if folder already contains SF
@ -4085,7 +4082,7 @@ define([
var owned = Util.isChecked($(convertContent).find('#cp-upload-owned')); var owned = Util.isChecked($(convertContent).find('#cp-upload-owned'));
manager.convertFolderToSharedFolder(paths[0].path, owned, password, refresh); manager.convertFolderToSharedFolder(paths[0].path, owned, password, refresh);
}); });
}*/ }
} else { // File } else { // File
var sf = manager.isSharedFolder(el); var sf = manager.isSharedFolder(el);
data = sf ? manager.getSharedFolderData(el) : manager.getFileData(el); data = sf ? manager.getSharedFolderData(el) : manager.getFileData(el);

@ -32,6 +32,16 @@ define([
NetConfig, AppConfig, NetConfig, AppConfig,
Crypto, ChainPad, CpNetflux, Listmap, nThen, Saferphore) { 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 create = function () {
var Store = window.Cryptpad_Store = {}; var Store = window.Cryptpad_Store = {};
var postMessage = function () {}; var postMessage = function () {};
@ -2270,7 +2280,7 @@ define([
if (!store.loggedIn) { return void cb(); } if (!store.loggedIn) { return void cb(); }
Store.pinPads(null, data, 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 = {}; } if (!proxy.friends_pending) { proxy.friends_pending = {}; }
var manager = store.manager = ProxyManager.create(proxy.drive, { var manager = store.manager = ProxyManager.create(proxy.drive, {
onSync: function (cb) { onSync(null, cb); }, onSync: function (cb) { onSync(null, cb); },
@ -2355,13 +2365,7 @@ define([
} }
} }
if (!proxy.settings || !proxy.settings.general || returned.feedback = Util.find(proxy, ['settings', 'general', 'allowUserFeedback']);
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;
Feedback.init(returned.feedback); Feedback.init(returned.feedback);
if (typeof(cb) === 'function') { cb(returned); } if (typeof(cb) === 'function') { cb(returned); }

@ -587,14 +587,10 @@ define([
// convert a folder to a Shared Folder // convert a folder to a Shared Folder
var _convertFolderToSharedFolder = function (Env, data, cb) { var _convertFolderToSharedFolder = function (Env, data, cb) {
return void cb({ var path = data.path;
error: 'DISABLED'
}); // XXX CONVERT
/*var path = data.path;
var folderElement = Env.user.userObject.find(path); var folderElement = Env.user.userObject.find(path);
// don't try to convert top-level elements (trash, root, etc) to shared-folders // 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 (path.length <= 1 || path[0] !== UserObject.ROOT) {
if (data.path.length <= 1) {
return void cb({ return void cb({
error: 'E_INVAL_PATH', error: 'E_INVAL_PATH',
}); });
@ -664,6 +660,21 @@ define([
newPath: newPath, newPath: newPath,
copy: false, copy: false,
}, waitFor()); }, 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 () { }).nThen(function () {
// migrate metadata // migrate metadata
var sharedFolderElement = Env.user.proxy[UserObject.SHARED_FOLDERS][SFId]; var sharedFolderElement = Env.user.proxy[UserObject.SHARED_FOLDERS][SFId];
@ -680,7 +691,7 @@ define([
Env.user.userObject.delete([path], function () { Env.user.userObject.delete([path], function () {
cb(); cb();
}); });
});*/ });
}; };
// Delete permanently some pads or folders // Delete permanently some pads or folders

@ -646,7 +646,7 @@ define([
var opts = parsed.getOptions(); var opts = parsed.getOptions();
var hash = Utils.Hash.getHiddenHashFromKeys(parsed.type, secret, opts); var hash = Utils.Hash.getHiddenHashFromKeys(parsed.type, secret, opts);
var useUnsafe = Utils.Util.find(settings, ['security', 'unsafeLinks']); 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; } if (!/^#/.test(hash)) { hash = '#' + hash; }
window.history.replaceState({}, window.document.title, hash); window.history.replaceState({}, window.document.title, hash);
} }
@ -684,7 +684,7 @@ define([
var opts = parsed.getOptions(); var opts = parsed.getOptions();
var hash = Utils.Hash.getHiddenHashFromKeys(parsed.type, secret, opts); var hash = Utils.Hash.getHiddenHashFromKeys(parsed.type, secret, opts);
var useUnsafe = Utils.Util.find(settings, ['security', 'unsafeLinks']); 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; } if (!/^#/.test(hash)) { hash = '#' + hash; }
window.history.replaceState({}, window.document.title, hash); window.history.replaceState({}, window.document.title, hash);
} }

@ -1294,7 +1294,7 @@
"imprint": "Mentions légales", "imprint": "Mentions légales",
"isContact": "{0} est dans vos contacts", "isContact": "{0} est dans vos contacts",
"isNotContact": "{0} n'est <b>pas</b> dans vos contacts", "isNotContact": "{0} n'est <b>pas</b> 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", "profile_login": "Vous devez vous connecter pour ajouter cet utilisateur à vos contacts",
"dontShowAgain": "Ne plus demander", "dontShowAgain": "Ne plus demander",
"safeLinks_error": "Le lien utilisé ne permet pas d'ouvrir ce document", "safeLinks_error": "Le lien utilisé ne permet pas d'ouvrir ce document",

@ -184,7 +184,6 @@
"okButton": "OK (enter)", "okButton": "OK (enter)",
"cancel": "Cancel", "cancel": "Cancel",
"cancelButton": "Cancel (esc)", "cancelButton": "Cancel (esc)",
"doNotAskAgain": "Don't ask me again (Esc)",
"show_help_button": "Show help", "show_help_button": "Show help",
"hide_help_button": "Hide help", "hide_help_button": "Hide help",
"help_button": "Help", "help_button": "Help",
@ -936,7 +935,7 @@
"feedback_about": "If you're reading this, you were probably curious why CryptPad is requesting web pages when you perform certain actions", "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_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 <a href='/settings/'>your user settings page</a>, where you'll find a checkbox to enable or disable user feedback", "feedback_optout": "If you would like to opt out, visit <a href='/settings/'>your user settings page</a>, 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_ownedTitle": "Type of pad",
"creation_owned": "Owned pad", "creation_owned": "Owned pad",
"creation_ownedTrue": "Owned pad", "creation_ownedTrue": "Owned pad",
@ -956,7 +955,6 @@
"creation_noTemplate": "No template", "creation_noTemplate": "No template",
"creation_newTemplate": "New template", "creation_newTemplate": "New template",
"creation_create": "Create", "creation_create": "Create",
"creation_saveSettings": "Don't show this again",
"creation_settings": "View more settings", "creation_settings": "View more settings",
"creation_rememberHelp": "Visit your Settings page to reset this preference", "creation_rememberHelp": "Visit your Settings page to reset this preference",
"creation_owners": "Owners", "creation_owners": "Owners",
@ -1028,7 +1026,6 @@
"crowdfunding_popup_text": "<h3>We need your help!</h3>To ensure that CryptPad is actively developed, consider supporting the project via the <a href=\"https://opencollective.com/cryptpad\">OpenCollective page</a>, where you can see our <b>Roadmap</b> and <b>Funding goals</b>.", "crowdfunding_popup_text": "<h3>We need your help!</h3>To ensure that CryptPad is actively developed, consider supporting the project via the <a href=\"https://opencollective.com/cryptpad\">OpenCollective page</a>, where you can see our <b>Roadmap</b> and <b>Funding goals</b>.",
"crowdfunding_popup_yes": "Go to OpenCollective", "crowdfunding_popup_yes": "Go to OpenCollective",
"crowdfunding_popup_no": "Not now", "crowdfunding_popup_no": "Not now",
"crowdfunding_popup_never": "Don't ask me again",
"survey": "CryptPad survey", "survey": "CryptPad survey",
"markdown_toc": "Contents", "markdown_toc": "Contents",
"fm_expirablePad": "Expires: {0}", "fm_expirablePad": "Expires: {0}",

@ -573,10 +573,11 @@ define([
var $cbox = $(UI.createCheckbox('cp-settings-safe-links', var $cbox = $(UI.createCheckbox('cp-settings-safe-links',
Messages.settings_safeLinksCheckbox, Messages.settings_safeLinksCheckbox,
true, { label: {class: 'noTitle'} })); false, { label: {class: 'noTitle'} }));
var spinner = UI.makeSpinner($cbox); var spinner = UI.makeSpinner($cbox);
// Checkbox: "Enable safe links"
var $checkbox = $cbox.find('input').on('change', function () { var $checkbox = $cbox.find('input').on('change', function () {
spinner.spin(); spinner.spin();
var val = !$checkbox.is(':checked'); var val = !$checkbox.is(':checked');
@ -587,7 +588,7 @@ define([
common.getAttribute(['security', 'unsafeLinks'], function (e, val) { common.getAttribute(['security', 'unsafeLinks'], function (e, val) {
if (e) { return void console.error(e); } if (e) { return void console.error(e); }
if (!val) { if (val === false) {
$checkbox.attr('checked', 'checked'); $checkbox.attr('checked', 'checked');
} }
}); });

Loading…
Cancel
Save