diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-04-02 00:21:03 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-04-02 00:21:03 +0200 |
commit | c2934be8485376571066a652e94ed16ba2bc8d81 (patch) | |
tree | 381e69b5b2ebdb42313fab7fa6978fcb966d580c /src/GoogleCaptcha.cpp | |
parent | cfa37b674e9493388e7ebd89f53eacbb197cbdcb (diff) |
Cancel all tasks when pressing escape to go to previous page or when closing the window
Diffstat (limited to 'src/GoogleCaptcha.cpp')
-rw-r--r-- | src/GoogleCaptcha.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/GoogleCaptcha.cpp b/src/GoogleCaptcha.cpp index 3bd91eb..137eb24 100644 --- a/src/GoogleCaptcha.cpp +++ b/src/GoogleCaptcha.cpp @@ -99,8 +99,8 @@ namespace QuickMedia { return strip_html_tags(html_source.substr(start_index, end_index - start_index)); } - std::future<bool> google_captcha_request_challenge(const std::string &api_key, const std::string &referer, RequestChallengeResponse challenge_response_callback) { - return std::async(std::launch::async, [challenge_response_callback, api_key, referer]() { + AsyncTask<bool> google_captcha_request_challenge(const std::string &api_key, const std::string &referer, RequestChallengeResponse challenge_response_callback) { + return AsyncTask<bool>([challenge_response_callback, api_key, referer]() { std::string captcha_url = "https://www.google.com/recaptcha/api/fallback?k=" + api_key; std::string response; std::vector<CommandArg> additional_args = { @@ -131,8 +131,8 @@ namespace QuickMedia { return result; } - std::future<bool> google_captcha_post_solution(const std::string &api_key, const std::string &captcha_id, std::array<bool, 9> selected_images, PostSolutionResponse solution_response_callback) { - return std::async(std::launch::async, [solution_response_callback, api_key, captcha_id, selected_images]() { + AsyncTask<bool> google_captcha_post_solution(const std::string &api_key, const std::string &captcha_id, std::array<bool, 9> selected_images, PostSolutionResponse solution_response_callback) { + return AsyncTask<bool>([solution_response_callback, api_key, captcha_id, selected_images]() { std::string captcha_url = "https://www.google.com/recaptcha/api/fallback?k=" + api_key; std::string response; std::vector<CommandArg> additional_args = { |