Skip to content

Commit 063e6d9

Browse files
author
Sami Vänttinen
authored
Various fixes for 1.8.0 release (#1638)
Various small fixes for 1.8.0 release.
1 parent ba5a714 commit 063e6d9

File tree

11 files changed

+31
-22
lines changed

11 files changed

+31
-22
lines changed

keepassxc-browser/background/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ function onDisconnected() {
331331
keepass.associated.hash = null;
332332
keepass.databaseHash = '';
333333

334-
page.clearCredentials(page.currentTabId, true);
334+
page.clearAllLogins();
335335
keepass.updatePopup('cross');
336336
keepass.updateDatabaseHashToContent();
337337
logError(`Failed to connect: ${(browser.runtime.lastError === null ? 'Unknown error' : browser.runtime.lastError.message)}`);

keepassxc-browser/background/keepass.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ keepass.updateCredentials = async function(tab, args = []) {
8888
const response = await keepassClient.sendMessage(kpAction, tab, messageData, nonce);
8989
if (response) {
9090
// KeePassXC versions lower than 2.5.0 will have an empty parsed.error
91-
let successMessage = parsed.error;
91+
let successMessage = response.error;
9292
if (response.error === 'success' || response.error === '') {
9393
successMessage = entryId ? 'updated' : 'created';
9494
}

keepassxc-browser/background/page.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ page.createTabEntry = function(tabId) {
290290
credentials: [],
291291
errorMessage: null,
292292
loginList: [],
293-
loginId: -1
293+
loginId: undefined
294294
};
295295

296296
page.clearSubmittedCredentials();
@@ -320,14 +320,14 @@ page.retrieveCredentials = async function(tab, args = []) {
320320
};
321321

322322
page.getLoginId = async function(tab) {
323+
const currentTab = page.tabs[tab.id];
324+
323325
// If there's only one credential available and loginId is not set
324-
if (page.tabs[tab.id] && page.tabs[tab.id].loginId < 0
325-
&& page.tabs[tab.id]
326-
&& page.tabs[tab.id].credentials.length === 1) {
327-
return 0; // Index to the first credential
326+
if (currentTab && !currentTab.loginId && currentTab.credentials.length === 1) {
327+
return currentTab.credentials[0].uuid;
328328
}
329329

330-
return page.tabs[tab.id] ? page.tabs[tab.id].loginId : undefined;
330+
return currentTab ? currentTab.loginId : undefined;
331331
};
332332

333333
page.setLoginId = async function(tab, loginId) {

keepassxc-browser/common/sites.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const PREDEFINED_SITELIST = [
3434
'https://idmsa.apple.com/*',
3535
'https://secure.soundcloud.com/*',
3636
'https://icloud.com/*',
37+
'https://signin.benl.ebay.be/*',
3738
'https://signin.ebay.de/*',
3839
'https://signin.ebay.com/*',
3940
'https://signin.ebay.com.au/*',

keepassxc-browser/content/fields.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,14 @@ kpxcFields.getAllPageInputs = async function(previousInputs = []) {
171171
kpxcFields.getCombination = async function(field, givenType) {
172172
// If givenType is not set, return the combination that uses the selected field
173173
for (const combination of kpxc.combinations) {
174-
if (!givenType && Object.values(combination).find(c => c === field)) {
175-
return combination;
176-
} else if (givenType && combination[givenType]) {
177-
if (combination[givenType] === field || combination[givenType].includes(field)) {
174+
if (givenType) {
175+
// Strictly search a given type
176+
const c = combination[givenType];
177+
if (c && (c === field || (Array.isArray(c) && c.includes(field)))) {
178178
return combination;
179179
}
180+
} else if (Object.values(combination).find(c => c === field)) {
181+
return combination;
180182
}
181183
}
182184

keepassxc-browser/content/icons.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ kpxcIcons.hasIcon = function(field) {
108108
};
109109

110110
// Sets the icons to corresponding database lock status
111-
kpxcIcons.switchIcons = function() {
112-
kpxcUsernameIcons.switchIcon(kpxc.databaseState);
113-
kpxcPasswordIcons.switchIcon(kpxc.databaseState);
114-
kpxcTOTPIcons.switchIcon(kpxc.databaseState);
111+
kpxcIcons.switchIcons = async function() {
112+
const uuid = await sendMessage('page_get_login_id');
113+
114+
kpxcUsernameIcons.switchIcon(kpxc.databaseState, uuid);
115+
kpxcPasswordIcons.switchIcon(kpxc.databaseState, uuid);
116+
kpxcTOTPIcons.switchIcon(kpxc.databaseState, uuid);
115117
};

keepassxc-browser/content/keepassxc-browser.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,13 +701,14 @@ kpxc.siteIgnored = async function(condition) {
701701
// Updates database status and icons when tab is activated again
702702
kpxc.triggerActivatedTab = async function() {
703703
await kpxc.updateDatabaseState();
704-
kpxcIcons.switchIcons();
705704

706705
if (kpxc.databaseState === DatabaseState.UNLOCKED && kpxc.credentials.length === 0) {
707706
await kpxc.retrieveCredentials();
708707
} else if (kpxc.credentials.length > 0) {
709708
kpxc.initLoginPopup();
710709
}
710+
711+
kpxcIcons.switchIcons();
711712
};
712713

713714
// Updates the database state to the content script

keepassxc-browser/content/observer-helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ kpxcObserverHelper.getInputs = function(target, ignoreVisibility = false) {
139139
}
140140

141141
// Filter out any input fields with type 'hidden' right away
142-
const inputFields = [];
142+
let inputFields = [];
143143
Array.from(target.getElementsByTagName('input')).forEach(e => {
144144
if (e.type !== 'hidden' && !e.disabled && !kpxcObserverHelper.alreadyIdentified(e)) {
145145
inputFields.push(e);

keepassxc-browser/content/totp-field.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ kpxcTOTPIcons.newIcon = function(field, databaseState = DatabaseState.DISCONNECT
3131
kpxcTOTPIcons.icons.push(new TOTPFieldIcon(field, databaseState, segmented));
3232
};
3333

34-
kpxcTOTPIcons.switchIcon = function(state) {
35-
kpxcTOTPIcons.icons.forEach(u => u.switchIcon(state));
34+
kpxcTOTPIcons.switchIcon = function(state, uuid) {
35+
kpxcTOTPIcons.icons.forEach(u => u.switchIcon(state, uuid));
3636
};
3737

3838
kpxcTOTPIcons.deleteHiddenIcons = function() {
@@ -127,6 +127,8 @@ TOTPFieldIcon.prototype.createIcon = function(field, segmented = false) {
127127

128128
if (this.databaseState === DatabaseState.DISCONNECTED || this.databaseState === DatabaseState.LOCKED) {
129129
icon.style.filter = 'saturate(0%)';
130+
} else {
131+
icon.style.filter = 'saturate(100%)';
130132
}
131133

132134
icon.addEventListener('click', async function(e) {

keepassxc-browser/content/ui.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ class Icon {
4444
}
4545
}
4646

47-
switchIcon(state) {
47+
switchIcon(state, uuid) {
4848
if (!this.icon) {
4949
return;
5050
}
5151

5252
if (state === DatabaseState.UNLOCKED) {
53-
this.icon.style.filter = kpxc.credentials.length === 0 ? 'saturate(0%)' : 'saturate(100%)';
53+
this.icon.style.filter = kpxc.credentials.length === 0 && !uuid ? 'saturate(0%)' : 'saturate(100%)';
5454
} else {
5555
this.icon.style.filter = 'saturate(0%)';
5656
}

keepassxc-browser/popups/popup.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ code {
122122
}
123123

124124
#options-button {
125+
height: 31px;
125126
width: 2.5rem;
126127
}
127128

0 commit comments

Comments
 (0)