diff options
author | Sami Vänttinen <sami.vanttinen@protonmail.com> | 2022-06-22 07:22:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-22 07:22:05 +0300 |
commit | 063e6d990a554df54fc8488fac505234b6d3e8d8 (patch) | |
tree | 76a348df9a12b1c29471954f312bcdd64e377186 | |
parent | ba5a7141fba456ee409446ef32da2b19c416cee3 (diff) |
Various fixes for 1.8.0 release (#1638)1.8.0
Various small fixes for 1.8.0 release.
-rw-r--r-- | keepassxc-browser/background/client.js | 2 | ||||
-rwxr-xr-x | keepassxc-browser/background/keepass.js | 2 | ||||
-rwxr-xr-x | keepassxc-browser/background/page.js | 12 | ||||
-rw-r--r-- | keepassxc-browser/common/sites.js | 1 | ||||
-rw-r--r-- | keepassxc-browser/content/fields.js | 10 | ||||
-rw-r--r-- | keepassxc-browser/content/icons.js | 10 | ||||
-rwxr-xr-x | keepassxc-browser/content/keepassxc-browser.js | 3 | ||||
-rw-r--r-- | keepassxc-browser/content/observer-helper.js | 2 | ||||
-rw-r--r-- | keepassxc-browser/content/totp-field.js | 6 | ||||
-rw-r--r-- | keepassxc-browser/content/ui.js | 4 | ||||
-rw-r--r-- | keepassxc-browser/popups/popup.css | 1 |
11 files changed, 31 insertions, 22 deletions
diff --git a/keepassxc-browser/background/client.js b/keepassxc-browser/background/client.js index 9553702..7c8bcf2 100644 --- a/keepassxc-browser/background/client.js +++ b/keepassxc-browser/background/client.js @@ -331,7 +331,7 @@ function onDisconnected() { keepass.associated.hash = null; keepass.databaseHash = ''; - page.clearCredentials(page.currentTabId, true); + page.clearAllLogins(); keepass.updatePopup('cross'); keepass.updateDatabaseHashToContent(); logError(`Failed to connect: ${(browser.runtime.lastError === null ? 'Unknown error' : browser.runtime.lastError.message)}`); diff --git a/keepassxc-browser/background/keepass.js b/keepassxc-browser/background/keepass.js index 0e8f1b2..ec3c257 100755 --- a/keepassxc-browser/background/keepass.js +++ b/keepassxc-browser/background/keepass.js @@ -88,7 +88,7 @@ keepass.updateCredentials = async function(tab, args = []) { const response = await keepassClient.sendMessage(kpAction, tab, messageData, nonce); if (response) { // KeePassXC versions lower than 2.5.0 will have an empty parsed.error - let successMessage = parsed.error; + let successMessage = response.error; if (response.error === 'success' || response.error === '') { successMessage = entryId ? 'updated' : 'created'; } diff --git a/keepassxc-browser/background/page.js b/keepassxc-browser/background/page.js index e589fe7..6e2b020 100755 --- a/keepassxc-browser/background/page.js +++ b/keepassxc-browser/background/page.js @@ -290,7 +290,7 @@ page.createTabEntry = function(tabId) { credentials: [], errorMessage: null, loginList: [], - loginId: -1 + loginId: undefined }; page.clearSubmittedCredentials(); @@ -320,14 +320,14 @@ page.retrieveCredentials = async function(tab, args = []) { }; page.getLoginId = async function(tab) { + const currentTab = page.tabs[tab.id]; + // If there's only one credential available and loginId is not set - if (page.tabs[tab.id] && page.tabs[tab.id].loginId < 0 - && page.tabs[tab.id] - && page.tabs[tab.id].credentials.length === 1) { - return 0; // Index to the first credential + if (currentTab && !currentTab.loginId && currentTab.credentials.length === 1) { + return currentTab.credentials[0].uuid; } - return page.tabs[tab.id] ? page.tabs[tab.id].loginId : undefined; + return currentTab ? currentTab.loginId : undefined; }; page.setLoginId = async function(tab, loginId) { diff --git a/keepassxc-browser/common/sites.js b/keepassxc-browser/common/sites.js index fb3c783..bff588d 100644 --- a/keepassxc-browser/common/sites.js +++ b/keepassxc-browser/common/sites.js @@ -34,6 +34,7 @@ const PREDEFINED_SITELIST = [ 'https://idmsa.apple.com/*', 'https://secure.soundcloud.com/*', 'https://icloud.com/*', + 'https://signin.benl.ebay.be/*', 'https://signin.ebay.de/*', 'https://signin.ebay.com/*', 'https://signin.ebay.com.au/*', diff --git a/keepassxc-browser/content/fields.js b/keepassxc-browser/content/fields.js index 7e75afc..3b0c9e1 100644 --- a/keepassxc-browser/content/fields.js +++ b/keepassxc-browser/content/fields.js @@ -171,12 +171,14 @@ kpxcFields.getAllPageInputs = async function(previousInputs = []) { kpxcFields.getCombination = async function(field, givenType) { // If givenType is not set, return the combination that uses the selected field for (const combination of kpxc.combinations) { - if (!givenType && Object.values(combination).find(c => c === field)) { - return combination; - } else if (givenType && combination[givenType]) { - if (combination[givenType] === field || combination[givenType].includes(field)) { + if (givenType) { + // Strictly search a given type + const c = combination[givenType]; + if (c && (c === field || (Array.isArray(c) && c.includes(field)))) { return combination; } + } else if (Object.values(combination).find(c => c === field)) { + return combination; } } diff --git a/keepassxc-browser/content/icons.js b/keepassxc-browser/content/icons.js index 99144b4..dda3a2a 100644 --- a/keepassxc-browser/content/icons.js +++ b/keepassxc-browser/content/icons.js @@ -108,8 +108,10 @@ kpxcIcons.hasIcon = function(field) { }; // Sets the icons to corresponding database lock status -kpxcIcons.switchIcons = function() { - kpxcUsernameIcons.switchIcon(kpxc.databaseState); - kpxcPasswordIcons.switchIcon(kpxc.databaseState); - kpxcTOTPIcons.switchIcon(kpxc.databaseState); +kpxcIcons.switchIcons = async function() { + const uuid = await sendMessage('page_get_login_id'); + + kpxcUsernameIcons.switchIcon(kpxc.databaseState, uuid); + kpxcPasswordIcons.switchIcon(kpxc.databaseState, uuid); + kpxcTOTPIcons.switchIcon(kpxc.databaseState, uuid); }; diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index a13598e..f67e471 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -701,13 +701,14 @@ kpxc.siteIgnored = async function(condition) { // Updates database status and icons when tab is activated again kpxc.triggerActivatedTab = async function() { await kpxc.updateDatabaseState(); - kpxcIcons.switchIcons(); if (kpxc.databaseState === DatabaseState.UNLOCKED && kpxc.credentials.length === 0) { await kpxc.retrieveCredentials(); } else if (kpxc.credentials.length > 0) { kpxc.initLoginPopup(); } + + kpxcIcons.switchIcons(); }; // Updates the database state to the content script diff --git a/keepassxc-browser/content/observer-helper.js b/keepassxc-browser/content/observer-helper.js index 2b45fd5..e595dcb 100644 --- a/keepassxc-browser/content/observer-helper.js +++ b/keepassxc-browser/content/observer-helper.js @@ -139,7 +139,7 @@ kpxcObserverHelper.getInputs = function(target, ignoreVisibility = false) { } // Filter out any input fields with type 'hidden' right away - const inputFields = []; + let inputFields = []; Array.from(target.getElementsByTagName('input')).forEach(e => { if (e.type !== 'hidden' && !e.disabled && !kpxcObserverHelper.alreadyIdentified(e)) { inputFields.push(e); diff --git a/keepassxc-browser/content/totp-field.js b/keepassxc-browser/content/totp-field.js index 85dce33..ac1bfb5 100644 --- a/keepassxc-browser/content/totp-field.js +++ b/keepassxc-browser/content/totp-field.js @@ -31,8 +31,8 @@ kpxcTOTPIcons.newIcon = function(field, databaseState = DatabaseState.DISCONNECT kpxcTOTPIcons.icons.push(new TOTPFieldIcon(field, databaseState, segmented)); }; -kpxcTOTPIcons.switchIcon = function(state) { - kpxcTOTPIcons.icons.forEach(u => u.switchIcon(state)); +kpxcTOTPIcons.switchIcon = function(state, uuid) { + kpxcTOTPIcons.icons.forEach(u => u.switchIcon(state, uuid)); }; kpxcTOTPIcons.deleteHiddenIcons = function() { @@ -127,6 +127,8 @@ TOTPFieldIcon.prototype.createIcon = function(field, segmented = false) { if (this.databaseState === DatabaseState.DISCONNECTED || this.databaseState === DatabaseState.LOCKED) { icon.style.filter = 'saturate(0%)'; + } else { + icon.style.filter = 'saturate(100%)'; } icon.addEventListener('click', async function(e) { diff --git a/keepassxc-browser/content/ui.js b/keepassxc-browser/content/ui.js index b4d7d12..d3d06e1 100644 --- a/keepassxc-browser/content/ui.js +++ b/keepassxc-browser/content/ui.js @@ -44,13 +44,13 @@ class Icon { } } - switchIcon(state) { + switchIcon(state, uuid) { if (!this.icon) { return; } if (state === DatabaseState.UNLOCKED) { - this.icon.style.filter = kpxc.credentials.length === 0 ? 'saturate(0%)' : 'saturate(100%)'; + this.icon.style.filter = kpxc.credentials.length === 0 && !uuid ? 'saturate(0%)' : 'saturate(100%)'; } else { this.icon.style.filter = 'saturate(0%)'; } diff --git a/keepassxc-browser/popups/popup.css b/keepassxc-browser/popups/popup.css index 8a00c29..e6ab076 100644 --- a/keepassxc-browser/popups/popup.css +++ b/keepassxc-browser/popups/popup.css @@ -122,6 +122,7 @@ code { } #options-button { + height: 31px; width: 2.5rem; } |