Merge pull request #1993 from keepassxreboot/fix/add_patreon_to_predefined_sites

Add Patreon to Predefined Sites
This commit is contained in:
Sami Vänttinen 2023-09-25 07:05:29 +03:00 committed by GitHub
commit cba1010811
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -29,7 +29,8 @@ const PREDEFINED_SITELIST = [
'https://twitter.com/i/flow/login',
'https://login3.id.hp.com/*',
'https://secure.fnac.com/identity/server/gateway/*',
'https://*.openai.com/u/login/*'
'https://*.openai.com/u/login/*',
'https://www.patreon.com/login'
];
const awsUrl = 'signin.aws.amazon.com';
@ -58,9 +59,10 @@ kpxcSites.detectUsernameFromPage = function() {
* Handles a few exceptions for certain sites where password form is inside a div
* or another element that is not detected directly. Triggered by MutationObserver.
* @param {string} identifier Usually a classList or element id
* @param {object} field The target element
* @returns {boolean} True if an Element has a match with the identifier and document location
*/
kpxcSites.exceptionFound = function(identifier) {
kpxcSites.exceptionFound = function(identifier, field) {
if (!identifier || identifier.length === 0) {
return;
}
@ -82,6 +84,8 @@ kpxcSites.exceptionFound = function(identifier) {
|| document.location.origin.startsWith('https://mail.protonmail.com')
&& identifier === 'mailboxPassword') {
return true;
} else if (document.location.origin === 'https://www.patreon.com' && field?.name === 'current-password') {
return true;
}
return false;

View file

@ -74,7 +74,7 @@ kpxcObserverHelper.initObserver = async function() {
} else if (mut.type === 'attributes' && (mut.attributeName === 'class' || mut.attributeName === 'style')) {
// Only accept targets with forms
const forms = mut.target.nodeName === 'FORM' ? mut.target : mut.target.getElementsByTagName('form');
if (forms.length === 0 && !kpxcSites.exceptionFound(mut.target.classList)) {
if (forms.length === 0 && !kpxcSites.exceptionFound(mut.target.classList, mut.target)) {
continue;
}