mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
25 lines
808 B
TypeScript
25 lines
808 B
TypeScript
import type { GuacamoleQuickHost } from "./GuacamoleApp";
|
|
import {
|
|
hostRemoteOptions,
|
|
type Protocol,
|
|
type RemoteHostLogin,
|
|
} from "./host-remote";
|
|
|
|
/** The slice of a quick-connect host that GuacamoleApp mints a token from. */
|
|
export function quickConnectGuacHost(
|
|
host: RemoteHostLogin,
|
|
): GuacamoleQuickHost {
|
|
const options = hostRemoteOptions(host);
|
|
const connectionType: Protocol = options.enableVnc ? "vnc" : "rdp";
|
|
return {
|
|
name: host.name ?? undefined,
|
|
ip: host.ip ?? "",
|
|
connectionType,
|
|
domain: host.domain,
|
|
port: connectionType === "vnc" ? options.vncPort : options.rdpPort,
|
|
rdpAuthType: host.rdpAuthType,
|
|
username: connectionType === "vnc" ? host.vncUser : host.rdpUser,
|
|
password: connectionType === "vnc" ? host.vncPassword : host.rdpPassword,
|
|
};
|
|
}
|