From 9c032931d6560239e4c389712830e2ee201c05e9 Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Tue, 9 Jul 2024 16:26:26 +0300 Subject: [PATCH 01/30] Add confirmation modal + logic --- www/admin/inner.js | 80 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/www/admin/inner.js b/www/admin/inner.js index d513ab0b1..5ae30471a 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -578,23 +578,77 @@ define([ return APP.instanceStatus.enforceMFA; }, query: function (val, setState) { - sFrameChan.query('Q_ADMIN_RPC', { - cmd: 'ADMIN_DECREE', - data: ['ENFORCE_MFA', [val]] - }, function (e, response) { - if (e || response.error) { - UI.warn(Messages.error); - console.error(e, response); + var isChecked = APP.instanceStatus.enforceMFA; + var confirmationContent = isChecked + ? 'Are you sure you want to disable enforced MFA? This action would lessen the security of your account.' + : 'Are you sure you want to enforce MFA? This action would require to set up an authenticator app.'; + + function showConfirmationModal(callback) { + var modal = UI.dialog.customModal(confirmationContent, { + buttons: [{ + className: 'cancel', + name: Messages.cancel, + onClick: function () { + if (!isChecked) { + sFrameChan.query('Q_ADMIN_RPC', { + cmd: 'ADMIN_DECREE', + data: ['ENFORCE_MFA', [false]] + }, function (e, response) { + if (e || response.error) { + UI.warn(Messages.error); + console.error(e, response); + } else { + APP.updateStatus(function () { + setState(false); + flushCache(); + }); + } + }); + } + //check the checkbox again + else { + APP.updateStatus(function () { + setState(APP.instanceStatus.enforceMFA); + flushCache(); + }); + } + }, + keys: [27] // Esc key to close modal + }, { + className: 'primary', + name: Messages.settings_save, + onClick: function () { + sFrameChan.query('Q_ADMIN_RPC', { + cmd: 'ADMIN_DECREE', + data: ['ENFORCE_MFA', [val]] + }, function (e, response) { + if (e || response.error) { + UI.warn(Messages.error); + console.error(e, response); + } else { + APP.updateStatus(function () { + setState(APP.instanceStatus.enforceMFA); + flushCache(); + }); + } + }); + }, + keys: [13] // Enter key to confirm + }] + }); + var $modal = $(modal); + UI.openCustomModal(modal); + $modal.closest('.alertify').on('mousedown', function (e) { + e.stopPropagation(); + }); } - APP.updateStatus(function () { - setState(APP.instanceStatus.enforceMFA); - flushCache(); - }); - }); - }, + + showConfirmationModal(); + } }); + var getInstanceString = function (attr) { var val = APP.instanceStatus[attr]; var type = typeof(val); From e43b16a6ee5089457dec806a14e7b867d3a7ca7c Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:24:17 +0300 Subject: [PATCH 02/30] Add responsive styling to performance table --- .../src/less2/include/sidebar-layout.less | 22 +++++++++++++++++++ www/admin/inner.js | 2 ++ 2 files changed, 24 insertions(+) diff --git a/customize.dist/src/less2/include/sidebar-layout.less b/customize.dist/src/less2/include/sidebar-layout.less index 5b616e0e8..eeb5da80a 100644 --- a/customize.dist/src/less2/include/sidebar-layout.less +++ b/customize.dist/src/less2/include/sidebar-layout.less @@ -194,6 +194,28 @@ background-color: @cp_sidebar-left-item-bg; } } + + } + .cp-sidebar-table#performance-profiling-table { + @media (max-width: 900px) { + width: 100%; + + tr { + display: flex; + flex-wrap: wrap; + align-items: center; + } + + th, td { + border: none; + flex: 1 1 auto; + width: 5rem; + margin-right: 0; + font-size: 13px; + word-wrap: break-word; + white-space: normal; + } + } } .cp-sidebar-input-block { display: inline-flex; diff --git a/www/admin/inner.js b/www/admin/inner.js index d513ab0b1..7cb627abf 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -3596,6 +3596,8 @@ define([ var table = blocks.table(header, []); + table.id = 'performance-profiling-table'; + const onRefresh = function () { sFrameChan.query('Q_ADMIN_RPC', { cmd: 'GET_WORKER_PROFILES', From 81f70c6a6722428cf4fb0f06942fa87277b39bbd Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Thu, 11 Jul 2024 13:08:50 +0300 Subject: [PATCH 03/30] Add border to table --- customize.dist/src/less2/include/sidebar-layout.less | 1 + 1 file changed, 1 insertion(+) diff --git a/customize.dist/src/less2/include/sidebar-layout.less b/customize.dist/src/less2/include/sidebar-layout.less index eeb5da80a..bb037d366 100644 --- a/customize.dist/src/less2/include/sidebar-layout.less +++ b/customize.dist/src/less2/include/sidebar-layout.less @@ -199,6 +199,7 @@ .cp-sidebar-table#performance-profiling-table { @media (max-width: 900px) { width: 100%; + border: 1px solid @cp_drive-icon-border; tr { display: flex; From f82fe763af9b3a766dd0635253be43fab9eea738 Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Thu, 11 Jul 2024 14:44:48 +0200 Subject: [PATCH 04/30] =?UTF-8?q?Send=20Pad=E2=80=99s=20plain=20password?= =?UTF-8?q?=20when=20sharing=20ownership?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The password is sent via `Mailbox` and then is still oblivious to the server - Otherwise a bogus file is created (#1522) - Also fix the file stored and fix #1521 --- www/common/outer/mailbox-handlers.js | 1 + www/common/sframe-common-outer.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/www/common/outer/mailbox-handlers.js b/www/common/outer/mailbox-handlers.js index cfa749084..a2b2ed08a 100644 --- a/www/common/outer/mailbox-handlers.js +++ b/www/common/outer/mailbox-handlers.js @@ -384,6 +384,7 @@ define([ var channel = content.channel || content.teamChannel; if (content.password) { + content.pw = content.password; var key = ctx.store.driveSecret.keys.cryptKey; content.password = Crypto.encrypt(content.password, key); } diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 6c46ced04..508937e41 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -1083,7 +1083,7 @@ define([ Cryptpad.addSharedFolder(null, secret, cb); } else { var _data = { - password: data.password, + password: data.pw || data.password, href: data.href, channel: data.channel, title: data.title, From da63f7d51ed95f5daf985ceeca7b279813e39d27 Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Thu, 11 Jul 2024 14:50:19 +0200 Subject: [PATCH 05/30] Minor: fix a typo in comment --- www/common/common-ui-elements.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 5405bf319..f56584e19 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -3615,7 +3615,7 @@ define([ // Add the pad to your drive // This command will also add your mailbox to the metadata log - // The callback is called when the pad is stored, independantly of the metadata command + // The callback is called when the pad is stored, independently of the metadata command if (data.calendar) { var calendarModule = common.makeUniversal('calendar'); var calendarData = data.calendar; From 9098823fd72598e0b96eb70e69c742d61cc4c9fb Mon Sep 17 00:00:00 2001 From: daria Date: Thu, 11 Jul 2024 16:11:51 +0300 Subject: [PATCH 06/30] change focus style on elements from Ctrl+E modal #1506 --- customize.dist/src/less2/include/drive.less | 3 +++ 1 file changed, 3 insertions(+) diff --git a/customize.dist/src/less2/include/drive.less b/customize.dist/src/less2/include/drive.less index 239f73287..424e12519 100644 --- a/customize.dist/src/less2/include/drive.less +++ b/customize.dist/src/less2/include/drive.less @@ -953,6 +953,9 @@ li, li .fa, li .cptools { cursor: pointer; border-radius: @variables_radius; + &:focus { + outline: @cryptpad_color_brand solid 2px; + } } &> p { display: flex; From f72ed440e63eea8d4ba995079d9fddc819c1aa5e Mon Sep 17 00:00:00 2001 From: daria Date: Thu, 11 Jul 2024 16:48:26 +0300 Subject: [PATCH 07/30] fix focus issues on `Ctrl+E` modal #1558 --- www/common/common-interface.js | 1 + 1 file changed, 1 insertion(+) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 2c4d57799..d153b0483 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -670,6 +670,7 @@ define([ $modal: $blockContainer, show: function () { $blockContainer.css('display', 'flex'); + addTabListener($blockContainer); }, hide: hide }; From a29aab157d90a4f0a6dfa0fa52c8c754a67fa84c Mon Sep 17 00:00:00 2001 From: daria Date: Thu, 11 Jul 2024 17:22:35 +0300 Subject: [PATCH 08/30] fix focus issues on modals that use UI.alert #1561 --- www/common/common-interface.js | 1 + 1 file changed, 1 insertion(+) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 2c4d57799..9ed80b7e8 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -719,6 +719,7 @@ define([ Notifier.notify(); }); + addTabListener(frame); return { element: frame, delete: close From 09067da34117fc6048072bf76bd0f40dbb1cf29d Mon Sep 17 00:00:00 2001 From: daria Date: Fri, 12 Jul 2024 12:45:41 +0300 Subject: [PATCH 09/30] change focus style on Ctrl+E modals #1561 --- customize.dist/src/less2/include/icons.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/customize.dist/src/less2/include/icons.less b/customize.dist/src/less2/include/icons.less index e3a273a92..bf3e3afc3 100644 --- a/customize.dist/src/less2/include/icons.less +++ b/customize.dist/src/less2/include/icons.less @@ -33,8 +33,8 @@ color: @cp_drive-fg; } &.cp-icons-element-selected { - background: @cp_drive-icon-hover; color: @cp_drive-fg; + outline: @cryptpad_color_brand solid 2px; } .fa, .cptools { display: block; From 1ac0cd3e1d15ed511d98f274012fb8ffd51a29ed Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Fri, 12 Jul 2024 17:59:50 +0200 Subject: [PATCH 10/30] Use the correct password when sharing a pad to a contact - Fix #1270; - Force reload option added. --- www/common/cryptpad-common.js | 3 ++- www/common/notifications.js | 1 + www/common/outer/mailbox-handlers.js | 7 +++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 4525c8287..e2d6a3746 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -2619,7 +2619,8 @@ define([ disableCache: localStorage['CRYPTPAD_STORE|disableCache'], driveEvents: !rdyCfg.noDrive, //rdyCfg.driveEvents // Boolean lastVisit: Number(localStorage.lastVisit) || undefined, - blockId: blockId + blockId: blockId, + blockHash: blockHash }; common.userHash = userHash || LocalStore.getUserHash(); diff --git a/www/common/notifications.js b/www/common/notifications.js index 82fb4b45d..8ec80c2e9 100644 --- a/www/common/notifications.js +++ b/www/common/notifications.js @@ -129,6 +129,7 @@ define([ var obj = { p: msg.content.isTemplate ? ['template'] : undefined, t: teamNotification || undefined, + f: 1, pw: msg.content.password || '' }; common.openURL(Hash.getNewPadURL(msg.content.href, obj)); diff --git a/www/common/outer/mailbox-handlers.js b/www/common/outer/mailbox-handlers.js index a2b2ed08a..06de11374 100644 --- a/www/common/outer/mailbox-handlers.js +++ b/www/common/outer/mailbox-handlers.js @@ -8,7 +8,8 @@ define([ '/common/common-hash.js', '/common/common-util.js', '/components/chainpad-crypto/crypto.js', -], function (ApiConfig, Messaging, Hash, Util, Crypto) { + '/common/outer/login-block.js', + ], function (ApiConfig, Messaging, Hash, Util, Crypto, Block) { // Random timeout between 10 and 30 times your sync time (lag + chainpad sync) var getRandomTimeout = function (ctx) { @@ -265,7 +266,9 @@ define([ } if (content.password) { - var key = ctx.store.driveSecret.keys.cryptKey; + var uHash = ctx.store.data.blockHash; + var uSecret = Block.parseBlockHash(uHash); + var key = uSecret.keys.symmetric; content.password = Crypto.encrypt(content.password, key); } From e4da9285d0d840eec2304b1b8cc76541d184cc37 Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Tue, 16 Jul 2024 11:40:44 +0300 Subject: [PATCH 11/30] Implement review fixes - change modal constructor and add translation keys --- customize.dist/messages.js | 3 +- www/admin/inner.js | 89 +++++++++++--------------------------- 2 files changed, 27 insertions(+), 65 deletions(-) diff --git a/customize.dist/messages.js b/customize.dist/messages.js index 2459a246f..0e748c98e 100755 --- a/customize.dist/messages.js +++ b/customize.dist/messages.js @@ -133,7 +133,8 @@ define(req, function(AppConfig, Default, Language) { return text; } }; - + Messages.admin_mfa_confirm_enable = "Are you sure you want to enable Multi-Factor Authentication?"; // XXX + Messages.admin_mfa_confirm_disable = "Are you sure you want to disable Multi-Factor Authentication?"; // XXX return Messages; }); diff --git a/www/admin/inner.js b/www/admin/inner.js index 5ae30471a..0d66c52c1 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -579,71 +579,32 @@ define([ }, query: function (val, setState) { var isChecked = APP.instanceStatus.enforceMFA; - var confirmationContent = isChecked - ? 'Are you sure you want to disable enforced MFA? This action would lessen the security of your account.' - : 'Are you sure you want to enforce MFA? This action would require to set up an authenticator app.'; - - function showConfirmationModal(callback) { - var modal = UI.dialog.customModal(confirmationContent, { - buttons: [{ - className: 'cancel', - name: Messages.cancel, - onClick: function () { - if (!isChecked) { - sFrameChan.query('Q_ADMIN_RPC', { - cmd: 'ADMIN_DECREE', - data: ['ENFORCE_MFA', [false]] - }, function (e, response) { - if (e || response.error) { - UI.warn(Messages.error); - console.error(e, response); - } else { - APP.updateStatus(function () { - setState(false); - flushCache(); - }); - } - }); - } - //check the checkbox again - else { - APP.updateStatus(function () { - setState(APP.instanceStatus.enforceMFA); - flushCache(); - }); - } - }, - keys: [27] // Esc key to close modal - }, { - className: 'primary', - name: Messages.settings_save, - onClick: function () { - sFrameChan.query('Q_ADMIN_RPC', { - cmd: 'ADMIN_DECREE', - data: ['ENFORCE_MFA', [val]] - }, function (e, response) { - if (e || response.error) { - UI.warn(Messages.error); - console.error(e, response); - } else { - APP.updateStatus(function () { - setState(APP.instanceStatus.enforceMFA); - flushCache(); - }); - } - }); - }, - keys: [13] // Enter key to confirm - }] + function showConfirmation(isChecked, setState) { + const confirmationContent = isChecked ? Messages.admin_mfa_confirm_disable : Messages.admin_mfa_confirm_enable; + UI.confirm(confirmationContent, function (confirmed) { + if (!confirmed) { + // User canceled their changes, restore the checkbox value + setState(isChecked); + return; + } + // User confirmed their changes, call the command and update the state + sFrameChan.query('Q_ADMIN_RPC', { + cmd: 'ADMIN_DECREE', + data: ['ENFORCE_MFA', [val]] + }, function (e, response) { + if (e || response.error) { + UI.warn(Messages.error); + console.error(e, response); + } else { + APP.updateStatus(function () { + setState(APP.instanceStatus.enforceMFA); + flushCache(); + }); + } }); - var $modal = $(modal); - UI.openCustomModal(modal); - $modal.closest('.alertify').on('mousedown', function (e) { - e.stopPropagation(); - }); - } - - showConfirmationModal(); + }); + } + showConfirmation(isChecked, setState); } }); From fe17b416792a753c2040d29a0b0c78160b943341 Mon Sep 17 00:00:00 2001 From: daria Date: Tue, 16 Jul 2024 15:35:51 +0300 Subject: [PATCH 12/30] fix focus issues on modals that use UI.prompt #1561 --- www/common/common-interface.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 9ed80b7e8..42e965685 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -164,12 +164,12 @@ define([ dialog.okButton = function (content, classString) { var sel = typeof(classString) === 'string'? 'button.ok.' + classString:'button.btn.ok.primary'; - return h(sel, { tabindex: '2', }, content || Messages.okButton); + return h(sel, content || Messages.okButton); }; dialog.cancelButton = function (content, classString) { var sel = typeof(classString) === 'string'? 'button.' + classString:'button.btn.cancel'; - return h(sel, { tabindex: '1'}, content || Messages.cancelButton); + return h(sel, content || Messages.cancelButton); }; dialog.message = function (text) { @@ -771,7 +771,7 @@ define([ document.body.appendChild(frame); setTimeout(function () { - $(input).select().focus(); + addTabListener(frame); Notifier.notify(); }); }; From 482e3274542e5280339f8ab23561e120e0fadb3e Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Wed, 17 Jul 2024 12:34:41 +0300 Subject: [PATCH 13/30] Adjust general table styling to flex and make the performance one responsive #1099 --- .eslintrc.js | 2 +- .../src/less2/include/sidebar-layout.less | 32 ++++++------------- www/admin/app-admin.less | 12 +++++++ 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 209a4718e..924eddfc3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -35,7 +35,7 @@ module.exports = { 4 ], 'linebreak-style': [ - 'error', + 'off', // git handles linebreak conversion for us 'unix' ], 'quotes': [ diff --git a/customize.dist/src/less2/include/sidebar-layout.less b/customize.dist/src/less2/include/sidebar-layout.less index bb037d366..bafc9a77e 100644 --- a/customize.dist/src/less2/include/sidebar-layout.less +++ b/customize.dist/src/less2/include/sidebar-layout.less @@ -174,6 +174,9 @@ } .cp-sidebar-table { margin-top: @sidebar_base-margin; + tr { + display: flex; + } pre { margin: 0; } @@ -189,34 +192,17 @@ margin-right: @sidebar_base-margin; } } + th, td { + flex: 1; + word-wrap: break-word; + white-space: normal; + min-width: 13rem; + } tbody { tr:nth-child(odd) { background-color: @cp_sidebar-left-item-bg; } } - - } - .cp-sidebar-table#performance-profiling-table { - @media (max-width: 900px) { - width: 100%; - border: 1px solid @cp_drive-icon-border; - - tr { - display: flex; - flex-wrap: wrap; - align-items: center; - } - - th, td { - border: none; - flex: 1 1 auto; - width: 5rem; - margin-right: 0; - font-size: 13px; - word-wrap: break-word; - white-space: normal; - } - } } .cp-sidebar-input-block { display: inline-flex; diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index fbaaf4b5e..6d9edc132 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -28,6 +28,18 @@ max-height: 250px; } } + #cp-sidebarlayout-container #cp-sidebarlayout-rightside .cp-sidebarlayout-element[data-item] .cp-sidebar-table#performance-profiling-table { + @media (max-width: @browser_media-not-small) { + width: 100%; + tr { + width: 100%; + } + th, td { + margin-right: 0; + min-width: 1rem; + } + } + } .cp-admin-color-current { width: 20px; height: 20px; From 1f3b664bfe6bd0f74da9fc18a9553966935f4ac3 Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:26:10 +0300 Subject: [PATCH 14/30] Refactor code #1099 --- customize.dist/src/less2/include/sidebar-layout.less | 9 --------- www/admin/app-admin.less | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/customize.dist/src/less2/include/sidebar-layout.less b/customize.dist/src/less2/include/sidebar-layout.less index bafc9a77e..5b616e0e8 100644 --- a/customize.dist/src/less2/include/sidebar-layout.less +++ b/customize.dist/src/less2/include/sidebar-layout.less @@ -174,9 +174,6 @@ } .cp-sidebar-table { margin-top: @sidebar_base-margin; - tr { - display: flex; - } pre { margin: 0; } @@ -192,12 +189,6 @@ margin-right: @sidebar_base-margin; } } - th, td { - flex: 1; - word-wrap: break-word; - white-space: normal; - min-width: 13rem; - } tbody { tr:nth-child(odd) { background-color: @cp_sidebar-left-item-bg; diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index 6d9edc132..74c71f0cf 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -29,6 +29,15 @@ } } #cp-sidebarlayout-container #cp-sidebarlayout-rightside .cp-sidebarlayout-element[data-item] .cp-sidebar-table#performance-profiling-table { + tr { + display: flex; + } + th, td { + flex: 1; + word-wrap: break-word; + white-space: normal; + min-width: 13rem; + } @media (max-width: @browser_media-not-small) { width: 100%; tr { From c9d5f2c236ae500b413962b0e49bac75f78fb8e1 Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Wed, 17 Jul 2024 17:30:28 +0300 Subject: [PATCH 15/30] Add horizontal scrollbar to table #1099 --- www/admin/app-admin.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index 74c71f0cf..ff86dd6c6 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -29,6 +29,10 @@ } } #cp-sidebarlayout-container #cp-sidebarlayout-rightside .cp-sidebarlayout-element[data-item] .cp-sidebar-table#performance-profiling-table { + display: flex; + flex-wrap: wrap; + flex-direction: column; + overflow-x: auto; tr { display: flex; } From a1b617f0ca2e0abf09161cde40e3ae3354c8bacc Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:18:56 +0300 Subject: [PATCH 16/30] Wrap table inside a div #1099 --- www/admin/app-admin.less | 8 ++++---- www/admin/inner.js | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index ff86dd6c6..333173927 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -28,11 +28,9 @@ max-height: 250px; } } - #cp-sidebarlayout-container #cp-sidebarlayout-rightside .cp-sidebarlayout-element[data-item] .cp-sidebar-table#performance-profiling-table { - display: flex; - flex-wrap: wrap; - flex-direction: column; + #cp-sidebarlayout-container #cp-sidebarlayout-rightside .cp-sidebarlayout-element[data-item] div { overflow-x: auto; + .cp-sidebar-table#performance-profiling-table { tr { display: flex; } @@ -41,6 +39,7 @@ word-wrap: break-word; white-space: normal; min-width: 13rem; + margin-right: 0px; } @media (max-width: @browser_media-not-small) { width: 100%; @@ -53,6 +52,7 @@ } } } +} .cp-admin-color-current { width: 20px; height: 20px; diff --git a/www/admin/inner.js b/www/admin/inner.js index 7cb627abf..a0be7e2ea 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -3598,6 +3598,10 @@ define([ table.id = 'performance-profiling-table'; + var div = document.createElement('div'); + div.id = 'performance-table-container'; + div.appendChild(table); + const onRefresh = function () { sFrameChan.query('Q_ADMIN_RPC', { cmd: 'GET_WORKER_PROFILES', @@ -3629,7 +3633,7 @@ define([ onRefresh(); onRefreshPerformance.reg(onRefresh); - cb(table); + cb(div); }); From ffebbc6e807bfca12a7e4492a7900d204e1f2df4 Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:20:20 +0300 Subject: [PATCH 17/30] More specific div selector #1099 --- www/admin/app-admin.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index 333173927..3845b858e 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -28,7 +28,7 @@ max-height: 250px; } } - #cp-sidebarlayout-container #cp-sidebarlayout-rightside .cp-sidebarlayout-element[data-item] div { + #cp-sidebarlayout-container #cp-sidebarlayout-rightside .cp-sidebarlayout-element[data-item] div#performance-table-container { overflow-x: auto; .cp-sidebar-table#performance-profiling-table { tr { From e1b2be39c0f48f4f9e0234880295ee27ac19758a Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Fri, 19 Jul 2024 11:50:37 +0200 Subject: [PATCH 18/30] Fix: old password sent upon updating a password for the first time - Finish to fix #1521 --- www/common/sframe-common-outer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 508937e41..b4031d155 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -1359,7 +1359,7 @@ define([ var viewH = Utils.Hash.getViewHashFromKeys(_secret); var href = Utils.Hash.hashToHref(editH, parsed.type); var roHref = Utils.Hash.hashToHref(viewH, parsed.type); - Cryptpad.setPadAttribute('password', password, w(), parsed.getUrl()); + Cryptpad.setPadAttribute('password', pw, w(), parsed.getUrl()); Cryptpad.setPadAttribute('channel', chan, w(), parsed.getUrl()); Cryptpad.setPadAttribute('href', href, w(), parsed.getUrl()); Cryptpad.setPadAttribute('roHref', roHref, w(), parsed.getUrl()); From 727c9d7b8828bf81c1771fe61f16069d83cae046 Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Fri, 19 Jul 2024 11:54:10 +0200 Subject: [PATCH 19/30] Fix the 'Preview document' link when sharing ownership - The password should not be asked in this context - Remove deprecated use of the drive secret - Related to #1270 and #1521 --- www/common/common-ui-elements.js | 2 +- www/common/outer/mailbox-handlers.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index f56584e19..10db8c37c 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -3559,7 +3559,7 @@ define([ $(link).click(function (e) { e.preventDefault(); e.stopPropagation(); - var obj = { pw: msg.content.password || '' }; + var obj = { pw: msg.content.password || '', f: 1 }; common.openURL(Hash.getNewPadURL(msg.content.href, obj)); }); diff --git a/www/common/outer/mailbox-handlers.js b/www/common/outer/mailbox-handlers.js index 06de11374..6ecac6a54 100644 --- a/www/common/outer/mailbox-handlers.js +++ b/www/common/outer/mailbox-handlers.js @@ -387,8 +387,10 @@ define([ var channel = content.channel || content.teamChannel; if (content.password) { + var uHash = ctx.store.data.blockHash; + var uSecret = Block.parseBlockHash(uHash); + var key = uSecret.keys.symmetric; content.pw = content.password; - var key = ctx.store.driveSecret.keys.cryptKey; content.password = Crypto.encrypt(content.password, key); } From 750635db4eeaf0ed662ede3f33ab49563136fe90 Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Fri, 19 Jul 2024 11:57:40 +0200 Subject: [PATCH 20/30] minor: use of let instead of var - To avoid some secrets to live outside their intended scope. --- www/common/outer/mailbox-handlers.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/www/common/outer/mailbox-handlers.js b/www/common/outer/mailbox-handlers.js index 6ecac6a54..0b98bbe9f 100644 --- a/www/common/outer/mailbox-handlers.js +++ b/www/common/outer/mailbox-handlers.js @@ -266,9 +266,9 @@ define([ } if (content.password) { - var uHash = ctx.store.data.blockHash; - var uSecret = Block.parseBlockHash(uHash); - var key = uSecret.keys.symmetric; + let uHash = ctx.store.data.blockHash; + let uSecret = Block.parseBlockHash(uHash); + let key = uSecret.keys.symmetric; content.password = Crypto.encrypt(content.password, key); } @@ -387,9 +387,9 @@ define([ var channel = content.channel || content.teamChannel; if (content.password) { - var uHash = ctx.store.data.blockHash; - var uSecret = Block.parseBlockHash(uHash); - var key = uSecret.keys.symmetric; + let uHash = ctx.store.data.blockHash; + let uSecret = Block.parseBlockHash(uHash); + let key = uSecret.keys.symmetric; content.pw = content.password; content.password = Crypto.encrypt(content.password, key); } From 8ceccb678c42e5d2d2fa5ca5a60e3bb8617e15b9 Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Fri, 19 Jul 2024 12:10:05 +0200 Subject: [PATCH 21/30] Cleaning code: use a function to encrypt the password - Use a function to encrypt the password for later use in URLs as it is used both to share a password-protected pad and share ownership of a password-protected pad; - related do #1270 and #1522. --- www/common/outer/mailbox-handlers.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/www/common/outer/mailbox-handlers.js b/www/common/outer/mailbox-handlers.js index 0b98bbe9f..906be2843 100644 --- a/www/common/outer/mailbox-handlers.js +++ b/www/common/outer/mailbox-handlers.js @@ -238,6 +238,14 @@ define([ cb(true); }; + // Encrypt the password under the right key before sending it via URL hash + var encryptPassword = function(ctx, password) { + let uHash = ctx.store.data.blockHash; + let uSecret = Block.parseBlockHash(uHash); + let key = uSecret.keys.symmetric; + return Crypto.encrypt(password, key); + }; + // Hide duplicates when receiving a SHARE_PAD notification: // Keep only one notification per channel: the stronger and more recent one var channels = {}; @@ -266,10 +274,7 @@ define([ } if (content.password) { - let uHash = ctx.store.data.blockHash; - let uSecret = Block.parseBlockHash(uHash); - let key = uSecret.keys.symmetric; - content.password = Crypto.encrypt(content.password, key); + content.password = encryptPassword(ctx, content.password); } // Update the data @@ -387,11 +392,8 @@ define([ var channel = content.channel || content.teamChannel; if (content.password) { - let uHash = ctx.store.data.blockHash; - let uSecret = Block.parseBlockHash(uHash); - let key = uSecret.keys.symmetric; content.pw = content.password; - content.password = Crypto.encrypt(content.password, key); + content.password = encryptPassword(ctx, content.password); } if (addOwners[channel]) { return void cb(true); } From 2a3998a4732fffb534535d01753c22681ea5bc67 Mon Sep 17 00:00:00 2001 From: daria Date: Mon, 22 Jul 2024 14:06:14 +0300 Subject: [PATCH 22/30] fix focus issues on calendar modals #1561 --- www/calendar/inner.js | 2 ++ www/common/common-interface.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/www/calendar/inner.js b/www/calendar/inner.js index 9cac57978..b971b2247 100644 --- a/www/calendar/inner.js +++ b/www/calendar/inner.js @@ -2209,6 +2209,7 @@ APP.recurrenceRule = { setFormat(allDay); }); }); + UI.addTabListener(el); }; var onCalendarEditPopup = function (el) { var $el = $(el); @@ -2276,6 +2277,7 @@ APP.recurrenceRule = { $b.closest('.tui-full-calendar-floating-layer').hide(); }); }); + UI.addTabListener(el); }; var onPopupRemoved = function () { var start, end; diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 42e965685..98fd748db 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -577,7 +577,7 @@ define([ return frame; }; - let addTabListener = frame => { + let addTabListener = UI.addTabListener = frame => { // find focusable elements let modalElements = $(frame).find('a, button, input, [tabindex]:not([tabindex="-1"]), textarea').filter(':visible').filter(':not(:disabled)'); From 86e029d4333f85257065da2cd69d583c8ff2c6e3 Mon Sep 17 00:00:00 2001 From: daria Date: Mon, 22 Jul 2024 15:42:44 +0300 Subject: [PATCH 23/30] add focus to certain calendar modal elements + make changes to focus styling --- www/calendar/app-calendar.less | 13 +++++++++++++ www/calendar/inner.js | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/www/calendar/app-calendar.less b/www/calendar/app-calendar.less index bdf59fb6d..91974d210 100644 --- a/www/calendar/app-calendar.less +++ b/www/calendar/app-calendar.less @@ -157,6 +157,11 @@ border-radius: @variables_radius_L; } .tui-full-calendar-popup-container { + .tui-full-calendar-section-allday{ + &:focus { + outline: @cryptpad_color_brand solid 2px; + } + } min-width: 100%; background: @cp_flatpickr-bg; color: @cryptpad_text_col; @@ -208,6 +213,9 @@ text-overflow: ellipsis; font: @colortheme_app-font; padding: 0 10px; + &:focus{ + outline: @cryptpad_color_brand solid 2px; + } } input { flex: 1; } } @@ -403,6 +411,11 @@ & > input { height: 40px; } + .tui-full-calendar-content{ + &:focus{ + outline: @cryptpad_color_brand solid 2px; + } + } } // margin-bottom: 20px; input { diff --git a/www/calendar/inner.js b/www/calendar/inner.js index b971b2247..f3dac10a4 100644 --- a/www/calendar/inner.js +++ b/www/calendar/inner.js @@ -2147,6 +2147,13 @@ APP.recurrenceRule = { $el.find('input').attr('autocomplete', 'off'); $el.find('.tui-full-calendar-dropdown-button').addClass('btn btn-secondary'); $el.find('.tui-full-calendar-popup-close').addClass('btn btn-cancel fa fa-times cp-calendar-close').empty(); + $el.find('.tui-full-calendar-section-allday').attr('tabindex', 0); + $el.find('.cp-calendar-close').attr('tabindex',-1); + $el.find('.tui-full-calendar-section-allday').keydown(function (e) { + if (e.which === 13) { + $(this).click(); + } + }); var $container = $el.closest('.tui-full-calendar-floating-layer'); $container.addClass('cp-calendar-popup-flex'); From 7d14f80fdb93304337623c674419fe5e6c8c1092 Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Tue, 23 Jul 2024 15:14:12 +0300 Subject: [PATCH 24/30] Make admin tables responsive #1099 --- www/admin/app-admin.less | 50 ++++++++++++++++++++++------------------ www/admin/inner.js | 24 +++++++++++-------- 2 files changed, 43 insertions(+), 31 deletions(-) diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index 3845b858e..8bc3c3d85 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -28,30 +28,36 @@ max-height: 250px; } } - #cp-sidebarlayout-container #cp-sidebarlayout-rightside .cp-sidebarlayout-element[data-item] div#performance-table-container { - overflow-x: auto; - .cp-sidebar-table#performance-profiling-table { - tr { - display: flex; - } - th, td { - flex: 1; - word-wrap: break-word; - white-space: normal; - min-width: 13rem; - margin-right: 0px; - } - @media (max-width: @browser_media-not-small) { - width: 100%; - tr { - width: 100%; - } - th, td { - margin-right: 0; - min-width: 1rem; + #cp-sidebarlayout-container { + #cp-sidebarlayout-rightside { + .cp-sidebarlayout-element[data-item] { + div#cp-admin-table-container { + overflow-x: auto; + .cp-sidebar-table#cp-admin-table { + tr { + display: flex; + } + th, td { + flex: 1; + word-wrap: break-word; + white-space: normal; + min-width: 13rem; + margin-right: 0px; + } + @media (max-width: @browser_media-not-small) { + width: 100%; + tr { + width: 100%; + } + th, td { + margin-right: 0; + min-width: 7rem; + } + } + } + } } } - } } .cp-admin-color-current { width: 20px; diff --git a/www/admin/inner.js b/www/admin/inner.js index a0be7e2ea..e606337fa 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -1101,6 +1101,9 @@ define([ "" ]; var list = blocks.table(header, []); + list.setAttribute('id', 'cp-admin-table'); + let div = blocks.block([list]); + div.setAttribute('id', 'cp-admin-table-container'); var nav = blocks.nav([button, refreshButton]); var form = blocks.form([ @@ -1201,7 +1204,7 @@ define([ }); }); - cb([form, list]); + cb([form, div]); }); var getBlockId = (val) => { @@ -1413,6 +1416,9 @@ define([ "" ]; var list = blocks.table(header, []); + list.setAttribute('id', 'cp-admin-table'); + let div = blocks.block([list]); + div.setAttribute('id', 'cp-admin-table-container'); var nav = blocks.nav([button, refreshButton]); @@ -1581,7 +1587,7 @@ define([ }); }); - cb([form, list]); + cb([form, div]); }); // Msg.admin_defaultlimitHint, .admin_defaultlimitTitle @@ -1741,6 +1747,9 @@ define([ Messages.admin_note ]; var table = blocks.table(header, []); + table.setAttribute('id', 'cp-admin-table'); + let div = blocks.block([table]); + div.setAttribute('id', 'cp-admin-table-container'); let $table = $(table).hide(); APP.refreshLimits = function () { @@ -1798,7 +1807,7 @@ define([ }); }; APP.refreshLimits(); - cb(table); + cb(div); }); // Msg.admin_accountMetadataHint.admin_accountMetadataTitle @@ -3595,12 +3604,9 @@ define([ ]; var table = blocks.table(header, []); - - table.id = 'performance-profiling-table'; - - var div = document.createElement('div'); - div.id = 'performance-table-container'; - div.appendChild(table); + table.setAttribute('id', 'cp-admin-table'); + let div = blocks.block([table]); + div.setAttribute('id', 'cp-admin-table-container'); const onRefresh = function () { sFrameChan.query('Q_ADMIN_RPC', { From 6ed9ea3fa331d9ab4107d7271adb7029cbca30c9 Mon Sep 17 00:00:00 2001 From: daria Date: Wed, 24 Jul 2024 12:37:49 +0300 Subject: [PATCH 25/30] fix focus bug on one-time events modal --- www/calendar/inner.js | 1 + 1 file changed, 1 insertion(+) diff --git a/www/calendar/inner.js b/www/calendar/inner.js index f3dac10a4..982c22662 100644 --- a/www/calendar/inner.js +++ b/www/calendar/inner.js @@ -2252,6 +2252,7 @@ APP.recurrenceRule = { var data = ev.schedule || {}; var id = data.id; + UI.addTabListener(el); if (!id) { return; } if (id.indexOf('|') === -1) { return; } // Original event ID doesn't contain | From 2800e7f4302984bb9e45c5125141e1b1bf8ee080 Mon Sep 17 00:00:00 2001 From: daria Date: Wed, 24 Jul 2024 14:47:09 +0300 Subject: [PATCH 26/30] remove unnecessary line --- www/calendar/inner.js | 1 - 1 file changed, 1 deletion(-) diff --git a/www/calendar/inner.js b/www/calendar/inner.js index 982c22662..5dc05b2b8 100644 --- a/www/calendar/inner.js +++ b/www/calendar/inner.js @@ -2285,7 +2285,6 @@ APP.recurrenceRule = { $b.closest('.tui-full-calendar-floating-layer').hide(); }); }); - UI.addTabListener(el); }; var onPopupRemoved = function () { var start, end; From b819a5d8278fd283228cc5b684e2ee490328f68e Mon Sep 17 00:00:00 2001 From: daria Date: Thu, 25 Jul 2024 13:34:43 +0300 Subject: [PATCH 27/30] add option to exit description editor on the calendar modal --- www/calendar/inner.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/www/calendar/inner.js b/www/calendar/inner.js index 5dc05b2b8..267b69958 100644 --- a/www/calendar/inner.js +++ b/www/calendar/inner.js @@ -2063,6 +2063,15 @@ APP.recurrenceRule = { editor.setOption('readOnly', false); editor.setOption('autoRefresh', true); editor.setOption('gutters', []); + editor.on('keydown', function (editor, e) { + if (e.which === 27) { + let $next = $(e.target).closest('.tui-full-calendar-popup-section').next(); + if ($next.length) { + $next.find('#tui-full-calendar-schedule-start-date').focus(); + } + e.stopPropagation(); + } + }); cm.configureTheme(common, function () {}); editor.setValue(oldEventBody); From 61447629af5622f9b9582552d0115aefb24e577e Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Tue, 30 Jul 2024 13:32:53 +0300 Subject: [PATCH 28/30] Remove eslint change #1099 --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 924eddfc3..b1d079e73 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -35,7 +35,7 @@ module.exports = { 4 ], 'linebreak-style': [ - 'off', // git handles linebreak conversion for us + 'error', // git handles linebreak conversion for us 'unix' ], 'quotes': [ From 57b0fe8fa13f5c764871d120d8fe50ef112f5535 Mon Sep 17 00:00:00 2001 From: daria Date: Mon, 5 Aug 2024 11:53:59 +0300 Subject: [PATCH 29/30] code elements as list components #1193 --- www/teams/inner.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/www/teams/inner.js b/www/teams/inner.js index 9f35da7d8..b0a9a412c 100644 --- a/www/teams/inner.js +++ b/www/teams/inner.js @@ -477,7 +477,7 @@ define([ created++; } if (team.empty) { - var createTeamDiv = h('div.cp-team-list-team.empty'+createCls,{ + var createTeamDiv = h('li.cp-team-list-team.empty'+createCls,{ tabindex: '0' }, [ h('span.cp-team-list-name.empty', Messages.team_listSlot), @@ -494,7 +494,7 @@ define([ return; } var avatar = h('span.cp-avatar'); - var teamDiv = h('div.cp-team-list-team',{ + var teamDiv = h('li.cp-team-list-team',{ tabindex: '0' }, [ h('span.cp-team-list-avatar', avatar), @@ -514,7 +514,7 @@ define([ } }); }); - content.push(h('div.cp-team-list-container', list)); + content.push(h('ul.cp-team-list-container', list)); cb(content); }); return content; From f3e2ddace514faed5caedfa8791773d25d9db01b Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Fri, 9 Aug 2024 17:59:02 +0300 Subject: [PATCH 30/30] Fix overflowing check and radio items #1574 --- www/form/app-form.less | 1 - 1 file changed, 1 deletion(-) diff --git a/www/form/app-form.less b/www/form/app-form.less index c9e77e64b..00fdfafb2 100644 --- a/www/form/app-form.less +++ b/www/form/app-form.less @@ -1011,7 +1011,6 @@ min-width: 300px; width: 300px; position: absolute; - left: 20px; word-break: break-word; background: @cp_form-bg1; z-index: 2;