mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-26 01:41:04 +00:00
feat: Add conclusion webhook support for final summary notifications (#355)
- Updated README.md to include new configuration options for conclusion webhook. - Enhanced BrowserFunc.ts with improved error handling during page reloads. - Implemented conclusionWebhook configuration in config.json. - Refactored Login.ts to use Playwright types and improved passkey handling. - Added safeClick method in SearchOnBing.ts to handle click timeouts and overlays. - Introduced account summary collection in index.ts for reporting. - Created ConclusionWebhook.ts to send structured summaries to a dedicated webhook. - Updated TypeScript definitions for better type safety across the project.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Page } from 'rebrowser-playwright'
|
||||
import type { Page } from 'playwright'
|
||||
import * as fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
@@ -21,7 +21,7 @@ export class SearchOnBing extends Workers {
|
||||
|
||||
const searchBar = '#sb_form_q'
|
||||
await page.waitForSelector(searchBar, { state: 'visible', timeout: 10000 })
|
||||
await page.click(searchBar)
|
||||
await this.safeClick(page, searchBar)
|
||||
await this.bot.utils.wait(500)
|
||||
await page.keyboard.type(query)
|
||||
await page.keyboard.press('Enter')
|
||||
@@ -36,6 +36,22 @@ export class SearchOnBing extends Workers {
|
||||
}
|
||||
}
|
||||
|
||||
private async safeClick(page: Page, selector: string) {
|
||||
try {
|
||||
await page.click(selector, { timeout: 5000 })
|
||||
} catch (e: any) {
|
||||
const msg = (e?.message || '')
|
||||
if (/Timeout.*click/i.test(msg) || /intercepts pointer events/i.test(msg)) {
|
||||
// Try to dismiss overlays then retry once
|
||||
await this.bot.browser.utils.tryDismissAllMessages(page)
|
||||
await this.bot.utils.wait(500)
|
||||
await page.click(selector, { timeout: 5000 })
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async getSearchQuery(title: string): Promise<string> {
|
||||
interface Queries {
|
||||
title: string;
|
||||
|
||||
Reference in New Issue
Block a user