fix(app): derive terminal WebSocket URL from browser origin instead o… (#12178)

This commit is contained in:
Dave Dennis
2026-02-04 14:22:50 -06:00
committed by GitHub
parent 222bddc41a
commit 912098928a
3 changed files with 48 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ import { LocalPTY } from "@/context/terminal"
import { resolveThemeVariant, useTheme, withAlpha, type HexColor } from "@opencode-ai/ui/theme"
import { useLanguage } from "@/context/language"
import { showToast } from "@opencode-ai/ui/toast"
import { ptySocketUrl } from "./terminal-url"
export interface TerminalProps extends ComponentProps<"div"> {
pty: LocalPTY
@@ -163,8 +164,7 @@ export const Terminal = (props: TerminalProps) => {
const once = { value: false }
const url = new URL(sdk.url + `/pty/${local.pty.id}/connect?directory=${encodeURIComponent(sdk.directory)}`)
url.protocol = url.protocol === "https:" ? "wss:" : "ws:"
const url = ptySocketUrl(sdk.url, local.pty.id, sdk.directory, window.location)
if (window.__OPENCODE__?.serverPassword) {
url.username = "opencode"
url.password = window.__OPENCODE__?.serverPassword