From 43c126ecf8b4c7ce23a1d883993f2e62016a320f Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 21 Jun 2022 11:04:36 +0200 Subject: final adjustments before the release This commit: * adds handling of token expiration, * adds links to Google's Privacy Policy and Terms and * includes some other minor fixes adn adjustments. --- captcha-child-bframe.js | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'captcha-child-bframe.js') diff --git a/captcha-child-bframe.js b/captcha-child-bframe.js index 7f595c4..0a5b20d 100644 --- a/captcha-child-bframe.js +++ b/captcha-child-bframe.js @@ -58,6 +58,11 @@ const replacement_markup = ` background-color: white; } + h4 { + margin-bottom: 10px; + margin-top: 10px; + } + #tiles_table, #tiles_body td { border: 1px solid white; padding: 0; @@ -94,6 +99,12 @@ const replacement_markup = ` +
+ Google policies: + privacy + & + terms +

Loading Hacktcha - a libre client for reCAPTCHA. @@ -103,7 +114,7 @@ const replacement_markup = `

Challenge timed out.

- +

@@ -596,6 +607,8 @@ challenge_handlers.doscaptcha = function(api_helper, pmeta) { challenge_handlers.default = challenge_handlers.doscaptcha; +challenge_handlers.null = challenge_handlers.doscaptcha; + async function handle_challenge(api_helper, rresp) { const pmeta = rresp[4]; const challenge_type = rresp[5]; @@ -674,8 +687,16 @@ async function get_final_token(site_key, rc_version, token) { show_main_view("main_timed_out"); - const resume_but = document.getElementById("resume_but"); - await new Promise(cb => resume_but.onclick = cb); + /* + * Resuming after timeout does not work, so we allow the user to reload the + * iframe instead. + * TODO: fix resuming + */ + + /* const resume_but = document.getElementById("resume_but"); */ + /* await new Promise(cb => resume_but.onclick = cb); */ + + return new Promise(() => {}); } else if (e.hacktcha_error === "challenge_blocked") { show_main_view("main_challenge_blocked"); @@ -702,7 +723,7 @@ async function main() { document.close(); for (const but of document.getElementsByClassName("retry_but")) - but.onclick = () => window.postMessage("recreate_frame", origin); + but.onclick = () => window.parent.postMessage("recreate_frame", origin); const final_token = await get_final_token(site_key, rc_version, initial_token); -- cgit v1.2.3