From 477cfce23816ea60ad631b0512f01db95c956bd5 Mon Sep 17 00:00:00 2001 From: dp-rufus <73200607+dp-rufus@users.noreply.github.com> Date: Fri, 18 Apr 2025 03:30:43 +0100 Subject: [PATCH 1/2] Attempt auto close --- src/lib/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/utils.ts b/src/lib/utils.ts index c6238b2..8843c3f 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -300,7 +300,8 @@ export function setupOAuthCallbackServerWithLongPoll(options: OAuthCallbackServe log('Auth code received, resolving promise') authCompletedResolve(code) - res.send('Authorization successful! You may close this window and return to the CLI.') + res.send('Authorization successful! You may close this window and return to the CLI.' + + '') // Notify main flow that auth code is available options.events.emit('auth-code-received', code) From bd5544acc67adf6350501ed52d19835fc750093a Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Mon, 5 May 2025 15:25:49 +1000 Subject: [PATCH 2/2] Added a 2 second delay before closing the browser --- src/lib/utils.ts | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 8843c3f..c88a08b 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -130,14 +130,14 @@ export async function connectToRemoteServer( const sseTransport = transportStrategy === 'sse-only' || transportStrategy === 'sse-first' const transport = sseTransport ? new SSEClientTransport(url, { - authProvider, - requestInit: { headers }, - eventSourceInit, - }) + authProvider, + requestInit: { headers }, + eventSourceInit, + }) : new StreamableHTTPClientTransport(url, { - authProvider, - requestInit: { headers }, - }) + authProvider, + requestInit: { headers }, + }) try { if (client) { @@ -300,8 +300,16 @@ export function setupOAuthCallbackServerWithLongPoll(options: OAuthCallbackServe log('Auth code received, resolving promise') authCompletedResolve(code) - res.send('Authorization successful! You may close this window and return to the CLI.' + - '') + res.send(` + Authorization successful! + You may close this window and return to the CLI. + + `) // Notify main flow that auth code is available options.events.emit('auth-code-received', code) @@ -377,7 +385,7 @@ export async function findAvailablePort(preferredPort?: number): Promise export async function parseCommandLineArgs(args: string[], defaultPort: number, usage: string) { // Process headers const headers: Record = {} - let i = 0; + let i = 0 while (i < args.length) { if (args[i] === '--header' && i < args.length - 1) { const value = args[i + 1]