Don't focus on the captcha for an error that would stop autoposting.

(Other than being out of captchas.)
Attention is needed elsewhere.
This commit is contained in:
ccd0 2015-11-20 12:11:23 -08:00
parent c270ee8def
commit a78ac7530c

View File

@ -754,20 +754,14 @@ QR =
<%= html('You mistyped the CAPTCHA, or the CAPTCHA malfunctioned [<a href="https://www.4chan-x.net/captchas.html" target="_blank">complain here</a>].') %> <%= html('You mistyped the CAPTCHA, or the CAPTCHA malfunctioned [<a href="https://www.4chan-x.net/captchas.html" target="_blank">complain here</a>].') %>
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.'
# Enable auto-post if we have some cached captchas. # Something must've gone terribly wrong if you get captcha errors without captchas.
QR.cooldown.auto = if QR.captcha.isEnabled # Don't auto-post indefinitely in that case.
!!QR.captcha.captchas.length QR.cooldown.auto = QR.captcha.isEnabled or err is 'Connection error with sys.4chan.org.'
else if err is 'Connection error with sys.4chan.org.'
true
else
# Something must've gone terribly wrong if you get captcha errors without captchas.
# Don't auto-post indefinitely in that case.
false
# Too many frequent mistyped captchas will auto-ban you! # Too many frequent mistyped captchas will auto-ban you!
# On connection error, the post most likely didn't go through. # On connection error, the post most likely didn't go through.
QR.cooldown.addDelay post, 2 QR.cooldown.addDelay post, 2
else if err.textContent and (m = err.textContent.match /(?:(\d+)\s+minutes?\s+)?(\d+)\s+second/i) and !/duplicate|hour/i.test(err.textContent) else if err.textContent and (m = err.textContent.match /(?:(\d+)\s+minutes?\s+)?(\d+)\s+second/i) and !/duplicate|hour/i.test(err.textContent)
QR.cooldown.auto = (!QR.captcha.isEnabled or !!QR.captcha.captchas.length) and !/have\s+been\s+muted/i.test(err.textContent) QR.cooldown.auto = !/have\s+been\s+muted/i.test(err.textContent)
seconds = 60 * (+(m[1]||0)) + (+m[2]) seconds = 60 * (+(m[1]||0)) + (+m[2])
if /muted/i.test err.textContent if /muted/i.test err.textContent
QR.cooldown.addMute seconds QR.cooldown.addMute seconds
@ -775,9 +769,10 @@ QR =
QR.cooldown.addDelay post, seconds QR.cooldown.addDelay post, seconds
else # stop auto-posting else # stop auto-posting
QR.cooldown.auto = false QR.cooldown.auto = false
QR.captcha.setup QR.cooldown.auto
QR.cooldown.auto = false if QR.captcha.isEnabled and !QR.captcha.captchas.length
QR.status() QR.status()
QR.error err QR.error err
QR.captcha.setup true
return return
h1 = $ 'h1', resDoc h1 = $ 'h1', resDoc