Limit number of autoretries on posting error. #1302
This commit is contained in:
parent
32ad98a0d6
commit
f89f9a2bbb
@ -775,19 +775,24 @@ 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.'
|
||||||
# Something must've gone terribly wrong if you get captcha errors without captchas.
|
if QR.errorCount >= 5
|
||||||
# Don't auto-post indefinitely in that case.
|
# Too many posting errors can ban you. Stop autoposting after 5 errors.
|
||||||
QR.cooldown.auto = QR.captcha.isEnabled or connErr
|
QR.cooldown.auto = false
|
||||||
# Too many frequent mistyped captchas will auto-ban you!
|
else
|
||||||
# On connection error, the post most likely didn't go through.
|
# Something must've gone terribly wrong if you get captcha errors without captchas.
|
||||||
# If the post did go through, it should be stopped by the duplicate reply cooldown.
|
# Don't auto-post indefinitely in that case.
|
||||||
QR.cooldown.addDelay post, 2
|
QR.cooldown.auto = QR.captcha.isEnabled or connErr
|
||||||
|
# Too many frequent mistyped captchas will auto-ban you!
|
||||||
|
# On connection error, the post most likely didn't go through.
|
||||||
|
# If the post did go through, it should be stopped by the duplicate reply cooldown.
|
||||||
|
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 = !/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])
|
||||||
@ -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+)/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user