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.
69 lines
1.9 KiB
TypeScript
69 lines
1.9 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { buildGuacamoleWebSocketBaseUrl } from "./guacamole-websocket-url.js";
|
|
|
|
const httpsLocation = {
|
|
protocol: "https:",
|
|
host: "termix.example.com",
|
|
} as Location;
|
|
|
|
describe("buildGuacamoleWebSocketBaseUrl", () => {
|
|
it("uses the same origin guacamole websocket path in production web builds", () => {
|
|
expect(
|
|
buildGuacamoleWebSocketBaseUrl({
|
|
isDev: false,
|
|
isElectronApp: false,
|
|
isEmbeddedApp: false,
|
|
basePath: "",
|
|
location: httpsLocation,
|
|
}),
|
|
).toBe("wss://termix.example.com/guacamole/websocket/");
|
|
});
|
|
|
|
it("preserves the runtime base path for proxied web deployments", () => {
|
|
expect(
|
|
buildGuacamoleWebSocketBaseUrl({
|
|
isDev: false,
|
|
isElectronApp: false,
|
|
isEmbeddedApp: false,
|
|
basePath: "/termix",
|
|
location: httpsLocation,
|
|
}),
|
|
).toBe("wss://termix.example.com/termix/guacamole/websocket/");
|
|
});
|
|
|
|
it("keeps direct local websocket access for development and embedded electron", () => {
|
|
expect(
|
|
buildGuacamoleWebSocketBaseUrl({
|
|
isDev: true,
|
|
isElectronApp: false,
|
|
isEmbeddedApp: false,
|
|
basePath: "/termix",
|
|
location: httpsLocation,
|
|
}),
|
|
).toBe("ws://localhost:30008");
|
|
|
|
expect(
|
|
buildGuacamoleWebSocketBaseUrl({
|
|
isDev: false,
|
|
isElectronApp: true,
|
|
isEmbeddedApp: true,
|
|
basePath: "/termix",
|
|
location: httpsLocation,
|
|
}),
|
|
).toBe("ws://127.0.0.1:30008");
|
|
});
|
|
|
|
it("uses the configured remote server URL for electron remote mode", () => {
|
|
expect(
|
|
buildGuacamoleWebSocketBaseUrl({
|
|
isDev: false,
|
|
isElectronApp: true,
|
|
isEmbeddedApp: false,
|
|
configuredServerUrl: "https://termix.example.com/termix/",
|
|
basePath: "",
|
|
location: httpsLocation,
|
|
}),
|
|
).toBe("wss://termix.example.com/termix/guacamole/websocket/");
|
|
});
|
|
});
|