fix: update types for heartbeat interval and constructor logger in DashboardServer and QueryDiversityEngine

This commit is contained in:
2025-12-06 14:42:30 +01:00
parent 0bef406d2e
commit 38d9f1e48d
3 changed files with 13 additions and 2 deletions

View File

@@ -21,7 +21,7 @@ export class DashboardServer {
private server: ReturnType<typeof createServer>
private wss: WebSocketServer
private clients: Set<WebSocket> = new Set()
private heartbeatInterval?: NodeJS.Timer
private heartbeatInterval?: NodeJS.Timeout
private dashboardLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100, // limit each IP to 100 requests per windowMs for dashboard UI

View File

@@ -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) {
try {
const passwordClicked = await this.tryClickPasswordOption(page)

View File

@@ -22,7 +22,7 @@ export class QueryDiversityEngine {
private logger?: (source: string, message: string, level?: 'info' | 'warn' | 'error') => void
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 cacheMinutes = Math.max(1, Math.min(config?.cacheMinutes || 30, 1440))