diff --git a/keepassxc-browser/content/fill.js b/keepassxc-browser/content/fill.js index 7bfe8d8..f607436 100644 --- a/keepassxc-browser/content/fill.js +++ b/keepassxc-browser/content/fill.js @@ -316,7 +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) { - if (!kpxc.settings.autoSubmit) { + 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 41a051e..afa83e1 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; @@ -506,15 +507,38 @@ kpxc.prepareCredentials = async function() { return; } - if (kpxc.settings.autoFillSingleEntry && kpxc.credentials.length === 1) { + if (kpxc.credentials.length === 1) { + if (kpxc.preferencesForPage?.autoFillSingleEntry || kpxc.settings.autoFillSingleEntry) { kpxcFill.fillFromAutofill(); return; + } } kpxc.initLoginPopup(); kpxc.initAutocomplete(); }; +kpxc.retrieveSitePreference = function() { + // Check for autofill site preferences + for (const site of kpxc.settings.sitePreferences) { + let currentLocation; + try { + currentLocation = window.top.location.href; + } catch (err) { + // Cross-domain security error inspecting window.top.location.href. + // This catches an error when an iframe is being accessed from another (sub)domain + // -> use the iframe URL instead. + currentLocation = window.self.location.href; + } + + if (siteMatch(site.url, currentLocation) || site.url === currentLocation) { + return site; + } + } + + return null; +} + /** * Gets the credential list and shows the update banner * @param {string} usernameValue Submitted username @@ -958,6 +982,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 a12032b..cd920eb 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.settings.autoFillSingleTotp) { + if (kpxc.preferencesForPage?.autoFillSingleTotp || kpxc.settings.autoFillSingleTotp) { if (kpxc.credentials.length === 0) { await kpxc.receiveCredentialsIfNecessary(); } diff --git a/keepassxc-browser/options/options.css b/keepassxc-browser/options/options.css index da74ffe..95ca2ff 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,44 @@ 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); + } +} + + +#sitePreferencesTable > li > details > summary { + list-style: none; + vertical-align: middle; +} + +#sitePreferencesTable > li > details > summary::-webkit-details-marker { + display: none; +} + +#sitePreferencesTable > li > details > summary > div > div:first-child{ + display: flex; + align-items: center; +} + +#sitePreferencesTable > li > details > summary > div > div:first-child::before { + content: '►'; + padding-right: 1rem; +} + +#sitePreferencesTable > li > details[open] > summary > div > div:first-child::before { + content: '▼'; + padding-right: 1rem; } diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index c9eed12..c07de11 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -731,45 +731,107 @@ -
- +
+
- - - - - - - - - - - - - - - - - - - - - - - -
- - - -
+ +
  • + +
  • + + +
  • +
    + +
    + +
    + + +
    + +
    +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + + +
    + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    + + +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    +
    +
  • +