From e5fc00e506806f06bde32e9334fdec57dd8cb86d Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 27 Jul 2021 20:24:36 +0200 Subject: Implement new 4chan captcha --- plugins/Fourchan.hpp | 3 ++- plugins/ImageBoard.hpp | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'plugins') 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; }; -- cgit v1.2.3