Skip to content

Commit 91aa0b1

Browse files
committed
Ensure cookies are always fresh before starting a Lite Terminal
1 parent daa4010 commit 91aa0b1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/commands/webSocketTerminal.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ export async function launchWebSocketTerminal(targetUri?: vscode.Uri, nsOverride
796796
}
797797
const api = new AtelierAPI(targetUri);
798798

799-
// Guarantee we know the apiVersion of the server
799+
// Guarantee that we know the apiVersion of the server and that cookies are fresh
800800
await api.serverInfo();
801801

802802
// Get the terminal configuration
@@ -814,8 +814,11 @@ export class WebSocketTerminalProfileProvider implements vscode.TerminalProfileP
814814
const uri: vscode.Uri = await getWsServerConnection("2023.2.0");
815815

816816
if (uri) {
817+
const api = new AtelierAPI(uri);
818+
// Ensure cookies aren't stale because a 401 error will kill the terminal with no error log
819+
await api.serverInfo();
817820
// Get the terminal configuration. Will throw if there's an error.
818-
const terminalOpts = terminalConfigForUri(new AtelierAPI(uri), uri, true);
821+
const terminalOpts = terminalConfigForUri(api, uri, true);
819822
return new vscode.TerminalProfile(terminalOpts);
820823
} else if (uri === undefined) {
821824
throw new Error(NO_ELIGIBLE_CONNECTIONS);

0 commit comments

Comments
 (0)