fix: wait for /v2/ URL after auth (not light-meetings), skip background for auth joins
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
f7dec141fc
commit
b8402311cd
1 changed files with 22 additions and 10 deletions
|
|
@ -216,21 +216,31 @@ export class BotOrchestrator {
|
||||||
if (authSuccess) {
|
if (authSuccess) {
|
||||||
this._logger.info('Authentication via "Sign in" link succeeded');
|
this._logger.info('Authentication via "Sign in" link succeeded');
|
||||||
|
|
||||||
// After the inline login flow completes (email → password → stay signed in),
|
// After the hybrid login flow (email on Teams modal, password on MS login),
|
||||||
// Teams triggers a redirect chain that ends at teams.microsoft.com/v2/
|
// Teams redirects to /v2/ with the authenticated pre-join page.
|
||||||
// with the authenticated pre-join page containing the "Join now" button.
|
// We must wait for the URL to contain "/v2/" — the light-meetings page
|
||||||
// Simply wait for that button to appear — no manual navigation needed.
|
// also has a "Join now" button but that's the anonymous version!
|
||||||
this._logger.info('Waiting for authenticated pre-join page (Join now button)...');
|
this._logger.info('Waiting for redirect to authenticated /v2/ pre-join page...');
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this._page!.waitForURL('**/v2/**', { timeout: 60000 });
|
||||||
|
const v2Url = this._page!.url();
|
||||||
|
this._logger.info(`Arrived at /v2/ page: ${v2Url.substring(0, 100)}`);
|
||||||
|
} catch {
|
||||||
|
const currentUrl = this._page!.url();
|
||||||
|
this._logger.warn(`Did not reach /v2/ page within 60s. URL: ${currentUrl.substring(0, 100)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now wait for the Join button on the authenticated /v2/ pre-join page
|
||||||
const joinButtonSelector = '#prejoin-join-button, button[data-tid="prejoin-join-button"]';
|
const joinButtonSelector = '#prejoin-join-button, button[data-tid="prejoin-join-button"]';
|
||||||
try {
|
try {
|
||||||
await this._page!.waitForSelector(joinButtonSelector, { timeout: 60000, state: 'visible' });
|
await this._page!.waitForSelector(joinButtonSelector, { timeout: 30000, state: 'visible' });
|
||||||
const finalUrl = this._page!.url();
|
const finalUrl = this._page!.url();
|
||||||
this._logger.info(`On authenticated pre-join page: ${finalUrl.substring(0, 100)}`);
|
this._logger.info(`On authenticated pre-join page with Join button: ${finalUrl.substring(0, 100)}`);
|
||||||
} catch {
|
} catch {
|
||||||
const finalUrl = this._page!.url();
|
const finalUrl = this._page!.url();
|
||||||
const pageContent = await this._page!.evaluate(() => document.body?.innerText?.substring(0, 300) || '');
|
const pageContent = await this._page!.evaluate(() => document.body?.innerText?.substring(0, 300) || '');
|
||||||
this._logger.warn(`Join button not found after 60s. URL: ${finalUrl.substring(0, 100)}`);
|
this._logger.warn(`Join button not found. URL: ${finalUrl.substring(0, 100)}`);
|
||||||
this._logger.warn(`Page content: ${pageContent.substring(0, 200)}`);
|
this._logger.warn(`Page content: ${pageContent.substring(0, 200)}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -241,8 +251,10 @@ export class BotOrchestrator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set virtual background if configured (must be done on pre-join screen, before "Join now")
|
// Set virtual background if configured (only for anonymous joins on light-meetings pre-join)
|
||||||
if (this._options.backgroundImageUrl && this._page && authenticate) {
|
// For authenticated joins, background is set after reaching the /v2/ pre-join page
|
||||||
|
// (the auth flow redirects through multiple pages, so background setup would interfere)
|
||||||
|
if (this._options.backgroundImageUrl && this._page && !authenticate) {
|
||||||
try {
|
try {
|
||||||
const { BackgroundProcedure } = await import('./backgroundProcedure');
|
const { BackgroundProcedure } = await import('./backgroundProcedure');
|
||||||
const bgProcedure = new BackgroundProcedure(this._page, this._logger);
|
const bgProcedure = new BackgroundProcedure(this._page, this._logger);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue