aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp21
-rw-r--r--src/plugins/Fourchan.cpp6
2 files changed, 13 insertions, 14 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index a48234e..1f7372a 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3766,11 +3766,12 @@ namespace QuickMedia {
if(get_image_board_last_posted_filepath(plugin_name, last_posted_time_filepath))
file_overwrite_atomic(last_posted_time_filepath, std::to_string(last_posted_time));
} else if(post_result == PostResult::TRY_AGAIN) {
- show_notification("QuickMedia", "Please wait before you post again");
- navigation_stage = NavigationStage::SOLVING_POST_CAPTCHA;
+ show_notification("QuickMedia", "Please wait before posting again");
+ navigation_stage = NavigationStage::VIEWING_COMMENTS;
} else if(post_result == PostResult::INVALID_CAPTCHA) {
show_notification("QuickMedia", "Invalid captcha, please try again");
- navigation_stage = NavigationStage::SOLVING_POST_CAPTCHA;
+ navigation_stage = NavigationStage::REQUESTING_CAPTCHA;
+ // TODO: Need to wait before requesting need captcha?
} else if(post_result == PostResult::BANNED) {
show_notification("QuickMedia", "Failed to post comment because you are banned", Urgency::CRITICAL);
navigation_stage = NavigationStage::VIEWING_COMMENTS;
@@ -3798,7 +3799,7 @@ namespace QuickMedia {
bool frame_skip_text_entry = false;
- comment_input.on_submit_callback = [&frame_skip_text_entry, &comment_input, &navigation_stage, &comment_to_post, &captcha_post_id, &selected_file_for_upload, &thread_page, &has_post_timeout, &seconds_until_post_again, &last_posted_time](std::string text) -> bool {
+ comment_input.on_submit_callback = [&frame_skip_text_entry, &comment_input, &navigation_stage, &comment_to_post, &selected_file_for_upload, &thread_page, &has_post_timeout, &seconds_until_post_again, &last_posted_time](std::string text) -> bool {
if(text.empty() && selected_file_for_upload.empty())
return false;
@@ -3810,10 +3811,10 @@ namespace QuickMedia {
assert(navigation_stage == NavigationStage::REPLYING);
comment_to_post = std::move(text);
- if(!captcha_post_id.empty() || !thread_page->get_pass_id().empty()) {
- navigation_stage = NavigationStage::POSTING_COMMENT;
- } else if(thread_page->get_pass_id().empty()) {
+ if(thread_page->get_pass_id().empty()) {
navigation_stage = NavigationStage::REQUESTING_CAPTCHA;
+ } else {
+ navigation_stage = NavigationStage::POSTING_COMMENT;
}
return false;
};
@@ -4245,10 +4246,8 @@ namespace QuickMedia {
auto image_size = captcha_bg_texture_size_f;
image_size.x *= image_scale.x;
image_size.y *= image_scale.y;
- const float width_diff = captcha_bg_texture_size_f.x - captcha_texture_size_f.x;
- const float left_opening = 0.15f;
- const float right_opening = 0.25f;
- captcha_bg_sprite.setPosition(std::floor(captcha_sprite.getPosition().x + captcha_image_size.x * left_opening - captcha_slide * (width_diff + right_opening * captcha_image_size.x)), std::floor(captcha_sprite.getPosition().y));
+ const float width_diff = image_size.x - captcha_image_size.x;
+ captcha_bg_sprite.setPosition(std::floor(captcha_sprite.getPosition().x + width_diff*1.0f - captcha_slide*(width_diff + width_diff*2.0f)), std::floor(captcha_sprite.getPosition().y));
window.draw(captcha_bg_sprite);
image_height = std::max(image_height, (int)image_size.y);
diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp
index 24886c6..c1d7d6a 100644
--- a/src/plugins/Fourchan.cpp
+++ b/src/plugins/Fourchan.cpp
@@ -539,14 +539,14 @@ namespace QuickMedia {
return PostResult::OK;
if(response.find("banned") != std::string::npos)
return PostResult::BANNED;
- if(response.find("try again") != std::string::npos)
- return PostResult::TRY_AGAIN;
- if(response.find("No valid captcha") != std::string::npos)
+ if(response.find("mistyped the CAPTCHA") != std::string::npos || response.find("No valid captcha") != std::string::npos)
return PostResult::INVALID_CAPTCHA;
if(response.find("Audio streams are not allowed") != std::string::npos)
return PostResult::FILE_TYPE_NOT_ALLOWED;
if(response.find("Error: Upload failed") != std::string::npos)
return PostResult::UPLOAD_FAILED;
+ if(response.find("try again") != std::string::npos)
+ return PostResult::TRY_AGAIN;
return PostResult::ERR;
}