mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-11 17:56:15 +00:00
feat: Improve error handling for HTTP 400 and network issues in browser navigation
This commit is contained in:
@@ -52,11 +52,12 @@ class Browser {
|
||||
'--ignore-ssl-errors'
|
||||
]
|
||||
|
||||
// Minimal Linux fixes for DNS/network issues without detection risk
|
||||
// Only adds essential stability flags that don't trigger bot detection
|
||||
// Linux stability fixes without detection risk
|
||||
const linuxStabilityArgs = isLinux ? [
|
||||
'--disable-dev-shm-usage',
|
||||
'--disable-software-rasterizer'
|
||||
'--disable-software-rasterizer',
|
||||
'--disable-http-cache',
|
||||
'--disk-cache-size=1'
|
||||
] : []
|
||||
|
||||
browser = await playwright.chromium.launch({
|
||||
|
||||
@@ -194,10 +194,15 @@ export default class BrowserUtil {
|
||||
const $ = load(html)
|
||||
|
||||
const isNetworkError = $('body.neterror').length
|
||||
const hasHttp400Error = html.includes('HTTP ERROR 400') ||
|
||||
html.includes('This page isn\'t working') ||
|
||||
html.includes('Cette page ne fonctionne pas')
|
||||
|
||||
if (isNetworkError) {
|
||||
this.bot.log(this.bot.isMobile, 'RELOAD-BAD-PAGE', 'Bad page detected, reloading!')
|
||||
await page.reload()
|
||||
if (isNetworkError || hasHttp400Error) {
|
||||
const errorType = hasHttp400Error ? 'HTTP 400' : 'network error'
|
||||
this.bot.log(this.bot.isMobile, 'RELOAD-BAD-PAGE', `Bad page detected (${errorType}), reloading!`)
|
||||
await page.reload({ waitUntil: 'domcontentloaded' })
|
||||
await this.bot.utils.wait(1500)
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user