GHHG10/CodeServer / opencode /packages /app /src /utils /terminal-websocket-url.ts
GHHG10's picture
download
raw
825 Bytes
import { authTokenFromCredentials } from "@/utils/server"
export function terminalWebSocketURL(input: {
url: string
id: string
directory: string
cursor: number
ticket?: string
sameOrigin?: boolean
username?: string
password?: string
authToken?: boolean
}) {
const next = new URL(`${input.url}/pty/${input.id}/connect`)
next.searchParams.set("directory", input.directory)
next.searchParams.set("cursor", String(input.cursor))
next.protocol = next.protocol === "https:" ? "wss:" : "ws:"
if (input.ticket) {
next.searchParams.set("ticket", input.ticket)
return next
}
if (input.password && (!input.sameOrigin || input.authToken))
next.searchParams.set(
"auth_token",
authTokenFromCredentials({ username: input.username, password: input.password }),
)
return next
}

Xet Storage Details

Size:
825 Bytes
·
Xet hash:
364fca891f05e39351a62618a051184177827a6ed4582c1d6a589e1fc4ccc557

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.