mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 15:15:24 +00:00
feat: finish the remote-desktop plugin (B14)
This commit is contained in:
1 parent
0af2c94983
commit
14eb558b85
215 files changed
+30029
-3921
No files matched your search
@@ -1,12 +1,15 @@
|
||||
import type { SSHHostData } from "@/types";
|
||||
import type { Host } from "@/types/ui-types";
|
||||
|
||||
export type QuickConnectProtocol = "ssh" | "rdp" | "vnc";
|
||||
import type { HostProtocolDef } from "./host-protocols";
|
||||
|
||||
type QuickConnectInput = Pick<
|
||||
Host,
|
||||
"ip" | "port" | "username" | "authType" | "password" | "key" | "credentialId"
|
||||
> & { protocol?: QuickConnectProtocol; domain?: string };
|
||||
> & {
|
||||
/** A plugin protocol; SSH when omitted. */
|
||||
protocol?: HostProtocolDef;
|
||||
domain?: string;
|
||||
};
|
||||
|
||||
export const QUICK_CONNECT_ID_PREFIX = "quick-connect-";
|
||||
|
||||
@@ -15,10 +18,17 @@ export function isQuickConnectHost(host: Pick<Host, "id">): boolean {
|
||||
}
|
||||
|
||||
export function createQuickConnectHost(input: QuickConnectInput): Host {
|
||||
const protocol = input.protocol ?? "ssh";
|
||||
if (protocol !== "ssh") {
|
||||
const protocol = input.protocol;
|
||||
if (protocol) {
|
||||
// Protocol logins are core host fields named after the protocol.
|
||||
const login = {
|
||||
[`${protocol.id}AuthType`]: "direct",
|
||||
[`${protocol.id}User`]: input.username,
|
||||
[`${protocol.id}Password`]: input.password,
|
||||
};
|
||||
return {
|
||||
...createQuickConnectHost({ ...input, protocol: "ssh", port: 22 }),
|
||||
...createQuickConnectHost({ ...input, protocol: undefined, port: 22 }),
|
||||
...login,
|
||||
port: input.port,
|
||||
enableTerminal: false,
|
||||
enableCommandHistory: false,
|
||||
@@ -28,16 +38,13 @@ export function createQuickConnectHost(input: QuickConnectInput): Host {
|
||||
enableTerminalToolbar: false,
|
||||
enableAiAssistant: false,
|
||||
enableSsh: false,
|
||||
enableRdp: protocol === "rdp",
|
||||
enableVnc: protocol === "vnc",
|
||||
rdpPort: protocol === "rdp" ? input.port : 3389,
|
||||
vncPort: protocol === "vnc" ? input.port : 5900,
|
||||
rdpAuthType: "direct",
|
||||
rdpUser: protocol === "rdp" ? input.username : undefined,
|
||||
rdpPassword: protocol === "rdp" ? input.password : undefined,
|
||||
domain: protocol === "rdp" ? input.domain : undefined,
|
||||
vncUser: protocol === "vnc" ? input.username : undefined,
|
||||
vncPassword: protocol === "vnc" ? input.password : undefined,
|
||||
domain: input.domain,
|
||||
pluginSettings: {
|
||||
[protocol.pluginId]: {
|
||||
[protocol.settingKey]: true,
|
||||
...(protocol.portKey ? { [protocol.portKey]: input.port } : {}),
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
return {
|
||||
@@ -71,13 +78,7 @@ export function createQuickConnectHost(input: QuickConnectInput): Host {
|
||||
enableTerminalToolbar: true,
|
||||
enableAiAssistant: false,
|
||||
enableSsh: true,
|
||||
enableRdp: false,
|
||||
enableVnc: false,
|
||||
enableTelnet: false,
|
||||
sshPort: input.port,
|
||||
rdpPort: 3389,
|
||||
vncPort: 5900,
|
||||
telnetPort: 23,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -113,12 +114,6 @@ export function quickConnectHostToPayload(host: Host): SSHHostData {
|
||||
showServerStatsInSidebar: true,
|
||||
connectionType: "ssh",
|
||||
enableSsh: true,
|
||||
enableRdp: false,
|
||||
enableVnc: false,
|
||||
enableTelnet: false,
|
||||
sshPort: host.sshPort,
|
||||
rdpPort: host.rdpPort,
|
||||
vncPort: host.vncPort,
|
||||
telnetPort: host.telnetPort,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user