diff --git a/keepassxc-browser/background/event.js b/keepassxc-browser/background/event.js index 253ec71..e5cb5dd 100755 --- a/keepassxc-browser/background/event.js +++ b/keepassxc-browser/background/event.js @@ -264,6 +264,7 @@ kpxcEvent.messageHandlers = { 'init_http_auth': kpxcEvent.initHttpAuth, 'is_connected': kpxcEvent.getIsKeePassXCAvailable, 'is_iframe_allowed': page.isIframeAllowed, + 'is_site_ignored': page.isSiteIgnored, 'load_keyring': kpxcEvent.onLoadKeyRing, 'load_settings': kpxcEvent.onLoadSettings, 'lock_database': kpxcEvent.lockDatabase, diff --git a/keepassxc-browser/background/page.js b/keepassxc-browser/background/page.js index a3bfe5e..4d16bcb 100755 --- a/keepassxc-browser/background/page.js +++ b/keepassxc-browser/background/page.js @@ -320,6 +320,22 @@ page.fillHttpAuth = async function(tab, credentials) { } }; +page.isSiteIgnored = async function(tab, currentLocation) { + if (!page?.settings?.sitePreferences || !currentLocation) { + return false; + } + + for (const site of page.settings.sitePreferences) { + if (siteMatch(site.url, currentLocation) || site.url === currentLocation) { + if (site.ignore === IGNORE_FULL) { + return true; + } + } + } + + return false; +}; + // Update context menu for attribute filling page.updateContextMenu = async function(tab, credentials) { // Remove any old attribute items diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index 3ab81b9..6d0239a 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -981,6 +981,8 @@ browser.runtime.onMessage.addListener(async function(req, sender) { } } else if (req.action === 'ignore_site') { kpxc.ignoreSite(req.args); + } else if (req.action === 'is_site_ignored') { + return await kpxc.siteIgnored(); } else if (req.action === 'redetect_fields') { const response = await sendMessage('load_settings'); kpxc.settings = response; diff --git a/keepassxc-browser/content/passkeys-inject.js b/keepassxc-browser/content/passkeys-inject.js index a4ec0c3..f9e3dc0 100644 --- a/keepassxc-browser/content/passkeys-inject.js +++ b/keepassxc-browser/content/passkeys-inject.js @@ -99,6 +99,11 @@ const initContent = async () => { return; } + if (await chrome.runtime.sendMessage({ action: 'is_site_ignored', args: window.self.location.href })) { + console.log('This site is ignored in Site Preferences.'); + return; + } + if (settings.passkeys) { kpxcPasskeysUtils.debugLogging = settings?.debugLogging; kpxcPasskeysUtils.passkeysFallback = settings?.passkeysFallback;