feat: quick connect for RDP and VNC (#1335)

The Quick Connect panel gets a protocol switch. RDP/VNC quick hosts are
built like SSH ones (never saved) and opened as regular remote desktop
tabs; GuacamoleApp mints their token from the typed fields through the
existing /guacamole/token endpoint instead of a host-row lookup.
This commit is contained in:
ZacharyZcR
2026-08-25 01:40:42 +08:00
committed by GitHub
parent 672f5ba80b
commit 404608867f
6 changed files with 349 additions and 64 deletions
@@ -1,6 +1,8 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import {
createQuickConnectHost,
isQuickConnectHost,
quickConnectGuacHost,
quickConnectHostToPayload,
} from "../../sidebar/quick-connect-host";
@@ -47,3 +49,72 @@ describe("quick connect host", () => {
expect(payload.key).toBeUndefined();
});
});
describe("createQuickConnectHost for remote desktop protocols", () => {
it("builds an SSH host by default", () => {
const host = createQuickConnectHost({
ip: "10.0.0.1",
port: 2222,
username: "root",
authType: "password",
password: "pw",
});
expect(isQuickConnectHost(host)).toBe(true);
expect(host).toMatchObject({
enableSsh: true,
enableRdp: false,
sshPort: 2222,
password: "pw",
});
});
it("builds an RDP host that GuacamoleApp can mint a token from", () => {
const host = createQuickConnectHost({
ip: "10.0.0.2",
port: 3390,
username: "admin",
authType: "password",
password: "pw",
protocol: "rdp",
domain: "CORP",
});
expect(host).toMatchObject({
enableSsh: false,
enableRdp: true,
enableVnc: false,
rdpPort: 3390,
rdpUser: "admin",
rdpPassword: "pw",
domain: "CORP",
});
expect(quickConnectGuacHost(host)).toMatchObject({
ip: "10.0.0.2",
connectionType: "rdp",
rdpPort: 3390,
rdpUser: "admin",
rdpPassword: "pw",
domain: "CORP",
});
});
it("builds a VNC host with the password on the VNC fields", () => {
const host = createQuickConnectHost({
ip: "10.0.0.3",
port: 5901,
username: "",
authType: "password",
password: "vncpw",
protocol: "vnc",
});
expect(host).toMatchObject({
enableVnc: true,
vncPort: 5901,
vncPassword: "vncpw",
});
expect(quickConnectGuacHost(host)).toMatchObject({
connectionType: "vnc",
vncPort: 5901,
vncPassword: "vncpw",
});
});
});