diff --git a/keepassxc-browser/background/event.js b/keepassxc-browser/background/event.js index 607d9da..718c762 100755 --- a/keepassxc-browser/background/event.js +++ b/keepassxc-browser/background/event.js @@ -228,6 +228,7 @@ kpxcEvent.messageHandlers = { 'create_new_group': keepass.createNewGroup, 'enable_automatic_reconnect': keepass.enableAutomaticReconnect, 'disable_automatic_reconnect': keepass.disableAutomaticReconnect, + 'fill_http_auth': page.fillHttpAuth, 'generate_password': keepass.generatePassword, 'get_color_theme': kpxcEvent.getColorTheme, 'get_connected_database': kpxcEvent.onGetConnectedDatabase, diff --git a/keepassxc-browser/background/page.js b/keepassxc-browser/background/page.js index db45d2e..6234b5a 100755 --- a/keepassxc-browser/background/page.js +++ b/keepassxc-browser/background/page.js @@ -379,6 +379,17 @@ page.getLoginList = async function(tab) { return []; }; +page.fillHttpAuth = async function(tab, credentials) { + if (page.tabs[tab.id] && page.tabs[tab.id].loginList.resolve) { + page.tabs[tab.id].loginList.resolve({ + authCredentials: { + username: credentials.login, + password: credentials.password + } + }); + } +}; + // Update context menu for attribute filling page.updateContextMenu = async function(tab, credentials) { // Remove any old attribute items diff --git a/keepassxc-browser/manifest.json b/keepassxc-browser/manifest.json index 53a0753..81e679d 100755 --- a/keepassxc-browser/manifest.json +++ b/keepassxc-browser/manifest.json @@ -1,8 +1,8 @@ { "manifest_version": 2, "name": "KeePassXC-Browser", - "version": "1.8.5", - "version_name": "1.8.5", + "version": "1.8.5.1", + "version_name": "1.8.5.1", "description": "__MSG_extensionDescription__", "author": "KeePassXC Team", "icons": { diff --git a/keepassxc-browser/popups/popup_httpauth.js b/keepassxc-browser/popups/popup_httpauth.js index cc7ac58..1950ef9 100644 --- a/keepassxc-browser/popups/popup_httpauth.js +++ b/keepassxc-browser/popups/popup_httpauth.js @@ -19,16 +19,12 @@ return; } - if (data.resolve) { - const id = e.target.id; - const creds = data.logins[Number(id)]; - data.resolve({ - authCredentials: { - username: creds.login, - password: creds.password - } - }); - } + const credentials = data.logins[Number(e.target.id)]; + browser.runtime.sendMessage({ + action: 'fill_http_auth', + args: credentials + }); + close(); }); ll.appendChild(a); @@ -47,16 +43,12 @@ }); $('#btn-dismiss').addEventListener('click', async () => { - const loginData = await getLoginData(); - // Using reject won't work with every browser. So return empty credentials instead. - if (loginData.resolve) { - loginData.resolve({ - authCredentials: { - username: '', - password: '' - } - }); - } + // Return empty credentials + browser.runtime.sendMessage({ + action: 'fill_http_auth', + args: { login: '', password: '' } + }); + close(); }); })(); diff --git a/package-lock.json b/package-lock.json index cefa298..01dfeff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "KeePassXC-Browser", - "version": "1.8.5", + "version": "1.8.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "KeePassXC-Browser", - "version": "1.8.5", + "version": "1.8.5.1", "license": "GPL-3.0", "dependencies": { "@npmcli/fs": "^2.1.0", diff --git a/package.json b/package.json index 80fd26a..4004521 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "KeePassXC-Browser", - "version": "1.8.5", + "version": "1.8.5.1", "description": "KeePassXC-Browser", "main": "build.js", "devDependencies": {