From 982f16d913c55eb474eb8a9f2b93cb78554f6eae Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 13 Feb 2019 18:34:48 +0100 Subject: fetchHumbleBundle: Fix getting recaptcha response The object in question to get the response from the Recaptcha widget is now called "grecaptcha" instead of just "captcha" and the method to call now is also called "getResponse" instead of "get_response". Another change is that the grecaptcha object isn't available immediately once the page is loaded, so I added a try...catch loop for that. I know it's evil to do that, but I tried to check just for whether grecaptcha is available and then call the getResponse method but found out that during object construction there is a small time window where getResponse is available but isn't a callable method. There is still another issue with the HB fetcher, but the first step is hereby fixed. Signed-off-by: aszlig --- pkgs/games/humblebundle/fetch-humble-bundle/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkgs/games/humblebundle/fetch-humble-bundle/default.nix') diff --git a/pkgs/games/humblebundle/fetch-humble-bundle/default.nix b/pkgs/games/humblebundle/fetch-humble-bundle/default.nix index 44b0537a..8431799b 100644 --- a/pkgs/games/humblebundle/fetch-humble-bundle/default.nix +++ b/pkgs/games/humblebundle/fetch-humble-bundle/default.nix @@ -13,7 +13,11 @@ getCaptcha = let injectedJS = '' function waitForResponse() { - var response = captcha.get_response(); + try { + var response = grecaptcha.getResponse(); + } catch(_) { + return setTimeout(waitForResponse, 50); + } if (response != "") document.title = response; else -- cgit 1.4.1