19 lines · 636 B · TypeScript
RawDownload
export function resolveServerHttpOrigin(): string {  if (typeof window === "undefined") return "";   const bridgeWsUrl = window.desktopBridge?.getWsUrl?.();  const envWsUrl = import.meta.env.VITE_WS_URL as string | undefined;  const wsUrl =    typeof bridgeWsUrl === "string" && bridgeWsUrl.length > 0      ? bridgeWsUrl      : typeof envWsUrl === "string" && envWsUrl.length > 0        ? envWsUrl        : `ws://${window.location.hostname}:${window.location.port}`;  const httpUrl = wsUrl.replace(/^wss:/, "https:").replace(/^ws:/, "http:");   try {    return new URL(httpUrl).origin;  } catch {    return httpUrl;  }}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t