mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-11 17:56:15 +00:00
feat: Centralize browser instance creation to eliminate duplication in Desktop and Mobile flows
fix: Update error message for HTTP 400 checks to English refactor: Improve logging for network idle wait timeout in Workers fix: Initialize lastError in Axios client to prevent undefined errors chore: Update tsconfig to include path mappings for better module resolution
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
import type { MicrosoftRewardsBot } from '../index'
|
||||
import type { Account } from '../interface/Account'
|
||||
import { createBrowserInstance } from '../util/BrowserFactory'
|
||||
import { saveSessionData } from '../util/Load'
|
||||
|
||||
export interface DesktopFlowResult {
|
||||
@@ -34,11 +35,8 @@ export class DesktopFlow {
|
||||
async run(account: Account): Promise<DesktopFlowResult> {
|
||||
this.bot.log(false, 'DESKTOP-FLOW', 'Starting desktop automation flow')
|
||||
|
||||
// FIXED: Use proper typed access instead of unsafe type assertion
|
||||
const browserModule = await import('../browser/Browser')
|
||||
const Browser = browserModule.default
|
||||
const browserInstance = new Browser(this.bot)
|
||||
const browser = await browserInstance.createBrowser(account.proxy, account.email)
|
||||
// IMPROVED: Use centralized browser factory to eliminate duplication
|
||||
const browser = await createBrowserInstance(this.bot, account.proxy, account.email)
|
||||
|
||||
let keepBrowserOpen = false
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
import type { MicrosoftRewardsBot } from '../index'
|
||||
import type { Account } from '../interface/Account'
|
||||
import { createBrowserInstance } from '../util/BrowserFactory'
|
||||
import { saveSessionData } from '../util/Load'
|
||||
import { MobileRetryTracker } from '../util/MobileRetryTracker'
|
||||
|
||||
@@ -40,11 +41,8 @@ export class MobileFlow {
|
||||
): Promise<MobileFlowResult> {
|
||||
this.bot.log(true, 'MOBILE-FLOW', 'Starting mobile automation flow')
|
||||
|
||||
// FIXED: Use proper typed access instead of unsafe type assertion
|
||||
const browserModule = await import('../browser/Browser')
|
||||
const Browser = browserModule.default
|
||||
const browserInstance = new Browser(this.bot)
|
||||
const browser = await browserInstance.createBrowser(account.proxy, account.email)
|
||||
// IMPROVED: Use centralized browser factory to eliminate duplication
|
||||
const browser = await createBrowserInstance(this.bot, account.proxy, account.email)
|
||||
|
||||
let keepBrowserOpen = false
|
||||
let browserClosed = false
|
||||
|
||||
Reference in New Issue
Block a user