diff options
author | aszlig <aszlig@redmoonstudios.org> | 2017-06-09 05:04:59 +0200 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2017-06-09 05:04:59 +0200 |
commit | 4ab1416c9ded3ef3bec0618e1f7dd838d09f97c7 (patch) | |
tree | d173133c438bcd07eacb8d36941e46f0803f3d34 /pkgs/aszlig/gajim/default.nix | |
parent | 49eecfdb966eb02efa5b370cb231eb2fe85a3541 (diff) |
humble-bundle: Add helper for solving captchas
This is not only a major annoyance for us but seems to bother a few other people using the humblebundle-python API: * saik0/humblebundle-python#11 * saik0/humblebundle-python#14 * saik0/humblebundle-python#15 While digging through the reCaptcha2 API and also the implementation of the Humble Bundle site, I stumbled over this code from https://www.humblebundle.com/user/captcha: var captcha = new Recaptcha2('captcha-holder'); $('input[type=submit]').click(function(e){ e.preventDefault(); // recaptcha v2 only cares about response, but we can let the Android app interface stay the same var challenge = ''; var response = captcha.get_response(); var android_defined = false; if (typeof Android != 'undefined') { Android.setCaptchaResponse(challenge, response); } }) So we only need the response, which we do now using a very ugly written Qt 5 QWebEngine GUI which we use to ask the user to solve the captcha. Combined with our downloader, it works like this: Whenever the login fails with a HumbleCaptchaException, we print a message with the store path to the GUI helper. We're inside a fixed-output derivation builder, so we do have networking. The GUI helper also runs a small TCP server listening on port 18123 and the downloader inside the Nix builder constantly tries to connect to that port and waits until it gets just one string (the connection is directly closed afterwards and the GUI helper exits), which is the response. This is then passed as recaptcha_response keyword argument to the login() method of the HumbleApi object. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/aszlig/gajim/default.nix')
0 files changed, 0 insertions, 0 deletions