|
@@ -238,7 +238,7 @@ const ENV_PATH = path.join(DATA_HOME, 'booking.env');
|
|
|
const ADMIN_BASE = 'admin.booking.com';
|
|
const ADMIN_BASE = 'admin.booking.com';
|
|
|
const STRIP = new Set(['OptanonConsent', 'pcm_consent', 'uz']);
|
|
const STRIP = new Set(['OptanonConsent', 'pcm_consent', 'uz']);
|
|
|
const FORCE_HEADLESS = !!process.env.HEADLESS;
|
|
const FORCE_HEADLESS = !!process.env.HEADLESS;
|
|
|
-const SKIP_CHAT_2FA = !!process.env.SKIP_CHAT_2FA;
|
|
|
|
|
|
|
+const SKIP_CHAT_2FA = !process.env.PRIME_CHAT_2FA;
|
|
|
|
|
|
|
|
export async function refresh(mode: string): Promise<CredentialsPayload> {
|
|
export async function refresh(mode: string): Promise<CredentialsPayload> {
|
|
|
const profile = profileDir('booking', mode);
|
|
const profile = profileDir('booking', mode);
|
|
@@ -313,19 +313,12 @@ export async function refresh(mode: string): Promise<CredentialsPayload> {
|
|
|
{ timeout: 60_000 },
|
|
{ timeout: 60_000 },
|
|
|
);
|
|
);
|
|
|
if (needsChallenge(page.url())) {
|
|
if (needsChallenge(page.url())) {
|
|
|
- await handlePostLoginChallenge(page, smsMasked);
|
|
|
|
|
- await page.waitForURL('**ses=**', { timeout: 120_000 });
|
|
|
|
|
|
|
+ await context.close();
|
|
|
|
|
+ throw new Error(`[booking] Login requires 2FA (${page.url().slice(0, 80)}) — run refresh-creds manually from a session with SMS access.`);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- console.error('Not logged in — log in and the script will continue automatically (5 min timeout)...');
|
|
|
|
|
- await page.waitForURL(
|
|
|
|
|
- url => url.toString().includes('ses=') || url.toString().includes('auth-assurance'),
|
|
|
|
|
- { timeout: 300_000 },
|
|
|
|
|
- );
|
|
|
|
|
- if (!page.url().includes('ses=')) {
|
|
|
|
|
- await handleAuthAssurance(page, smsMasked);
|
|
|
|
|
- await page.waitForURL('**ses=**', { timeout: 120_000 });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ console.error('Not logged in — waiting up to 5 minutes for manual login...');
|
|
|
|
|
+ await page.waitForURL('**ses=**', { timeout: 300_000 });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|