Compare commits
2 commits
main
...
auto-close
Author | SHA1 | Date | |
---|---|---|---|
|
bd5544acc6 | ||
|
477cfce238 |
1 changed files with 18 additions and 9 deletions
|
@ -130,14 +130,14 @@ export async function connectToRemoteServer(
|
||||||
const sseTransport = transportStrategy === 'sse-only' || transportStrategy === 'sse-first'
|
const sseTransport = transportStrategy === 'sse-only' || transportStrategy === 'sse-first'
|
||||||
const transport = sseTransport
|
const transport = sseTransport
|
||||||
? new SSEClientTransport(url, {
|
? new SSEClientTransport(url, {
|
||||||
authProvider,
|
authProvider,
|
||||||
requestInit: { headers },
|
requestInit: { headers },
|
||||||
eventSourceInit,
|
eventSourceInit,
|
||||||
})
|
})
|
||||||
: new StreamableHTTPClientTransport(url, {
|
: new StreamableHTTPClientTransport(url, {
|
||||||
authProvider,
|
authProvider,
|
||||||
requestInit: { headers },
|
requestInit: { headers },
|
||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (client) {
|
if (client) {
|
||||||
|
@ -300,7 +300,16 @@ export function setupOAuthCallbackServerWithLongPoll(options: OAuthCallbackServe
|
||||||
log('Auth code received, resolving promise')
|
log('Auth code received, resolving promise')
|
||||||
authCompletedResolve(code)
|
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.
|
||||||
|
<script>
|
||||||
|
// If this is a non-interactive session (no manual approval step was required) then
|
||||||
|
// this should automatically close the window. If not, this will have no effect and
|
||||||
|
// the user will see the message above.
|
||||||
|
window.close();
|
||||||
|
</script>
|
||||||
|
`)
|
||||||
|
|
||||||
// Notify main flow that auth code is available
|
// Notify main flow that auth code is available
|
||||||
options.events.emit('auth-code-received', code)
|
options.events.emit('auth-code-received', code)
|
||||||
|
@ -376,7 +385,7 @@ export async function findAvailablePort(preferredPort?: number): Promise<number>
|
||||||
export async function parseCommandLineArgs(args: string[], defaultPort: number, usage: string) {
|
export async function parseCommandLineArgs(args: string[], defaultPort: number, usage: string) {
|
||||||
// Process headers
|
// Process headers
|
||||||
const headers: Record<string, string> = {}
|
const headers: Record<string, string> = {}
|
||||||
let i = 0;
|
let i = 0
|
||||||
while (i < args.length) {
|
while (i < args.length) {
|
||||||
if (args[i] === '--header' && i < args.length - 1) {
|
if (args[i] === '--header' && i < args.length - 1) {
|
||||||
const value = args[i + 1]
|
const value = args[i + 1]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue