feat: add support for reCAPTCHA Enterprise

Closes #236.
This commit is contained in:
dessant 2020-09-25 10:07:43 +03:00
parent 5b1cf4f514
commit 092f3b9492
3 changed files with 9 additions and 3 deletions

View File

@ -138,7 +138,11 @@ async function setChallengeLocale() {
'https://www.google.com/recaptcha/api2/anchor*', 'https://www.google.com/recaptcha/api2/anchor*',
'https://www.google.com/recaptcha/api2/bframe*', 'https://www.google.com/recaptcha/api2/bframe*',
'https://www.recaptcha.net/recaptcha/api2/anchor*', 'https://www.recaptcha.net/recaptcha/api2/anchor*',
'https://www.recaptcha.net/recaptcha/api2/bframe*' 'https://www.recaptcha.net/recaptcha/api2/bframe*',
'https://www.google.com/recaptcha/enterprise/anchor*',
'https://www.google.com/recaptcha/enterprise/bframe*',
'https://www.recaptcha.net/recaptcha/enterprise/anchor*',
'https://www.recaptcha.net/recaptcha/enterprise/bframe*'
], ],
types: ['sub_frame'] types: ['sub_frame']
}, },

View File

@ -4,7 +4,7 @@
for (const [_, items] of Object.entries(client)) { for (const [_, items] of Object.entries(client)) {
for (const [_, v] of Object.entries(items)) { for (const [_, v] of Object.entries(items)) {
if (v instanceof Element && v.src === challengeUrl) { if (v instanceof Element && v.src === challengeUrl) {
grecaptcha.reset(k); (grecaptcha.reset || grecaptcha.enterprise.reset)(k);
return; return;
} }
} }

View File

@ -44,7 +44,9 @@
{ {
"matches": [ "matches": [
"https://www.google.com/recaptcha/api2/bframe*", "https://www.google.com/recaptcha/api2/bframe*",
"https://www.recaptcha.net/recaptcha/api2/bframe*" "https://www.recaptcha.net/recaptcha/api2/bframe*",
"https://www.google.com/recaptcha/enterprise/bframe*",
"https://www.recaptcha.net/recaptcha/enterprise/bframe*"
], ],
"all_frames": true, "all_frames": true,
"run_at": "document_idle", "run_at": "document_idle",