From 325fe1f3eec41c49b50f7301d575f43035c39fb8 Mon Sep 17 00:00:00 2001 From: AKORA <65976562+A-K-O-R-A@users.noreply.github.com> Date: Sun, 6 Oct 2024 18:59:41 +0200 Subject: [PATCH 01/16] Allow site preferences table to grow bigger on big screens --- keepassxc-browser/options/options.css | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/keepassxc-browser/options/options.css b/keepassxc-browser/options/options.css index da74ffe..585154a 100644 --- a/keepassxc-browser/options/options.css +++ b/keepassxc-browser/options/options.css @@ -2,7 +2,6 @@ body { background-color: var(--kpxc-background-color); color: var(--kpxc-text-color); font-size: 14px; - max-width: 1440px; } a { @@ -123,7 +122,7 @@ table tbody tr.empty:not(:nth-last-child(2)) { #tab-site-preferences td:nth-of-type(2), #tab-site-preferences td:nth-of-type(2) select { - width: 200px; + min-width: 200px; } #tab-site-preferences td:nth-of-type(3), @@ -227,8 +226,19 @@ table td:last-of-type { .sidebar { width: 240px; } + + main { + margin-left: 240px !important; + min-width: calc(0.8333333333 * 1440px) !important; + max-width: calc(100% - 240px) !important; + width: unset !important; + } footer { display: block; } + + .form-text, .form-group { + max-width: calc(0.8333333333 * 1440px); + } } From 9a07a9d7c5accc36406366958f90d49fc065bcb3 Mon Sep 17 00:00:00 2001 From: AKORA <65976562+A-K-O-R-A@users.noreply.github.com> Date: Sun, 6 Oct 2024 19:43:04 +0200 Subject: [PATCH 02/16] Add setting options to enable auto submit fill and totp --- keepassxc-browser/options/options.html | 6 ++++++ keepassxc-browser/options/options.js | 21 ++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index c9eed12..5eb2cb3 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -741,6 +741,9 @@ + + + @@ -761,6 +764,9 @@ + + + +
+ + + + +
+ + +
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+
+ +
+
+ + +
+
+
+ +
+
+ + +
+
+
+ + +
diff --git a/keepassxc-browser/options/options.js b/keepassxc-browser/options/options.js index dc4794d..a012deb 100644 --- a/keepassxc-browser/options/options.js +++ b/keepassxc-browser/options/options.js @@ -575,22 +575,24 @@ options.initSitePreferences = function() { const row = rowClone.cloneNode(true); row.setAttribute('url', url); row.setAttribute('id', 'tr-scf' + newIndex); - row.children[0].textContent = url; - row.children[1].children[0].value = ignore; - row.children[1].children[0].addEventListener('change', selectionChanged); - row.children[2].children['usernameOnly'].checked = usernameOnly; - row.children[2].children['usernameOnly'].addEventListener('change', checkboxClicked); - row.children[3].children['improvedFieldDetection'].checked = improvedFieldDetection; - row.children[3].children['improvedFieldDetection'].addEventListener('change', checkboxClicked); - row.children[4].children['allowIframes'].checked = allowIframes; - row.children[4].children['allowIframes'].addEventListener('change', checkboxClicked); - row.children[5].children['autoSubmit'].checked = autoSubmit; - row.children[5].children['autoSubmit'].addEventListener('change', checkboxClicked); - row.children[6].children['autoFillCredentials'].checked = autoFillCredentials; - row.children[6].children['autoFillCredentials'].addEventListener('change', checkboxClicked); - row.children[7].children['autoFillTOTP'].checked = autoFillTOTP; - row.children[7].children['autoFillTOTP'].addEventListener('change', checkboxClicked); - row.children[8].addEventListener('click', removeButtonClicked); + + const details = row.children[0].children[0]; + details.children[0].children[0].textContent = url; + details.children[2].children[0].value = ignore; + details.children[2].children[0].addEventListener('change', selectionChanged); + details.querySelector('#usernameOnly').checked = usernameOnly; + details.querySelector('#usernameOnly').addEventListener('change', checkboxClicked); + details.querySelector('#improvedFieldDetection').checked = improvedFieldDetection; + details.querySelector('#improvedFieldDetection').addEventListener('change', checkboxClicked); + details.querySelector('#allowIframes').checked = allowIframes; + details.querySelector('#allowIframes').addEventListener('change', checkboxClicked); + details.querySelector('#autoSubmit').checked = autoSubmit; + details.querySelector('#autoSubmit').addEventListener('change', checkboxClicked); + details.querySelector('#autoFillCredentials').checked = autoFillCredentials; + details.querySelector('#autoFillCredentials').addEventListener('change', checkboxClicked); + details.querySelector('#autoFillTOTP').checked = autoFillTOTP; + details.querySelector('#autoFillTOTP').addEventListener('change', checkboxClicked); + details.children[8].addEventListener('click', removeButtonClicked); $('#tab-site-preferences table tbody').append(row); }; From dcf1a1c71fd97d8a26e81552933a9cea59fd61d0 Mon Sep 17 00:00:00 2001 From: AKORA <65976562+A-K-O-R-A@users.noreply.github.com> Date: Mon, 7 Oct 2024 15:19:20 +0200 Subject: [PATCH 07/16] Switch to list instead of table --- keepassxc-browser/options/options.html | 133 ++++++++++++------------- keepassxc-browser/options/options.js | 38 ++++--- 2 files changed, 86 insertions(+), 85 deletions(-) diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index 6da319a..454ef89 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -731,89 +731,84 @@ -
- +
+
- - - - - - - - - - - - - -
-
- - - -
- - +
  • + +
  • + +
  • +
    + + + + +
    +
    + + +
    + +
    +
    + +
    +
    -
    -
    - - -
    +
    +
    + +
    +
    -
    -
    - - -
    +
    +
    + +
    +
    -
    -
    - - -
    +
    +
    + + +
    +
    -
    -
    - - -
    -
    +
    +
    + + +
    +
    -
    -
    - - -
    -
    +
    +
    + + +
    +
    -
    -
    - - -
    -
    -
    - - -
    -
  • + +
    + + + - - diff --git a/keepassxc-browser/options/options.js b/keepassxc-browser/options/options.js index 45cfa91..971532e 100644 --- a/keepassxc-browser/options/options.js +++ b/keepassxc-browser/options/options.js @@ -577,7 +577,7 @@ options.initSitePreferences = function() { row.setAttribute('id', 'tr-scf' + newIndex); const details = row.children[0]; - details.children[0].children[0].textContent = url; + details.children[0].children[0].children[0].textContent = url; details.querySelector('#ignore').value = ignore; details.querySelector('#ignore').addEventListener('change', selectionChanged); details.querySelector('#usernameOnly').checked = usernameOnly; From 8029bfacac84cdce94af7eeeea7e5dd79cdaa07e Mon Sep 17 00:00:00 2001 From: AKORA <65976562+A-K-O-R-A@users.noreply.github.com> Date: Mon, 7 Oct 2024 17:45:20 +0200 Subject: [PATCH 09/16] Change options layout --- keepassxc-browser/options/options.html | 84 ++++++++++++++------------ 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index 4a7d078..6cf5129 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -753,7 +753,7 @@ -
    +
    +
    +
    +
    +
    + + +
    +
    -
    -
    - - +
    +
    + + +
    +
    + +
    +
    + + +
    +
    -
    +
    +
    +
    + + +
    +
    +
    -
    -
    - - -
    -
    +
    +
    + + +
    +
    +
    -
    -
    - - -
    -
    - -
    -
    - - -
    -
    -
    - -
    -
    - - -
    -
    -
    - -
    -
    - - -
    +
    +
    + + +
    +
    +
    From 56bb358892db661022736b1fc8239eba779dac91 Mon Sep 17 00:00:00 2001 From: AKORA <65976562+A-K-O-R-A@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:07:46 +0200 Subject: [PATCH 10/16] Move ignore selector to left row --- keepassxc-browser/options/options.html | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index 6cf5129..097aca5 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -754,17 +754,18 @@
    -
    - - -
    -
    +
    +
    + + +
    +
    From 6473e59063cedd9ac6a1a00a3c7ffabb3c0d6520 Mon Sep 17 00:00:00 2001 From: AKORA <65976562+A-K-O-R-A@users.noreply.github.com> Date: Mon, 7 Oct 2024 21:53:52 +0200 Subject: [PATCH 11/16] Force button to always be on the right side and break urls on every character --- keepassxc-browser/options/options.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index 097aca5..26695d4 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -743,8 +743,8 @@
    -
    -
    +
    +
    - +
    From ba21fe292b32794476104c188c584a9d90a7effd Mon Sep 17 00:00:00 2001 From: AKORA <65976562+A-K-O-R-A@users.noreply.github.com> Date: Tue, 8 Oct 2024 10:12:31 +0200 Subject: [PATCH 12/16] Use global sitePreferences variable instead of function call --- keepassxc-browser/content/fill.js | 11 +---------- keepassxc-browser/content/keepassxc-browser.js | 13 +++---------- keepassxc-browser/content/totp-field.js | 12 +----------- 3 files changed, 5 insertions(+), 31 deletions(-) diff --git a/keepassxc-browser/content/fill.js b/keepassxc-browser/content/fill.js index 30d8cc4..f607436 100644 --- a/keepassxc-browser/content/fill.js +++ b/keepassxc-browser/content/fill.js @@ -316,16 +316,7 @@ kpxcFill.fillInStringFields = function(fields, stringFields) { // Performs Auto-Submit. If filling single credentials is enabled, a 5 second timeout will be needed for fill kpxcFill.performAutoSubmit = async function(combination, skipAutoSubmit) { - // Check for site preference overrides - const sitePreference = kpxc.retrieveSitePreference(); - let autoSubmitSitePreference = false; - if (sitePreference !== null && sitePreference !== undefined) { - if (sitePreference.autoSubmit === true || sitePreference.autoSubmit === false) { - autoSubmitSitePreference = sitePreference.autoSubmit; - } - } - - if (!kpxc.settings.autoSubmit && !autoSubmitSitePreference) { + if (!kpxc.settings.autoSubmit && !kpxc.preferencesForPage?.autoSubmit) { return; } diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index 74b3b9c..41049de 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -26,6 +26,7 @@ kpxc.detectedFields = 0; kpxc.improvedFieldDetectionEnabledForPage = false; kpxc.inputs = []; kpxc.settings = {}; +kpxc.preferencesForPage = null; kpxc.singleInputEnabledForPage = false; kpxc.submitUrl = null; kpxc.url = null; @@ -502,19 +503,10 @@ kpxc.prepareCredentials = async function() { } if (kpxc.credentials.length === 1) { - if (kpxc.settings.autoFillSingleEntry) { + if (kpxc.preferencesForPage?.autoFillCredentials || kpxc.settings.autoFillSingleEntry) { kpxcFill.fillFromAutofill(); return; } - - // Check for site preference overrides - const sitePreference = kpxc.retrieveSitePreference(); - if (sitePreference !== null && sitePreference !== undefined) { - if (sitePreference.autoFillCredentials === true) { - kpxcFill.fillFromAutofill(); - return; - } - } } kpxc.initLoginPopup(); @@ -983,6 +975,7 @@ const initContentScript = async function() { } kpxc.settings = settings; + kpxc.preferencesForPage = kpxc.retrieveSitePreference(); if (await kpxc.siteIgnored()) { logDebug('This site is ignored in Site Preferences.'); diff --git a/keepassxc-browser/content/totp-field.js b/keepassxc-browser/content/totp-field.js index 8f49d5b..2608108 100644 --- a/keepassxc-browser/content/totp-field.js +++ b/keepassxc-browser/content/totp-field.js @@ -106,17 +106,7 @@ class TOTPFieldIcon extends Icon { // Fill TOTP automatically if option is enabled TOTPFieldIcon.prototype.autoFillSingleTotp = async function(field) { - // Check for site preference overrides - const sitePreference = kpxc.retrieveSitePreference(); - let autoFillSingleTotpSitePreference = false; - if (sitePreference !== null && sitePreference !== undefined) { - if (sitePreference.autoFillTOTP === true || sitePreference.autoFillTOTP === false) { - autoFillSingleTotpSitePreference = sitePreference.autoFillTOTP; - } - } - - - if (kpxc.settings.autoFillSingleTotp || autoFillSingleTotpSitePreference) { + if (kpxc.preferencesForPage?.autoFillTOTP || kpxc.settings.autoFillSingleTotp) { if (kpxc.credentials.length === 0) { await kpxc.receiveCredentialsIfNecessary(); } From 2653cdbe3ecbeea6287e769b6d904cd81cd1486e Mon Sep 17 00:00:00 2001 From: AKORA <65976562+A-K-O-R-A@users.noreply.github.com> Date: Tue, 8 Oct 2024 10:18:03 +0200 Subject: [PATCH 13/16] Rename sitePrefrence property names to match the matching global setting property names --- .../content/keepassxc-browser.js | 2 +- keepassxc-browser/content/totp-field.js | 2 +- keepassxc-browser/options/options.html | 8 +++---- keepassxc-browser/options/options.js | 22 +++++++++---------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index 41049de..13ea78f 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -503,7 +503,7 @@ kpxc.prepareCredentials = async function() { } if (kpxc.credentials.length === 1) { - if (kpxc.preferencesForPage?.autoFillCredentials || kpxc.settings.autoFillSingleEntry) { + if (kpxc.preferencesForPage?.autoFillSingleEntry || kpxc.settings.autoFillSingleEntry) { kpxcFill.fillFromAutofill(); return; } diff --git a/keepassxc-browser/content/totp-field.js b/keepassxc-browser/content/totp-field.js index 2608108..a50dc9c 100644 --- a/keepassxc-browser/content/totp-field.js +++ b/keepassxc-browser/content/totp-field.js @@ -106,7 +106,7 @@ class TOTPFieldIcon extends Icon { // Fill TOTP automatically if option is enabled TOTPFieldIcon.prototype.autoFillSingleTotp = async function(field) { - if (kpxc.preferencesForPage?.autoFillTOTP || kpxc.settings.autoFillSingleTotp) { + if (kpxc.preferencesForPage?.autoFillSingleTotp || kpxc.settings.autoFillSingleTotp) { if (kpxc.credentials.length === 0) { await kpxc.receiveCredentialsIfNecessary(); } diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index 26695d4..fd58fbb 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -798,16 +798,16 @@
    - - + +
    - - + +
    diff --git a/keepassxc-browser/options/options.js b/keepassxc-browser/options/options.js index 971532e..4f0faab 100644 --- a/keepassxc-browser/options/options.js +++ b/keepassxc-browser/options/options.js @@ -547,10 +547,10 @@ options.initSitePreferences = function() { site.allowIframes = this.checked; } else if (this.name === 'autoSubmit') { site.autoSubmit = this.checked; - } else if (this.name === 'autoFillCredentials') { - site.autoFillCredentials = this.checked; - } else if (this.name === 'autoFillTOTP') { - site.autoFillTOTP = this.checked; + } else if (this.name === 'autoFillSingleEntry') { + site.autoFillSingleEntry = this.checked; + } else if (this.name === 'autoFillSingleTotp') { + site.autoFillSingleTotp = this.checked; } } } @@ -571,7 +571,7 @@ options.initSitePreferences = function() { options.saveSettings(); }; - const addNewRow = function(rowClone, newIndex, url, ignore, usernameOnly, improvedFieldDetection, allowIframes, autoSubmit, autoFillCredentials, autoFillTOTP) { + const addNewRow = function(rowClone, newIndex, url, ignore, usernameOnly, improvedFieldDetection, allowIframes, autoSubmit, autoFillSingleEntry, autoFillSingleTotp) { const row = rowClone.cloneNode(true); row.setAttribute('url', url); row.setAttribute('id', 'tr-scf' + newIndex); @@ -588,10 +588,10 @@ options.initSitePreferences = function() { details.querySelector('#allowIframes').addEventListener('change', checkboxClicked); details.querySelector('#autoSubmit').checked = autoSubmit; details.querySelector('#autoSubmit').addEventListener('change', checkboxClicked); - details.querySelector('#autoFillCredentials').checked = autoFillCredentials; - details.querySelector('#autoFillCredentials').addEventListener('change', checkboxClicked); - details.querySelector('#autoFillTOTP').checked = autoFillTOTP; - details.querySelector('#autoFillTOTP').addEventListener('change', checkboxClicked); + details.querySelector('#autoFillSingleEntry').checked = autoFillSingleEntry; + details.querySelector('#autoFillSingleEntry').addEventListener('change', checkboxClicked); + details.querySelector('#autoFillSingleTotp').checked = autoFillSingleTotp; + details.querySelector('#autoFillSingleTotp').addEventListener('change', checkboxClicked); details.querySelector('#deleteButton').addEventListener('click', removeButtonClicked); $('#tab-site-preferences #sitePreferencesTable').append(row); @@ -682,8 +682,8 @@ options.initSitePreferences = function() { site.improvedFieldDetection, site.allowIframes, site.autoSubmit, - site.autoFillCredentials, - site.autoFillTOTP, + site.autoFillSingleEntry, + site.autoFillSingleTotp, ); ++counter; } From 44b81e30e6a5c353cbeaa40cd780d185e03b6876 Mon Sep 17 00:00:00 2001 From: AKORA <65976562+A-K-O-R-A@users.noreply.github.com> Date: Tue, 8 Oct 2024 10:23:28 +0200 Subject: [PATCH 14/16] Fix text in delete modal --- keepassxc-browser/options/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keepassxc-browser/options/options.js b/keepassxc-browser/options/options.js index 4f0faab..41af5b3 100644 --- a/keepassxc-browser/options/options.js +++ b/keepassxc-browser/options/options.js @@ -528,7 +528,7 @@ options.initSitePreferences = function() { const closestLi = this.closest('li'); $('#dialogDeleteSite').setAttribute('url', closestLi.getAttribute('url')); $('#dialogDeleteSite').setAttribute('tr-id', closestLi.getAttribute('id')); - $('#dialogDeleteSite .modal-body strong').textContent = closestLi.children[0].textContent; + $('#dialogDeleteSite .modal-body strong').textContent = closestLi.children[0].children[0].children[0].children[0].textContent; dialogDeleteSiteModal.show(); }; From d54d8a8d9b3588d66fbef2ea370ddbadb48384c4 Mon Sep 17 00:00:00 2001 From: AKORA <65976562+A-K-O-R-A@users.noreply.github.com> Date: Tue, 8 Oct 2024 10:41:56 +0200 Subject: [PATCH 15/16] Move help texts from label to tooltip and make ignore selector it's own column --- keepassxc-browser/options/options.html | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index fd58fbb..1443c3d 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -765,7 +765,8 @@
    - +
    +
    @@ -787,28 +788,25 @@
    -
    +
    -
    +
    - -
    +
    -
    +
    - -
    +
    -
    +
    - -
    +
    From 8da82cae66528b88715d9b59fd234baebdc683d5 Mon Sep 17 00:00:00 2001 From: AKORA <65976562+A-K-O-R-A@users.noreply.github.com> Date: Tue, 8 Oct 2024 10:54:43 +0200 Subject: [PATCH 16/16] Add html comments --- keepassxc-browser/options/options.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index 1443c3d..c07de11 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -739,11 +739,15 @@ +
  • +
    + +
    +
    +
    @@ -766,7 +772,10 @@
    + +
    +
    @@ -774,6 +783,7 @@
    +
    @@ -781,6 +791,7 @@
    +
    @@ -788,7 +799,11 @@
    + +
    + +
    @@ -796,6 +811,7 @@
    +
    @@ -803,6 +819,7 @@
    +