mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-11 09:46:16 +00:00
Back
This commit is contained in:
@@ -228,9 +228,6 @@ export class Login {
|
||||
|
||||
await this.disableFido(page)
|
||||
|
||||
// CRITICAL: Start automatic Escape sender to dismiss native OS dialogs
|
||||
this.passkeyHandler.startEscapeWatcher(page)
|
||||
|
||||
const [reloadResult, totpResult, portalCheck] = await Promise.allSettled([
|
||||
this.bot.browser.utils.reloadBadPage(page),
|
||||
this.totpHandler.tryAutoTotp(page, 'initial landing'),
|
||||
@@ -262,12 +259,8 @@ export class Login {
|
||||
this.bot.log(this.bot.isMobile, 'LOGIN', 'Login complete')
|
||||
this.totpHandler.setTotpSecret(undefined)
|
||||
|
||||
// CRITICAL: Keep Escape watcher running for 10 more seconds
|
||||
// Bluetooth/Windows Hello dialogs appear AFTER login completion
|
||||
this.bot.log(this.bot.isMobile, 'LOGIN-ESCAPE', 'Keeping Escape watcher active for 10s (dialogs may appear after login)', 'log', 'cyan')
|
||||
setTimeout(() => {
|
||||
this.passkeyHandler.stopEscapeWatcher()
|
||||
}, 10000)
|
||||
this.bot.log(this.bot.isMobile, 'LOGIN', 'Login complete')
|
||||
this.totpHandler.setTotpSecret(undefined)
|
||||
} catch (e) {
|
||||
const errorMessage = e instanceof Error ? e.message : String(e)
|
||||
const stackTrace = e instanceof Error ? e.stack : undefined
|
||||
|
||||
@@ -31,55 +31,12 @@ export class PasskeyHandler {
|
||||
}).catch(logError('LOGIN-FIDO', 'Route interception setup failed', this.bot.isMobile))
|
||||
}
|
||||
|
||||
private escapeWatcherInterval: NodeJS.Timeout | null = null
|
||||
|
||||
/**
|
||||
* Start automatic Escape key sender to dismiss native OS dialogs (Bluetooth, Windows Hello)
|
||||
* CRITICAL: Native system dialogs cannot be dismissed via Playwright dialog handlers
|
||||
* They can only be closed with Escape key (as user discovered)
|
||||
*/
|
||||
public startEscapeWatcher(page: Page) {
|
||||
// Stop any existing watcher
|
||||
this.stopEscapeWatcher()
|
||||
|
||||
this.bot.log(this.bot.isMobile, 'LOGIN-ESCAPE', 'Starting automatic Escape sender (500ms interval)', 'log', 'cyan')
|
||||
|
||||
this.escapeWatcherInterval = setInterval(async () => {
|
||||
try {
|
||||
// Send Escape key to dismiss any native dialogs
|
||||
await page.keyboard.press('Escape').catch(() => {
|
||||
// Silent failure - page might be closed
|
||||
})
|
||||
} catch {
|
||||
// Silent failure - interval will be cleared when stopEscapeWatcher is called
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the automatic Escape key sender
|
||||
*/
|
||||
public stopEscapeWatcher() {
|
||||
if (this.escapeWatcherInterval) {
|
||||
clearInterval(this.escapeWatcherInterval)
|
||||
this.escapeWatcherInterval = null
|
||||
this.bot.log(this.bot.isMobile, 'LOGIN-ESCAPE', 'Stopped automatic Escape sender', 'log', 'cyan')
|
||||
}
|
||||
}
|
||||
// NOTE: Automatic Escape sender removed - native OS dialogs should be handled
|
||||
// via safer server-side/workflow changes or Playwright Virtual Authenticator.
|
||||
|
||||
public async handlePasskeyPrompts(page: Page, context: 'main' | 'oauth') {
|
||||
let did = false
|
||||
|
||||
// CRITICAL: Send Escape key FIRST to dismiss any native OS dialogs (Bluetooth, Windows Hello)
|
||||
// These dialogs appear AFTER password/TOTP and cannot be dismissed via DOM clicks
|
||||
try {
|
||||
await page.keyboard.press('Escape')
|
||||
await page.waitForTimeout(100) // Brief wait for dialog to close
|
||||
this.bot.log(this.bot.isMobile, 'PASSKEY-ESCAPE', 'Sent Escape key to dismiss native dialogs', 'log', 'green')
|
||||
} catch {
|
||||
// Silent failure - page might not be ready
|
||||
}
|
||||
|
||||
// Early exit for passkey creation flows (common on mobile): hit cancel/skip if present
|
||||
const currentUrl = page.url()
|
||||
if (/fido\/create|passkey/i.test(currentUrl)) {
|
||||
|
||||
Reference in New Issue
Block a user