feat: wire remote-desktop plugin into core and rename i18n keys

Repoints core consumers (dispatcher, collab, session-sharing, tab
utils) at the plugin, adds isTabTypeAvailable gating for rdp/vnc/
telnet, widens hostCapability to accept an array, and renames the
guacamole i18n namespace to remoteDesktop.
This commit is contained in:
LukeGus committed 2026-09-21 20:26:09 -05:00
1 parent c6bcfdb80d
commit 76b2e5739a
41 files changed
+361 -686

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
import { useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { AlertCircle, Eye, Presentation, Users } from "lucide-react";
import { GuacamoleDisplay } from "@/features/guacamole/GuacamoleDisplay.tsx";
import { GuacamoleDisplay } from "../../../../plugins/remote-desktop/frontend/GuacamoleDisplay.tsx";
import {
GuestTerminalView,
type SessionParticipantInfo,
+2 -2
View File
@@ -33,8 +33,8 @@ import { Input } from "@/components/input";
import { CollabMembersSidebar } from "./CollabMembersSidebar";
import { Terminal } from "@/features/terminal/Terminal";
import { CommandHistoryProvider } from "@/features/terminal/command-history/CommandHistoryContext";
import { GuacamoleDisplay } from "@/features/guacamole/GuacamoleDisplay.tsx";
import { getGuacamoleTokenFromHost } from "@/api/guacamole-api";
import { GuacamoleDisplay } from "../../../../plugins/remote-desktop/frontend/GuacamoleDisplay.tsx";
import { getGuacamoleTokenFromHost } from "../../../../plugins/remote-desktop/frontend/guacamole-api";
import { getSSHHosts, getUserList, type SSHHostWithStatus } from "@/main-axios";
import { getRoles } from "@/api/rbac-api";
import type { Role } from "@/main-axios";
@@ -11,7 +11,7 @@ import {
import { SimpleLoader } from "@/lib/SimpleLoader.tsx";
import { getBasePath } from "@/lib/base-path";
import { isElectron } from "@/lib/electron";
import { GuacamoleDisplay } from "@/features/guacamole/GuacamoleDisplay.tsx";
import { GuacamoleDisplay } from "../../../../plugins/remote-desktop/frontend/GuacamoleDisplay.tsx";
const PING_INTERVAL_MS = 30000;
+8 -8
View File
@@ -903,7 +903,7 @@
"useSocks5ProxyDesc": "Route connection through a proxy server",
"connectionOrigin": "Connection Origin",
"connectionOriginDesc": "Where this host's connection originates from. Overrides the desktop app's global default.",
"connectionOriginGuacamoleNote": "RDP, VNC and Telnet use the remote server unless you pick \"This device\", which needs a guacd this machine can reach — set one in the guacd URL setting, or per host under guacd Proxy.",
"connectionOriginRemoteDesktopNote": "RDP, VNC and Telnet use the remote server unless you pick \"This device\", which needs a guacd this machine can reach — set one in the guacd URL setting, or per host under guacd Proxy.",
"connectionOriginDefault": "Use default",
"connectionOriginLocal": "This device (local network)",
"connectionOriginRemote": "Remote server",
@@ -2050,7 +2050,7 @@
"userShareBadge": "User: {{username}}",
"loadSharesFailed": "Failed to load active shares"
},
"guacamole": {
"remoteDesktop": {
"connecting": "Connecting to {{type}} session...",
"checkingGuacd": "Checking remote desktop service...",
"requestingToken": "Requesting {{type}} connection token...",
@@ -3665,9 +3665,9 @@
"metrics": "Metrics",
"sec": "sec",
"logLevel": "Log Level",
"enableGuacamole": "Enable Guacamole",
"enableGuacamoleDesc": "RDP/VNC remote desktop",
"enableGuacamoleDocsLink": "View docs",
"enableRemoteDesktop": "Enable Remote Desktop",
"enableRemoteDesktopDesc": "RDP/VNC remote desktop",
"enableRemoteDesktopDocsLink": "View docs",
"guacdUrl": "guacd URL",
"tailscaleApiKey": "Tailscale API Key",
"tailscaleApiKeyDescription": "Used for device discovery in the host editor. Supports Tailscale (tskey-) and Headscale (hskey-) keys. Generate a key at tailscale.com/admin/settings/keys or from your Headscale instance.",
@@ -3821,9 +3821,9 @@
"metricsHistoryRetention": "Metrics History Retention",
"metricsHistoryRetentionRange": "1 to 90 days",
"days": "days",
"guacamoleSaved": "Guacamole settings saved",
"guacamoleSaveFailed": "Failed to save Guacamole settings",
"guacamoleUpdateFailed": "Failed to update Guacamole setting",
"remoteDesktopSaved": "Remote Desktop settings saved",
"remoteDesktopSaveFailed": "Failed to save Remote Desktop settings",
"remoteDesktopUpdateFailed": "Failed to update Remote Desktop setting",
"tailscaleSettingsSaved": "Tailscale settings saved",
"tailscaleSettingsSaveFailed": "Failed to save Tailscale settings",
"logLevelUpdateFailed": "Failed to update log level",
+2 -2
View File
@@ -2191,13 +2191,13 @@ export {
export type {
GuacamoleTokenRequest,
GuacamoleTokenResponse,
} from "@/api/guacamole-api";
} from "../../plugins/remote-desktop/frontend/guacamole-api";
export {
getGuacamoleDpi,
getGuacamoleToken,
getGuacamoleTokenFromHost,
getGuacdStatus,
} from "@/api/guacamole-api";
} from "../../plugins/remote-desktop/frontend/guacamole-api";
// ============================================================================
// RBAC MANAGEMENT
+26 -23
View File
@@ -539,11 +539,12 @@ export function CommandPalette({
handleAction(() => {
const type = host.enableSsh
? "terminal"
: host.enableRdp
: host.enableRdp && isTabTypeAvailable("rdp")
? "rdp"
: host.enableVnc
: host.enableVnc && isTabTypeAvailable("vnc")
? "vnc"
: host.enableTelnet
: host.enableTelnet &&
isTabTypeAvailable("telnet")
? "telnet"
: "terminal";
onOpenTab(type, host.name);
@@ -599,12 +600,13 @@ export function CommandPalette({
),
)}
{host.enableSsh &&
(host.enableRdp ||
host.enableVnc ||
host.enableTelnet) && (
((host.enableRdp && isTabTypeAvailable("rdp")) ||
(host.enableVnc && isTabTypeAvailable("vnc")) ||
(host.enableTelnet &&
isTabTypeAvailable("telnet"))) && (
<div className="w-px h-3.5 bg-border/60 mx-0.5 shrink-0" />
)}
{host.enableRdp && (
{host.enableRdp && isTabTypeAvailable("rdp") && (
<button
title="RDP"
onClick={(e) => {
@@ -619,7 +621,7 @@ export function CommandPalette({
RDP
</button>
)}
{host.enableVnc && (
{host.enableVnc && isTabTypeAvailable("vnc") && (
<button
title="VNC"
onClick={(e) => {
@@ -634,21 +636,22 @@ export function CommandPalette({
VNC
</button>
)}
{host.enableTelnet && (
<button
title="Telnet"
onClick={(e) => {
e.stopPropagation();
handleAction(() =>
onOpenTab("telnet", host.name),
);
}}
className="flex items-center gap-1 px-2 h-6 rounded text-xs font-medium text-muted-foreground/70 hover:text-foreground hover:bg-muted-foreground/10 transition-colors border border-border/40"
>
<Terminal className="size-3" />
Telnet
</button>
)}
{host.enableTelnet &&
isTabTypeAvailable("telnet") && (
<button
title="Telnet"
onClick={(e) => {
e.stopPropagation();
handleAction(() =>
onOpenTab("telnet", host.name),
);
}}
className="flex items-center gap-1 px-2 h-6 rounded text-xs font-medium text-muted-foreground/70 hover:text-foreground hover:bg-muted-foreground/10 transition-colors border border-border/40"
>
<Terminal className="size-3" />
Telnet
</button>
)}
{canEditHost(host) && (
<>
<div className="w-px h-3.5 bg-border/60 mx-0.5 shrink-0" />
+1
View File
@@ -40,6 +40,7 @@ import {
*/
const BUILT_IN_TABS_BY_PLUGIN: Record<string, string[]> = {
"ssh-terminal": ["terminal"],
"remote-desktop": ["rdp", "vnc", "telnet"],
ai: ["ai"],
};
+6 -3
View File
@@ -39,7 +39,7 @@ import type {
TerminalHandle,
TerminalHostConfig,
} from "@/features/terminal/Terminal";
import type { GuacamoleAppHandle } from "@/features/guacamole/GuacamoleApp";
import type { GuacamoleAppHandle } from "../../../plugins/remote-desktop/frontend/GuacamoleApp";
import { useIsMobile } from "@/hooks/use-mobile";
import type { Tab, TabType, Host } from "@/types/ui-types";
import {
@@ -110,7 +110,7 @@ const loadTmuxMonitor = () =>
}));
const TmuxMonitor = lazy(loadTmuxMonitor);
const loadGuacamoleApp = () =>
import("@/features/guacamole/GuacamoleApp").then((m) => ({
import("../../../plugins/remote-desktop/frontend/GuacamoleApp").then((m) => ({
default: m.default,
}));
const GuacamoleApp = lazy(loadGuacamoleApp);
@@ -655,7 +655,10 @@ export function renderTabContent(
case "telnet":
if (!host)
return (
<EmptyState icon={Monitor} messageKey="guacamole.noHostSelected" />
<EmptyState
icon={Monitor}
messageKey="remoteDesktop.noHostSelected"
/>
);
return withTabSuspense(
<GuacamoleApp
+3 -3
View File
@@ -866,9 +866,9 @@ export function AdminSettingsPanel({
async function handleSaveGuacamole() {
try {
await updateGuacamoleSettings({ enabled: guacEnabled, url: guacUrl });
toast.success(t("admin.guacamoleSaved"));
toast.success(t("admin.remoteDesktopSaved"));
} catch {
toast.error(t("admin.guacamoleSaveFailed"));
toast.error(t("admin.remoteDesktopSaveFailed"));
}
}
@@ -879,7 +879,7 @@ export function AdminSettingsPanel({
await updateGuacamoleSettings({ enabled: newVal, url: guacUrl });
} catch {
setGuacEnabled(!newVal);
toast.error(t("admin.guacamoleUpdateFailed"));
toast.error(t("admin.remoteDesktopUpdateFailed"));
}
}
+3 -3
View File
@@ -520,17 +520,17 @@ export function AdminGeneralSettingsSection({
<div className="flex flex-col gap-2 border-t border-border pt-3 mt-2">
<SettingRow
label={t("admin.enableGuacamole")}
label={t("admin.enableRemoteDesktop")}
description={
<>
{t("admin.enableGuacamoleDesc")}{" "}
{t("admin.enableRemoteDesktopDesc")}{" "}
<a
href="https://docs.termix.site/setup/remote-desktop"
target="_blank"
rel="noreferrer"
className="text-accent-brand hover:underline"
>
{t("admin.enableGuacamoleDocsLink")}
{t("admin.enableRemoteDesktopDocsLink")}
</a>
</>
}
+1 -1
View File
@@ -773,7 +773,7 @@ export function HostEditorGeneralTab({
protocols.enableRdp ||
protocols.enableVnc ||
protocols.enableTelnet
? `${t("hosts.connectionOriginDesc")} ${t("hosts.connectionOriginGuacamoleNote")}`
? `${t("hosts.connectionOriginDesc")} ${t("hosts.connectionOriginRemoteDesktopNote")}`
: t("hosts.connectionOriginDesc")
}
>
+1 -1
View File
@@ -1,6 +1,6 @@
import type { SSHHostData } from "@/types";
import type { Host } from "@/types/ui-types";
import type { GuacamoleQuickHost } from "@/features/guacamole/GuacamoleApp";
import type { GuacamoleQuickHost } from "../../../plugins/remote-desktop/frontend/GuacamoleApp";
export type QuickConnectProtocol = "ssh" | "rdp" | "vnc";
+20 -16
View File
@@ -493,17 +493,19 @@ export function HostItem({
const sshActions = getSshActions(host);
const availableActions: TabType[] = [
...sshActions.map(({ type }) => type),
...(host.enableRdp ? (["rdp"] as const) : []),
...(host.enableVnc ? (["vnc"] as const) : []),
...(host.enableTelnet ? (["telnet"] as const) : []),
...(host.enableRdp && isTabTypeAvailable("rdp") ? (["rdp"] as const) : []),
...(host.enableVnc && isTabTypeAvailable("vnc") ? (["vnc"] as const) : []),
...(host.enableTelnet && isTabTypeAvailable("telnet")
? (["telnet"] as const)
: []),
];
const defaultAction: TabType = host.enableSsh
? "terminal"
: host.enableRdp
: host.enableRdp && isTabTypeAvailable("rdp")
? "rdp"
: host.enableVnc
: host.enableVnc && isTabTypeAvailable("vnc")
? "vnc"
: host.enableTelnet
: host.enableTelnet && isTabTypeAvailable("telnet")
? "telnet"
: "terminal";
const openHostTab = (
@@ -604,11 +606,13 @@ export function HostItem({
),
)}
{host.enableSsh &&
(host.enableRdp || host.enableVnc || host.enableTelnet) &&
((host.enableRdp && isTabTypeAvailable("rdp")) ||
(host.enableVnc && isTabTypeAvailable("vnc")) ||
(host.enableTelnet && isTabTypeAvailable("telnet"))) &&
sshActions.length > 0 && (
<div className="w-px h-3.5 bg-border/60 mx-0.5 shrink-0" />
)}
{host.enableRdp && (
{host.enableRdp && isTabTypeAvailable("rdp") && (
<button
title={t("hosts.connectRdp")}
onPointerEnter={() => preloadTabSurface("rdp")}
@@ -631,7 +635,7 @@ export function HostItem({
<MonitorUp className="size-3.5" />
</button>
)}
{host.enableVnc && (
{host.enableVnc && isTabTypeAvailable("vnc") && (
<button
title={t("hosts.connectVnc")}
onPointerEnter={() => preloadTabSurface("vnc")}
@@ -645,7 +649,7 @@ export function HostItem({
<MousePointerClick className="size-3.5" />
</button>
)}
{host.enableTelnet && (
{host.enableTelnet && isTabTypeAvailable("telnet") && (
<button
title={t("hosts.connectTelnet")}
onPointerEnter={() => preloadTabSurface("telnet")}
@@ -822,7 +826,7 @@ export function HostItem({
</DropdownMenuItem>
),
)}
{host.enableRdp && (
{host.enableRdp && isTabTypeAvailable("rdp") && (
<DropdownMenuItem
onClick={(e) => {
e.stopPropagation();
@@ -833,7 +837,7 @@ export function HostItem({
{t("hosts.connectRdp")}
</DropdownMenuItem>
)}
{host.enableVnc && (
{host.enableVnc && isTabTypeAvailable("vnc") && (
<DropdownMenuItem
onClick={(e) => {
e.stopPropagation();
@@ -844,7 +848,7 @@ export function HostItem({
{t("hosts.connectVnc")}
</DropdownMenuItem>
)}
{host.enableTelnet && (
{host.enableTelnet && isTabTypeAvailable("telnet") && (
<DropdownMenuItem
onClick={(e) => {
e.stopPropagation();
@@ -1055,7 +1059,7 @@ export function HostItem({
{t("hosts.copyTmuxMonitorUrlAction")}
</DropdownMenuItem>
)}
{host.enableRdp && (
{host.enableRdp && isTabTypeAvailable("rdp") && (
<DropdownMenuItem
onClick={(e) => {
e.stopPropagation();
@@ -1069,7 +1073,7 @@ export function HostItem({
{t("hosts.copyRdpUrlAction")}
</DropdownMenuItem>
)}
{host.enableVnc && (
{host.enableVnc && isTabTypeAvailable("vnc") && (
<DropdownMenuItem
onClick={(e) => {
e.stopPropagation();
@@ -1083,7 +1087,7 @@ export function HostItem({
{t("hosts.copyVncUrlAction")}
</DropdownMenuItem>
)}
{host.enableTelnet && (
{host.enableTelnet && isTabTypeAvailable("telnet") && (
<DropdownMenuItem
onClick={(e) => {
e.stopPropagation();
@@ -29,12 +29,12 @@ describe("ConnectionScreen", () => {
render(
<ConnectionScreen
status="disconnected"
message="guacamole.hostNotFound"
message="remoteDesktop.hostNotFound"
/>,
),
).not.toThrow();
expect(screen.getByText("guacamole.hostNotFound")).toBeTruthy();
expect(screen.getByText("remoteDesktop.hostNotFound")).toBeTruthy();
expect(screen.getByRole("status").getAttribute("data-status")).toBe(
"disconnected",
);
@@ -38,9 +38,12 @@ vi.mock("@xterm/addon-fit", () => ({
},
}));
vi.mock("@/features/guacamole/GuacamoleDisplay.tsx", () => ({
GuacamoleDisplay: () => <div data-testid="guacamole-display" />,
}));
vi.mock(
"../../../../../plugins/remote-desktop/frontend/GuacamoleDisplay.tsx",
() => ({
GuacamoleDisplay: () => <div data-testid="guacamole-display" />,
}),
);
import SharedSessionView from "../../../features/session-sharing/SharedSessionView";
+65
View File
@@ -67,6 +67,38 @@ function aiPlugin(overrides: Partial<PluginSummary> = {}): PluginSummary {
});
}
function remoteDesktopPlugin(
overrides: Partial<PluginSummary> = {},
): PluginSummary {
return plugin({
id: "remote-desktop",
name: "Remote Desktop",
contributes: {
tabs: [
{
id: "rdp",
titleKey: "hosts.tabRdp",
icon: "Monitor",
openFrom: ["host-context-menu", "palette"],
},
{
id: "vnc",
titleKey: "hosts.tabVnc",
icon: "MousePointerClick",
openFrom: ["host-context-menu", "palette"],
},
{
id: "telnet",
titleKey: "hosts.tabTelnet",
icon: "Terminal",
openFrom: ["host-context-menu", "palette"],
},
],
},
...overrides,
});
}
describe("plugin state applied to the shell", () => {
afterEach(() => {
resetPluginState();
@@ -181,6 +213,39 @@ describe("plugin state applied to the shell", () => {
expect(isTabTypeAvailable("terminal")).toBe(true);
});
it("allows rdp/vnc/telnet tabs while remote-desktop is enabled", () => {
applyPluginState([remoteDesktopPlugin({ enabled: true })]);
expect(isTabTypeAvailable("rdp")).toBe(true);
expect(isTabTypeAvailable("vnc")).toBe(true);
expect(isTabTypeAvailable("telnet")).toBe(true);
});
it("blocks rdp/vnc/telnet tabs when remote-desktop is disabled", () => {
applyPluginState([remoteDesktopPlugin({ enabled: false })]);
expect(isTabTypeAvailable("rdp")).toBe(false);
expect(isTabTypeAvailable("vnc")).toBe(false);
expect(isTabTypeAvailable("telnet")).toBe(false);
});
it("allows rdp/vnc/telnet tabs again when remote-desktop is re-enabled", () => {
applyPluginState([remoteDesktopPlugin({ enabled: false })]);
expect(isTabTypeAvailable("rdp")).toBe(false);
applyPluginState([remoteDesktopPlugin({ enabled: true })]);
expect(isTabTypeAvailable("rdp")).toBe(true);
expect(isTabTypeAvailable("vnc")).toBe(true);
expect(isTabTypeAvailable("telnet")).toBe(true);
});
it("disabling remote-desktop does not affect the terminal, and vice versa", () => {
applyPluginState([
remoteDesktopPlugin({ enabled: false }),
plugin({ enabled: true }),
]);
expect(isTabTypeAvailable("rdp")).toBe(false);
expect(isTabTypeAvailable("terminal")).toBe(true);
});
it("reports enablement, defaulting to true before the first load", () => {
expect(isPluginEnabled("ssh-terminal")).toBe(true);