fix: correct SSH connection string format for VS Code remote SSH
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s43df80ba5e0e7cd3k
diff --git a/webui/src/web-components/sketch-container-status.ts b/webui/src/web-components/sketch-container-status.ts
index e0c19cd..4385571 100644
--- a/webui/src/web-components/sketch-container-status.ts
+++ b/webui/src/web-components/sketch-container-status.ts
@@ -553,6 +553,19 @@
);
}
+ getSSHConnectionString() {
+ // Return the connection string for VS Code remote SSH
+ const connectionString =
+ this.state?.ssh_connection_string || `sketch-${this.state?.session_id}`;
+ // If the connection string already contains user@, use it as-is
+ // Otherwise prepend root@ for VS Code remote SSH
+ if (connectionString.includes("@")) {
+ return connectionString;
+ } else {
+ return `root@${connectionString}`;
+ }
+ }
+
// Format GitHub repository URL to org/repo format
formatGitHubRepo(url) {
if (!url) return null;
@@ -603,9 +616,10 @@
}
const sshHost = this.getSSHHostname();
- const sshCommand = `ssh ${sshHost}`;
- const vscodeCommand = `code --remote ssh-remote+root@${sshHost} /app -n`;
- const vscodeURL = `vscode://vscode-remote/ssh-remote+root@${sshHost}/app?windowId=_blank`;
+ const sshConnectionString = this.getSSHConnectionString();
+ const sshCommand = `ssh ${sshConnectionString}`;
+ const vscodeCommand = `code --remote ssh-remote+${sshConnectionString} /app -n`;
+ const vscodeURL = `vscode://vscode-remote/ssh-remote+${sshConnectionString}/app?windowId=_blank`;
if (!this.state?.ssh_available) {
return html`