diff options
| author | OpeOginni <[email protected]> | 2026-03-12 07:48:44 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-12 14:48:44 +0800 |
| commit | c9c0318e0e5c2fcd80fc1c32a1ccfe360f182f90 (patch) | |
| tree | d69ca0c72a2799e4ec59fe127d842e0c97e9dc78 /packages/app | |
| parent | d481f64bdeaca91226e66c0e7888c7a10ba631f7 (diff) | |
| download | opencode-c9c0318e0e5c2fcd80fc1c32a1ccfe360f182f90.tar.gz opencode-c9c0318e0e5c2fcd80fc1c32a1ccfe360f182f90.zip | |
fix(desktop): set default WebSocket username and prevent repeated calling of terminal spawn properly closing the terminal (#17061)
Diffstat (limited to 'packages/app')
| -rw-r--r-- | packages/app/src/components/dialog-select-server.tsx | 10 | ||||
| -rw-r--r-- | packages/app/src/components/terminal.tsx | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/packages/app/src/components/dialog-select-server.tsx b/packages/app/src/components/dialog-select-server.tsx index 4813ecc45..3ecd26910 100644 --- a/packages/app/src/components/dialog-select-server.tsx +++ b/packages/app/src/components/dialog-select-server.tsx @@ -16,6 +16,8 @@ import { usePlatform } from "@/context/platform" import { normalizeServerUrl, ServerConnection, useServer } from "@/context/server" import { checkServerHealth, type ServerHealth } from "@/utils/server-health" +const DEFAULT_USERNAME = "opencode" + interface ServerFormProps { value: string name: string @@ -178,7 +180,7 @@ export function DialogSelectServer() { addServer: { url: "", name: "", - username: "", + username: DEFAULT_USERNAME, password: "", adding: false, error: "", @@ -201,7 +203,7 @@ export function DialogSelectServer() { setStore("addServer", { url: "", name: "", - username: "", + username: DEFAULT_USERNAME, password: "", adding: false, error: "", @@ -362,8 +364,8 @@ export function DialogSelectServer() { http: { url: normalized }, } if (store.addServer.name.trim()) conn.displayName = store.addServer.name.trim() - if (store.addServer.username) conn.http.username = store.addServer.username if (store.addServer.password) conn.http.password = store.addServer.password + if (store.addServer.password && store.addServer.username) conn.http.username = store.addServer.username const result = await checkServerHealth(conn.http, fetcher) setStore("addServer", { adding: false }) if (!result.healthy) { @@ -441,7 +443,7 @@ export function DialogSelectServer() { showForm: true, url: "", name: "", - username: "", + username: DEFAULT_USERNAME, password: "", error: "", status: undefined, diff --git a/packages/app/src/components/terminal.tsx b/packages/app/src/components/terminal.tsx index 120af0a17..fda66917f 100644 --- a/packages/app/src/components/terminal.tsx +++ b/packages/app/src/components/terminal.tsx @@ -452,7 +452,7 @@ export const Terminal = (props: TerminalProps) => { url.searchParams.set("directory", sdk.directory) url.searchParams.set("cursor", String(start !== undefined ? start : restore ? -1 : 0)) url.protocol = url.protocol === "https:" ? "wss:" : "ws:" - url.username = server.current?.http.username ?? "" + url.username = server.current?.http.username ?? "opencode" url.password = server.current?.http.password ?? "" const socket = new WebSocket(url) |
