diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-07-27 20:24:36 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-07-27 20:24:36 +0200 |
commit | e5fc00e506806f06bde32e9334fdec57dd8cb86d (patch) | |
tree | 8791be0727f5f7ef38443def9526c25accf51963 /plugins | |
parent | 87b3100773f20ab87198329c2a2284ca76235ca6 (diff) |
Implement new 4chan captcha
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Fourchan.hpp | 3 | ||||
-rw-r--r-- | plugins/ImageBoard.hpp | 12 |
2 files changed, 13 insertions, 2 deletions
diff --git a/plugins/Fourchan.hpp b/plugins/Fourchan.hpp index e2b4671..f09c7bb 100644 --- a/plugins/Fourchan.hpp +++ b/plugins/Fourchan.hpp @@ -30,8 +30,9 @@ namespace QuickMedia { FourchanThreadPage(Program *program, std::string board_id, std::string thread_id) : ImageBoardThreadPage(program, std::move(board_id), std::move(thread_id)) {} PluginResult login(const std::string &token, const std::string &pin, std::string &response_msg) override; - PostResult post_comment(const std::string &captcha_id, const std::string &comment, const std::string &filepath = "") override; + PostResult post_comment(const std::string &captcha_id, const std::string &captcha_solution, const std::string &comment, const std::string &filepath = "") override; const std::string& get_pass_id() override; + PluginResult request_captcha_challenge(ImageBoardCaptchaChallenge &challenge_response) override; private: std::string pass_id; }; diff --git a/plugins/ImageBoard.hpp b/plugins/ImageBoard.hpp index 651eabf..835d92a 100644 --- a/plugins/ImageBoard.hpp +++ b/plugins/ImageBoard.hpp @@ -14,6 +14,13 @@ namespace QuickMedia { ERR }; + struct ImageBoardCaptchaChallenge { + std::string challenge_id; + std::string img_data; + std::string bg_data; // optional + int ttl = 0; // optional + }; + class ImageBoardThreadPage : public VideoPage { public: ImageBoardThreadPage(Program *program, std::string board_id, std::string thread_id) : VideoPage(program, ""), board_id(std::move(board_id)), thread_id(std::move(thread_id)) {} @@ -27,9 +34,12 @@ namespace QuickMedia { } virtual PluginResult login(const std::string &token, const std::string &pin, std::string &response_msg); // If |filepath| is empty then no file is uploaded - virtual PostResult post_comment(const std::string &captcha_id, const std::string &comment, const std::string &filepath = "") = 0; + virtual PostResult post_comment(const std::string &captcha_id, const std::string &captcha_solution, const std::string &comment, const std::string &filepath = "") = 0; virtual const std::string& get_pass_id(); + // |bg_data|, |bg_size| and |ttl| are optional + virtual PluginResult request_captcha_challenge(ImageBoardCaptchaChallenge &challenge_response) = 0; + const std::string board_id; const std::string thread_id; }; |