fix: remove background image task, simplify post-auth to wait for redirects to settle
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
b8402311cd
commit
6dea7e3e10
1 changed files with 14 additions and 37 deletions
|
|
@ -216,33 +216,20 @@ 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 hybrid login flow (email on Teams modal, password on MS login),
|
// After the hybrid login flow, Teams goes through a redirect chain.
|
||||||
// Teams redirects to /v2/ with the authenticated pre-join page.
|
// It may briefly visit /v2/ then land back on light-meetings (now authenticated).
|
||||||
// We must wait for the URL to contain "/v2/" — the light-meetings page
|
// We just need to wait for the redirects to settle and for the page to stabilize.
|
||||||
// also has a "Join now" button but that's the anonymous version!
|
// The Join button (#prejoin-join-button) will appear once the page is ready.
|
||||||
this._logger.info('Waiting for redirect to authenticated /v2/ pre-join page...');
|
this._logger.info('Auth complete. Waiting for redirects to settle and Join button to appear...');
|
||||||
|
|
||||||
try {
|
// Wait for the redirect chain to finish (URL stops changing)
|
||||||
await this._page!.waitForURL('**/v2/**', { timeout: 60000 });
|
await this._page!.waitForTimeout(5000);
|
||||||
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 settledUrl = this._page!.url();
|
||||||
const joinButtonSelector = '#prejoin-join-button, button[data-tid="prejoin-join-button"]';
|
this._logger.info(`Post-auth settled URL: ${settledUrl.substring(0, 100)}`);
|
||||||
try {
|
|
||||||
await this._page!.waitForSelector(joinButtonSelector, { timeout: 30000, state: 'visible' });
|
// The authenticated join flow will be handled by joinMeetingLobbyFlow() below,
|
||||||
const finalUrl = this._page!.url();
|
// which will find the "Join now" button and click it.
|
||||||
this._logger.info(`On authenticated pre-join page with Join button: ${finalUrl.substring(0, 100)}`);
|
|
||||||
} catch {
|
|
||||||
const finalUrl = this._page!.url();
|
|
||||||
const pageContent = await this._page!.evaluate(() => document.body?.innerText?.substring(0, 300) || '');
|
|
||||||
this._logger.warn(`Join button not found. URL: ${finalUrl.substring(0, 100)}`);
|
|
||||||
this._logger.warn(`Page content: ${pageContent.substring(0, 200)}`);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this._logger.warn('Authentication via "Sign in" failed - continuing as anonymous');
|
this._logger.warn('Authentication via "Sign in" failed - continuing as anonymous');
|
||||||
}
|
}
|
||||||
|
|
@ -251,18 +238,8 @@ export class BotOrchestrator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set virtual background if configured (only for anonymous joins on light-meetings pre-join)
|
// Background image is managed via the user profile's default background.
|
||||||
// For authenticated joins, background is set after reaching the /v2/ pre-join page
|
// No background setup needed during the join flow.
|
||||||
// (the auth flow redirects through multiple pages, so background setup would interfere)
|
|
||||||
if (this._options.backgroundImageUrl && this._page && !authenticate) {
|
|
||||||
try {
|
|
||||||
const { BackgroundProcedure } = await import('./backgroundProcedure');
|
|
||||||
const bgProcedure = new BackgroundProcedure(this._page, this._logger);
|
|
||||||
await bgProcedure.setBackgroundFromUrl(this._options.backgroundImageUrl);
|
|
||||||
} catch (error) {
|
|
||||||
this._logger.warn(`Background image setup failed (non-fatal): ${error}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Join the meeting
|
// Join the meeting
|
||||||
await this._joinProcedure.joinMeetingLobbyFlow();
|
await this._joinProcedure.joinMeetingLobbyFlow();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue