Limit number of autoretries on posting error. #1302

This commit is contained in:
ccd0 2019-07-23 02:13:34 -07:00
parent 32ad98a0d6
commit f89f9a2bbb

View File

@ -775,12 +775,17 @@ QR =
delete QR.currentCaptcha delete QR.currentCaptcha
if err if err
QR.errorCount = (QR.errorCount or 0) + 1
if /captcha|verification/i.test(err.textContent) or connErr if /captcha|verification/i.test(err.textContent) or connErr
# Remove the obnoxious 4chan Pass ad. # Remove the obnoxious 4chan Pass ad.
if /mistyped/i.test err.textContent if /mistyped/i.test err.textContent
err = 'You mistyped the CAPTCHA, or the CAPTCHA malfunctioned.' err = 'You mistyped the CAPTCHA, or the CAPTCHA malfunctioned.'
else if /expired/i.test err.textContent else if /expired/i.test err.textContent
err = 'This CAPTCHA is no longer valid because it has expired.' err = 'This CAPTCHA is no longer valid because it has expired.'
if QR.errorCount >= 5
# Too many posting errors can ban you. Stop autoposting after 5 errors.
QR.cooldown.auto = false
else
# Something must've gone terribly wrong if you get captcha errors without captchas. # Something must've gone terribly wrong if you get captcha errors without captchas.
# Don't auto-post indefinitely in that case. # Don't auto-post indefinitely in that case.
QR.cooldown.auto = QR.captcha.isEnabled or connErr QR.cooldown.auto = QR.captcha.isEnabled or connErr
@ -802,6 +807,8 @@ QR =
QR.error err QR.error err
return return
delete QR.errorCount
h1 = $ 'h1', @response h1 = $ 'h1', @response
[_, threadID, postID] = h1.nextSibling.textContent.match /thread:(\d+),no:(\d+)/ [_, threadID, postID] = h1.nextSibling.textContent.match /thread:(\d+),no:(\d+)/