mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 22:25:24 +00:00
fix: finish 2.9.0 plugin moves and get every check green
This commit is contained in:
1 parent
8c1e02af89
commit
6489b62ece
335 files changed
+29878
-17749
No files matched your search
@@ -4,7 +4,10 @@ import type {
|
||||
PluginManifest,
|
||||
TermixApp,
|
||||
} from "@termix/plugin-sdk/frontend";
|
||||
import type { PluginContributions } from "@/api/plugins-api";
|
||||
import {
|
||||
PLUGIN_SETTINGS_CHANGED_EVENT,
|
||||
type PluginContributions,
|
||||
} from "@/api/plugins-api";
|
||||
import { registerRailItem } from "@/sidebar/rail-items";
|
||||
import { registerTabType, type TabRenderProps } from "@/shell/tab-registry";
|
||||
import { registerPanel, type PanelRenderProps } from "@/shell/panel-registry";
|
||||
@@ -415,6 +418,22 @@ export function createPluginApp(
|
||||
onRemoteServerChange: (listener) => track(onRemoteServerChange(listener)),
|
||||
},
|
||||
|
||||
onSettingsChanged: (listener) => {
|
||||
const handler = (event: Event) => {
|
||||
const detail = (event as CustomEvent).detail as {
|
||||
pluginId?: string;
|
||||
scope: "admin" | "user" | "host";
|
||||
hostId?: number;
|
||||
};
|
||||
if (detail?.pluginId !== pluginId) return;
|
||||
listener({ scope: detail.scope, hostId: detail.hostId });
|
||||
};
|
||||
window.addEventListener(PLUGIN_SETTINGS_CHANGED_EVENT, handler);
|
||||
return track(() =>
|
||||
window.removeEventListener(PLUGIN_SETTINGS_CHANGED_EVENT, handler),
|
||||
);
|
||||
},
|
||||
|
||||
onDispose(dispose) {
|
||||
if (disposed) {
|
||||
dispose();
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
} from "@termix/plugin-sdk/frontend";
|
||||
import { usePermissions } from "@/hooks/use-permissions";
|
||||
import { useTheme } from "@/components/theme-provider";
|
||||
import { createPluginApi } from "@/lib/plugin-transport";
|
||||
import { createPluginApi, pluginApiFor } from "@/lib/plugin-transport";
|
||||
import {
|
||||
getPluginAdminSettings,
|
||||
getPluginHostSettings,
|
||||
@@ -28,9 +28,19 @@ import {
|
||||
updatePluginHostSettings,
|
||||
updatePluginUserSettings,
|
||||
} from "@/api/plugins-api";
|
||||
import { getUserInfo } from "@/main-axios";
|
||||
import { getCookie, getUserInfo } from "@/main-axios";
|
||||
import { logActivity } from "@/api/dashboard-api";
|
||||
import { getHostPassword } from "@/api/credentials-api";
|
||||
import {
|
||||
getUserPreferences,
|
||||
parseCustomKeybindings,
|
||||
patchOpenTab,
|
||||
} from "@/api/open-tabs-api";
|
||||
import { setHostAutoTmux } from "@/api/host-terminal-config-api";
|
||||
import { usePluginScope } from "./scope";
|
||||
import { knownPluginIds } from "./plugin-store";
|
||||
import { knownPluginIds, usePluginStore } from "./plugin-store";
|
||||
import { useUiPreferencesContext } from "@/contexts/UiPreferencesContext";
|
||||
import type { UiPluginPresets } from "@/types/ui-preferences";
|
||||
import { tabsApi, useShellHosts } from "./shell-bridge";
|
||||
import { invokeAction } from "@/shell/action-registry";
|
||||
import { useSshAuthProviders } from "@/hooks/useSshAuthProviders";
|
||||
@@ -262,6 +272,12 @@ export const pluginHostBridge: PluginHostBridge = {
|
||||
},
|
||||
|
||||
getApi: (pluginId) => getApi(pluginId),
|
||||
getApiFor: (pluginId, origin) =>
|
||||
pluginApiFor(
|
||||
pluginId,
|
||||
origin as "local" | "remote" | undefined,
|
||||
getApi(pluginId) as never,
|
||||
) as never,
|
||||
|
||||
useTabs: () => tabsApi,
|
||||
|
||||
@@ -307,7 +323,7 @@ export const pluginHostBridge: PluginHostBridge = {
|
||||
|
||||
useActivityTypes: () => {
|
||||
const defs = useTabTypes();
|
||||
const types = new Set(["file_manager"]);
|
||||
const types = new Set<string>();
|
||||
for (const def of defs) {
|
||||
for (const type of def.activityTypes ?? []) types.add(type);
|
||||
}
|
||||
@@ -325,6 +341,33 @@ export const pluginHostBridge: PluginHostBridge = {
|
||||
homepageWidgetType: (id) =>
|
||||
getHomepageWidgetType(id) as unknown as
|
||||
HomepageWidgetContribution | undefined,
|
||||
|
||||
usePluginUiPreferences: (pluginId) => {
|
||||
const ctx = useUiPreferencesContext();
|
||||
const store = usePluginStore();
|
||||
const presets = store.records.get(pluginId)?.summary.contributes
|
||||
?.uiPresets as UiPluginPresets | undefined;
|
||||
const values = ctx
|
||||
? ctx.resolvePlugin(pluginId, presets)
|
||||
: { ...(presets?.balanced ?? {}) };
|
||||
return {
|
||||
values,
|
||||
set: (key, value) => ctx?.setPluginOverride(pluginId, key, value),
|
||||
};
|
||||
},
|
||||
|
||||
core: {
|
||||
logActivity: async (type, hostId, hostName) => {
|
||||
await logActivity(type, hostId, hostName);
|
||||
},
|
||||
getHostPassword: async (hostId, field) =>
|
||||
(await getHostPassword(hostId, field)) ?? null,
|
||||
patchOpenTab: (instanceId, updates) => patchOpenTab(instanceId, updates),
|
||||
getCustomKeybindings: async () =>
|
||||
parseCustomKeybindings((await getUserPreferences()).customKeybindings),
|
||||
setHostAutoTmux: (hostId, autoTmux) => setHostAutoTmux(hostId, autoTmux),
|
||||
getClientPreference: (name) => getCookie(name),
|
||||
},
|
||||
};
|
||||
|
||||
/** Installs the bridge. Idempotent. */
|
||||
|
||||
@@ -83,13 +83,14 @@ export {
|
||||
getPollingEnvironmentMultiplier,
|
||||
} from "@/lib/adaptive-polling";
|
||||
export * from "@/components/sheet";
|
||||
// The frame and filter box every host manager card uses.
|
||||
export {
|
||||
ManagerCardShell,
|
||||
ManagerSearch,
|
||||
type ManagerCardError,
|
||||
} from "@/components/manager-card";
|
||||
export { useConfirmation } from "@/hooks/use-confirmation";
|
||||
export { useAdaptivePolling } from "@/hooks/use-adaptive-polling";
|
||||
// Per-area display density and chart options the user picked in Appearance.
|
||||
export {
|
||||
useAreaPreferences,
|
||||
useUiPreferencesContext,
|
||||
} from "@/contexts/UiPreferencesContext";
|
||||
// Homepage widget pieces, for plugins that register a widget.
|
||||
export { WidgetTitle } from "@/lib/widget-title";
|
||||
export { runVisibleInterval } from "@/lib/visible-interval";
|
||||
@@ -134,12 +135,10 @@ export {
|
||||
} from "@/lib/remote-server-api";
|
||||
export { useConnectionDefaults } from "@/contexts/ConnectionDefaultsContext";
|
||||
|
||||
// Core APIs a terminal-like surface calls: recent activity, the host's stored
|
||||
// password for sudo autofill, the open tab record, the user's keybindings and
|
||||
// host terminal options.
|
||||
export { getCookie } from "@/main-axios";
|
||||
// Dashboard reads. The calls a plugin makes on the user's behalf (recent
|
||||
// activity, sudo autofill, open tabs, keybindings, auto tmux) are typed in
|
||||
// @termix/plugin-sdk/frontend instead.
|
||||
export {
|
||||
logActivity,
|
||||
getRecentActivity,
|
||||
getUptime,
|
||||
type RecentActivityItem,
|
||||
@@ -150,13 +149,6 @@ export {
|
||||
getDatabaseHealth,
|
||||
type VersionInfo,
|
||||
} from "@/api/system-status-api";
|
||||
export { getHostPassword } from "@/api/credentials-api";
|
||||
export {
|
||||
patchOpenTab,
|
||||
getUserPreferences,
|
||||
parseCustomKeybindings,
|
||||
} from "@/api/open-tabs-api";
|
||||
export { setHostAutoTmux } from "@/api/host-terminal-config-api";
|
||||
|
||||
// Notification channels are core (ctx.notify on the backend). A plugin that
|
||||
// lets users pick or manage them shows core's own dialog.
|
||||
|
||||
Reference in new issue
Block a user