mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 22:55:24 +00:00
fix(remote-desktop): probe the saved host guacd endpoint (#1481)
* fix(remote-desktop): probe the saved host guacd endpoint * test(css): exercise the configured PostCSS plugin chain * test(identity): preserve full Ed25519 public keys in fixtures
This commit is contained in:
1 parent
c98003f90e
commit
3b9a1bacf0
5 files changed
+194
-5
No files matched your search
@@ -321,7 +321,11 @@ const GuacamoleAppInner = React.forwardRef<
|
||||
stage: "guac_guacd",
|
||||
message: t("remoteDesktop.checkingGuacd"),
|
||||
});
|
||||
const status = await getGuacdStatus(resolvedOrigin);
|
||||
const status = await getGuacdStatus(resolvedOrigin, {
|
||||
hostId,
|
||||
protocol: resolvedProtocolForConnect,
|
||||
syncId: hostConfig.syncId,
|
||||
});
|
||||
if (status.enabled === false) {
|
||||
throw new Error(t("remoteDesktop.disabled"));
|
||||
}
|
||||
|
||||
@@ -244,10 +244,29 @@ export interface RemoteDesktopStatus {
|
||||
/** `probe: false` skips dialing guacd, for a caller that only needs `enabled`. */
|
||||
export async function getGuacdStatus(
|
||||
origin: ConnectionOrigin,
|
||||
options: { probe?: boolean } = {},
|
||||
options: {
|
||||
probe?: boolean;
|
||||
hostId?: number;
|
||||
protocol?: "rdp" | "vnc" | "telnet";
|
||||
syncId?: string | null;
|
||||
} = {},
|
||||
): Promise<RemoteDesktopStatus> {
|
||||
const params = new URLSearchParams();
|
||||
if (options.probe === false) params.set("probe", "0");
|
||||
if (options.hostId) {
|
||||
const useRemote = isElectron() && origin === "remote";
|
||||
const remoteHostId = useRemote
|
||||
? await resolveRemoteHostId(options.syncId)
|
||||
: null;
|
||||
if (useRemote && options.syncId && remoteHostId === null) {
|
||||
throw new Error("The synced host does not exist on the remote server");
|
||||
}
|
||||
params.set("hostId", String(remoteHostId ?? options.hostId));
|
||||
if (options.protocol) params.set("protocol", options.protocol);
|
||||
}
|
||||
const query = params.toString();
|
||||
const response = await guacamoleApi(origin).get<RemoteDesktopStatus>(
|
||||
options.probe === false ? "/status?probe=0" : "/status",
|
||||
query ? `/status?${query}` : "/status",
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user