mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-11 17:56:15 +00:00
fix: update types for heartbeat interval and constructor logger in DashboardServer and QueryDiversityEngine
This commit is contained in:
@@ -21,7 +21,7 @@ export class DashboardServer {
|
|||||||
private server: ReturnType<typeof createServer>
|
private server: ReturnType<typeof createServer>
|
||||||
private wss: WebSocketServer
|
private wss: WebSocketServer
|
||||||
private clients: Set<WebSocket> = new Set()
|
private clients: Set<WebSocket> = new Set()
|
||||||
private heartbeatInterval?: NodeJS.Timer
|
private heartbeatInterval?: NodeJS.Timeout
|
||||||
private dashboardLimiter = rateLimit({
|
private dashboardLimiter = rateLimit({
|
||||||
windowMs: 15 * 60 * 1000, // 15 minutes
|
windowMs: 15 * 60 * 1000, // 15 minutes
|
||||||
max: 100, // limit each IP to 100 requests per windowMs for dashboard UI
|
max: 100, // limit each IP to 100 requests per windowMs for dashboard UI
|
||||||
|
|||||||
@@ -964,6 +964,17 @@ export class Login {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async clickFirstVisibleSelector(page: Page, selectors: readonly string[]): Promise<boolean> {
|
||||||
|
for (const sel of selectors) {
|
||||||
|
const loc = page.locator(sel).first()
|
||||||
|
if (await loc.isVisible().catch(() => false)) {
|
||||||
|
await loc.click().catch(logError('LOGIN', `Click failed for selector: ${sel}`, this.bot.isMobile))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
private async switchToPasswordLink(page: Page) {
|
private async switchToPasswordLink(page: Page) {
|
||||||
try {
|
try {
|
||||||
const passwordClicked = await this.tryClickPasswordOption(page)
|
const passwordClicked = await this.tryClickPasswordOption(page)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export class QueryDiversityEngine {
|
|||||||
private logger?: (source: string, message: string, level?: 'info' | 'warn' | 'error') => void
|
private logger?: (source: string, message: string, level?: 'info' | 'warn' | 'error') => void
|
||||||
private httpClient: HttpClient
|
private httpClient: HttpClient
|
||||||
|
|
||||||
constructor(config?: Partial<QueryDiversityConfig>, logger?: (source: string, message: string, level?: 'info' | 'warn' | 'error'), httpClient?: HttpClient) {
|
constructor(config?: Partial<QueryDiversityConfig>, logger?: (source: string, message: string, level?: 'info' | 'warn' | 'error') => void, httpClient?: HttpClient) {
|
||||||
const maxQueriesPerSource = Math.max(1, Math.min(config?.maxQueriesPerSource || 10, 50))
|
const maxQueriesPerSource = Math.max(1, Math.min(config?.maxQueriesPerSource || 10, 50))
|
||||||
const cacheMinutes = Math.max(1, Math.min(config?.cacheMinutes || 30, 1440))
|
const cacheMinutes = Math.max(1, Math.min(config?.cacheMinutes || 30, 1440))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user