mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 06:35: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
@@ -18,6 +18,7 @@ import {
|
||||
registerHostContextMenuItem,
|
||||
} from "@/sidebar/host-contributions";
|
||||
import { registerPaletteEntry } from "@/shell/palette-registry";
|
||||
import { registerHostProtocol } from "@/sidebar/host-protocols";
|
||||
import {
|
||||
registerDashboardCard,
|
||||
type DashboardCardRenderProps,
|
||||
@@ -30,7 +31,7 @@ import {
|
||||
registerAction,
|
||||
registerSlotContribution,
|
||||
} from "@/shell/action-registry";
|
||||
import { pluginWsUrl } from "@/lib/plugin-transport";
|
||||
import { pluginApiFor, pluginWsUrl } from "@/lib/plugin-transport";
|
||||
import { registerPluginComponent } from "./component-registry";
|
||||
import type { WidgetTypeDefinition } from "@/types/homepage-types";
|
||||
import type { LucideIcon } from "lucide-react";
|
||||
@@ -208,6 +209,19 @@ export function createPluginApp(
|
||||
);
|
||||
},
|
||||
|
||||
registerHostProtocol(protocol) {
|
||||
return track(
|
||||
registerHostProtocol({
|
||||
...protocol,
|
||||
pluginId,
|
||||
titleKey: key(protocol.titleKey),
|
||||
descriptionKey: protocol.descriptionKey
|
||||
? key(protocol.descriptionKey)
|
||||
: undefined,
|
||||
}),
|
||||
);
|
||||
},
|
||||
|
||||
registerHostBadge(badge) {
|
||||
return track(
|
||||
registerHostBadge({
|
||||
@@ -367,6 +381,12 @@ export function createPluginApp(
|
||||
}
|
||||
},
|
||||
api: pluginHostBridge.getApi(pluginId),
|
||||
apiFor: (origin) =>
|
||||
pluginApiFor(
|
||||
pluginId,
|
||||
origin as never,
|
||||
pluginHostBridge.getApi(pluginId) as never,
|
||||
) as unknown as TermixApp["api"],
|
||||
wsUrl: (path, options) =>
|
||||
pluginWsUrl(pluginId, path, options as never) as ReturnType<
|
||||
TermixApp["wsUrl"]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { enabledHostProtocols } from "@/sidebar/host-protocols";
|
||||
import { useTranslation as useI18nTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
import {
|
||||
@@ -275,6 +276,13 @@ export const pluginHostBridge: PluginHostBridge = {
|
||||
|
||||
useSlotContributions: (slotId, context) => useActionSlot(slotId, context),
|
||||
|
||||
hostProtocols: (record) => [
|
||||
...(record.enableSsh !== false ? ["ssh"] : []),
|
||||
...enabledHostProtocols(
|
||||
record as { pluginSettings?: Record<string, Record<string, unknown>> },
|
||||
).map((protocol) => protocol.id),
|
||||
],
|
||||
|
||||
usePluginComponent: (id) => usePluginComponent(id),
|
||||
};
|
||||
|
||||
|
||||
@@ -112,7 +112,16 @@ export {
|
||||
type ConnectionOrigin,
|
||||
} from "@/lib/connection-origin";
|
||||
export { pluginWsUrl } from "@/lib/plugin-transport";
|
||||
export { hydrateLocalSharedHostAuth } from "@/lib/remote-server-api";
|
||||
export {
|
||||
buildOriginWsUrl,
|
||||
type WebSocketConnectionTarget,
|
||||
} from "@/lib/connection-origin";
|
||||
export { getBasePath } from "@/lib/base-path";
|
||||
export type { ConnectionStage } from "@/types/connection-log";
|
||||
export {
|
||||
hydrateLocalSharedHostAuth,
|
||||
resolveRemoteHostId,
|
||||
} from "@/lib/remote-server-api";
|
||||
export { useConnectionDefaults } from "@/contexts/ConnectionDefaultsContext";
|
||||
|
||||
// Core APIs a terminal-like surface calls: recent activity, the host's stored
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
import { getPanel, listPanels } from "@/shell/panel-registry";
|
||||
import { listRegisteredRailItems } from "@/sidebar/rail-items";
|
||||
import { listHostActions } from "@/sidebar/host-contributions";
|
||||
import { listHostProtocols } from "@/sidebar/host-protocols";
|
||||
import {
|
||||
getHostEditorSection,
|
||||
hostEditorSectionList,
|
||||
@@ -207,6 +208,8 @@ export async function renderPlugin(
|
||||
id: action.id,
|
||||
tabType: action.tabType,
|
||||
})),
|
||||
hostProtocols: () =>
|
||||
mine(listHostProtocols()).map((protocol) => protocol.id),
|
||||
hostEditorSections: () =>
|
||||
mine(hostEditorSectionList()).map((section) => section.id),
|
||||
dashboardCards: () =>
|
||||
|
||||
Reference in new issue
Block a user