mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 07:05:24 +00:00
Relocates guacamole backend/frontend source and tests into plugins/remote-desktop, following the ssh-terminal/docker pattern.
32 lines
877 B
TypeScript
32 lines
877 B
TypeScript
export function buildGuacamoleWebSocketBaseUrl({
|
|
isDev,
|
|
isElectronApp,
|
|
isEmbeddedApp,
|
|
configuredServerUrl,
|
|
basePath,
|
|
location,
|
|
}: {
|
|
isDev: boolean;
|
|
isElectronApp: boolean;
|
|
isEmbeddedApp: boolean;
|
|
configuredServerUrl?: string;
|
|
basePath: string;
|
|
location: Pick<Location, "protocol" | "host">;
|
|
}) {
|
|
if (isDev) return "ws://localhost:30008";
|
|
if (isElectronApp) {
|
|
if (isEmbeddedApp || !configuredServerUrl) return "ws://127.0.0.1:30008";
|
|
|
|
const wsProtocol = configuredServerUrl.startsWith("https://")
|
|
? "wss://"
|
|
: "ws://";
|
|
const wsHost = configuredServerUrl
|
|
.replace(/^https?:\/\//, "")
|
|
.replace(/\/$/, "");
|
|
return `${wsProtocol}${wsHost}/guacamole/websocket/`;
|
|
}
|
|
|
|
const wsProtocol = location.protocol === "https:" ? "wss" : "ws";
|
|
return `${wsProtocol}://${location.host}${basePath}/guacamole/websocket/`;
|
|
}
|