mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-11 01:36:16 +00:00
feat: Fix DNS 404
This commit is contained in:
@@ -41,8 +41,7 @@ class Browser {
|
|||||||
this.bot.log(this.bot.isMobile, 'BROWSER', `Launching ${engineName} (headless=${headless})`)
|
this.bot.log(this.bot.isMobile, 'BROWSER', `Launching ${engineName} (headless=${headless})`)
|
||||||
const proxyConfig = this.buildPlaywrightProxy(proxy)
|
const proxyConfig = this.buildPlaywrightProxy(proxy)
|
||||||
|
|
||||||
// Detect Raspberry Pi / ARM Linux for specific browser args
|
const isLinux = process.platform === 'linux'
|
||||||
const isRaspberryPi = process.platform === 'linux' && process.arch === 'arm64'
|
|
||||||
|
|
||||||
const baseArgs = [
|
const baseArgs = [
|
||||||
'--no-sandbox',
|
'--no-sandbox',
|
||||||
@@ -53,20 +52,29 @@ class Browser {
|
|||||||
'--ignore-ssl-errors'
|
'--ignore-ssl-errors'
|
||||||
]
|
]
|
||||||
|
|
||||||
// Add Raspberry Pi specific args to fix DNS/network issues
|
// Linux-specific args to fix DNS resolution & chrome-error://chromewebdata/ issues
|
||||||
const raspberryPiArgs = isRaspberryPi ? [
|
// These fixes apply to ALL Linux distributions (Ubuntu, Debian, Raspberry Pi OS, etc.)
|
||||||
|
// Fixes navigation interrupted errors caused by DNS timeouts & network service issues
|
||||||
|
const linuxNetworkFixArgs = isLinux ? [
|
||||||
'--disable-features=NetworkService',
|
'--disable-features=NetworkService',
|
||||||
'--disable-features=VizDisplayCompositor',
|
'--disable-features=VizDisplayCompositor',
|
||||||
|
'--enable-features=NetworkServiceInProcess',
|
||||||
'--disable-dev-shm-usage',
|
'--disable-dev-shm-usage',
|
||||||
'--disable-software-rasterizer',
|
'--disable-software-rasterizer',
|
||||||
'--disable-gpu',
|
'--disable-gpu',
|
||||||
'--disable-features=IsolateOrigins,site-per-process'
|
'--disable-features=IsolateOrigins,site-per-process',
|
||||||
|
'--disable-site-isolation-trials',
|
||||||
|
'--dns-prefetch-disable',
|
||||||
|
'--no-zygote',
|
||||||
|
'--single-process',
|
||||||
|
'--disable-blink-features=AutomationControlled'
|
||||||
] : []
|
] : []
|
||||||
|
|
||||||
browser = await playwright.chromium.launch({
|
browser = await playwright.chromium.launch({
|
||||||
headless,
|
headless,
|
||||||
...(proxyConfig && { proxy: proxyConfig }),
|
...(proxyConfig && { proxy: proxyConfig }),
|
||||||
args: [...baseArgs, ...raspberryPiArgs]
|
args: [...baseArgs, ...linuxNetworkFixArgs],
|
||||||
|
timeout: isLinux ? 120000 : 60000
|
||||||
})
|
})
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
const msg = (e instanceof Error ? e.message : String(e))
|
const msg = (e instanceof Error ? e.message : String(e))
|
||||||
|
|||||||
@@ -102,7 +102,14 @@ export class Login {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await page.goto('https://www.bing.com/rewards/dashboard', { waitUntil: 'domcontentloaded' })
|
// Use longer timeout on Linux due to DNS resolution issues
|
||||||
|
const isLinux = process.platform === 'linux'
|
||||||
|
const navigationTimeout = isLinux ? 45000 : 30000
|
||||||
|
|
||||||
|
await page.goto('https://www.bing.com/rewards/dashboard', {
|
||||||
|
waitUntil: 'domcontentloaded',
|
||||||
|
timeout: navigationTimeout
|
||||||
|
})
|
||||||
await this.disableFido(page)
|
await this.disableFido(page)
|
||||||
|
|
||||||
const [, , portalCheck] = await Promise.allSettled([
|
const [, , portalCheck] = await Promise.allSettled([
|
||||||
@@ -151,7 +158,9 @@ export class Login {
|
|||||||
url.searchParams.set('access_type', 'offline_access')
|
url.searchParams.set('access_type', 'offline_access')
|
||||||
url.searchParams.set('login_hint', email)
|
url.searchParams.set('login_hint', email)
|
||||||
|
|
||||||
await page.goto(url.href, { waitUntil: 'domcontentloaded' })
|
const isLinux = process.platform === 'linux'
|
||||||
|
const navigationTimeout = isLinux ? 45000 : 30000
|
||||||
|
await page.goto(url.href, { waitUntil: 'domcontentloaded', timeout: navigationTimeout })
|
||||||
const start = Date.now()
|
const start = Date.now()
|
||||||
this.bot.log(this.bot.isMobile, 'LOGIN-APP', 'Authorizing mobile scope...')
|
this.bot.log(this.bot.isMobile, 'LOGIN-APP', 'Authorizing mobile scope...')
|
||||||
let code = ''
|
let code = ''
|
||||||
@@ -243,7 +252,9 @@ export class Login {
|
|||||||
private async tryReuseExistingSession(page: Page): Promise<boolean> {
|
private async tryReuseExistingSession(page: Page): Promise<boolean> {
|
||||||
const homeUrl = 'https://rewards.bing.com/'
|
const homeUrl = 'https://rewards.bing.com/'
|
||||||
try {
|
try {
|
||||||
await page.goto(homeUrl)
|
const isLinux = process.platform === 'linux'
|
||||||
|
const navigationTimeout = isLinux ? 45000 : 30000
|
||||||
|
await page.goto(homeUrl, { timeout: navigationTimeout })
|
||||||
await page.waitForLoadState('domcontentloaded').catch(logError('LOGIN', 'DOMContentLoaded timeout', this.bot.isMobile))
|
await page.waitForLoadState('domcontentloaded').catch(logError('LOGIN', 'DOMContentLoaded timeout', this.bot.isMobile))
|
||||||
await this.bot.browser.utils.reloadBadPage(page)
|
await this.bot.browser.utils.reloadBadPage(page)
|
||||||
await this.bot.utils.wait(250)
|
await this.bot.utils.wait(250)
|
||||||
|
|||||||
Reference in New Issue
Block a user