mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #2293 from keepassxreboot/fix/predefined_improved_input_field_detection
Add Improved Input Field Detection to Predefined Sites feature
This commit is contained in:
commit
892e80fa2f
3 changed files with 25 additions and 7 deletions
|
|
@ -118,6 +118,7 @@
|
|||
"IGNORE_NORMAL": true,
|
||||
"IGNORE_NOTHING": true,
|
||||
"importScripts": true,
|
||||
"IMPROVED_DETECTION_PREDEFINED_SITELIST": true,
|
||||
"initColorTheme": true,
|
||||
"isEdge": true,
|
||||
"isFirefox": true,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,10 @@ const PREDEFINED_SITELIST = [
|
|||
'https://*.wordpress.com/log-in/'
|
||||
];
|
||||
|
||||
const IMPROVED_DETECTION_PREDEFINED_SITELIST = [
|
||||
'https://secure.chase.com/*'
|
||||
];
|
||||
|
||||
const googleUrl = 'https://accounts.google.com';
|
||||
|
||||
const kpxcSites = {};
|
||||
|
|
|
|||
|
|
@ -747,7 +747,7 @@ kpxc.showGroupNameInAutocomplete = function() {
|
|||
|| (kpxc.settings.showGroupNameInAutocomplete && kpxc.getUniqueGroupCount(kpxc.credentials) > 1);
|
||||
};
|
||||
|
||||
// Returns true if site is ignored
|
||||
// Returns true if site is ignored, and checks for predefined sites
|
||||
kpxc.siteIgnored = async function(condition) {
|
||||
if (kpxc.settings.sitePreferences) {
|
||||
let currentLocation;
|
||||
|
|
@ -760,7 +760,6 @@ kpxc.siteIgnored = async function(condition) {
|
|||
currentLocation = window.self.location.href;
|
||||
}
|
||||
|
||||
// Refresh current settings for the site
|
||||
const currentSetting = condition || IGNORE_FULL;
|
||||
for (const site of kpxc.settings.sitePreferences) {
|
||||
if (siteMatch(site.url, currentLocation) || site.url === currentLocation) {
|
||||
|
|
@ -768,6 +767,7 @@ kpxc.siteIgnored = async function(condition) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Refresh current settings for the site
|
||||
kpxc.singleInputEnabledForPage = site.usernameOnly;
|
||||
kpxc.improvedFieldDetectionEnabledForPage = site.improvedFieldDetection;
|
||||
await sendMessage('page_set_allow_iframes', [ site.allowIframes, currentLocation ]);
|
||||
|
|
@ -776,11 +776,7 @@ kpxc.siteIgnored = async function(condition) {
|
|||
|
||||
// Check for predefined sites
|
||||
if (kpxc.settings.usePredefinedSites) {
|
||||
for (const url of PREDEFINED_SITELIST) {
|
||||
if (siteMatch(url, currentLocation) || url === currentLocation) {
|
||||
kpxc.singleInputEnabledForPage = true;
|
||||
}
|
||||
}
|
||||
kpxc.usePredefinedSites(currentLocation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -843,6 +839,23 @@ kpxc.updateTOTPList = async function() {
|
|||
return [];
|
||||
};
|
||||
|
||||
// Enable certain settings based on predefined sites list
|
||||
kpxc.usePredefinedSites = function(currentLocation) {
|
||||
// Single input field
|
||||
for (const url of PREDEFINED_SITELIST) {
|
||||
if (siteMatch(url, currentLocation) || url === currentLocation) {
|
||||
kpxc.singleInputEnabledForPage = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Improved input field detection
|
||||
for (const url of IMPROVED_DETECTION_PREDEFINED_SITELIST) {
|
||||
if (siteMatch(url, currentLocation) || url === currentLocation) {
|
||||
kpxc.improvedFieldDetectionEnabledForPage = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Apply a script to the page for intercepting Passkeys (WebAuthn) requests
|
||||
kpxc.enablePasskeys = function() {
|
||||
if (document?.documentElement?.ownerDocument?.contentType !== 'text/html') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue