summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOpeOginni <[email protected]>2026-04-09 00:13:10 +0100
committerGitHub <[email protected]>2026-04-09 07:13:10 +0800
commit51535d8ef3df797761fe39cde1e3340d4dd77eb7 (patch)
tree4879d1413e2cbcc8dffd4bc8ad094a211a2e8152
parent38f8714c09d72993534ce33a998955e40e83c74f (diff)
downloadopencode-51535d8ef3df797761fe39cde1e3340d4dd77eb7.tar.gz
opencode-51535d8ef3df797761fe39cde1e3340d4dd77eb7.zip
fix(app): skip url password setting for same-origin server and web app (#19923)
-rw-r--r--packages/app/src/components/terminal.tsx8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/app/src/components/terminal.tsx b/packages/app/src/components/terminal.tsx
index 0a5a7d2d3..31c046c4f 100644
--- a/packages/app/src/components/terminal.tsx
+++ b/packages/app/src/components/terminal.tsx
@@ -174,6 +174,7 @@ export const Terminal = (props: TerminalProps) => {
const auth = server.current?.http
const username = auth?.username ?? "opencode"
const password = auth?.password ?? ""
+ const sameOrigin = new URL(url, location.href).origin === location.origin
let container!: HTMLDivElement
const [local, others] = splitProps(props, ["pty", "class", "classList", "autoFocus", "onConnect", "onConnectError"])
const id = local.pty.id
@@ -519,8 +520,11 @@ export const Terminal = (props: TerminalProps) => {
next.searchParams.set("directory", directory)
next.searchParams.set("cursor", String(seek))
next.protocol = next.protocol === "https:" ? "wss:" : "ws:"
- next.username = username
- next.password = password
+ if (!sameOrigin && password) {
+ // For same-origin requests, let the browser reuse the page's existing auth.
+ next.username = username
+ next.password = password
+ }
const socket = new WebSocket(next)
socket.binaryType = "arraybuffer"