mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 07:05:24 +00:00
feat: harden plugin api for separate repos, signed updates and generic external login
This commit is contained in:
1 parent
fb9c168b6b
commit
80944301dd
310 files changed
+6577
-4927
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { getErrorMessage } from "../lib/error-message.js";
|
||||
import { usePluginStore } from "@/plugin-host/plugin-store";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Download, Search } from "lucide-react";
|
||||
@@ -17,6 +18,7 @@ import { exportAllSSHHosts, type SSHHostWithStatus } from "@/main-axios";
|
||||
import { isFolder } from "@/sidebar/SidebarTree";
|
||||
import {
|
||||
buildExportPayload,
|
||||
pluginSecretKeys,
|
||||
hostKey,
|
||||
maskSecrets,
|
||||
type ExportPayload,
|
||||
@@ -135,6 +137,15 @@ export function HostExportDialog({
|
||||
};
|
||||
}, [open, withCredentials, t]);
|
||||
|
||||
const { records: pluginRecords } = usePluginStore();
|
||||
const pluginSecrets = useMemo(
|
||||
() =>
|
||||
pluginSecretKeys(
|
||||
[...pluginRecords.values()].map((record) => record.summary),
|
||||
),
|
||||
[pluginRecords],
|
||||
);
|
||||
|
||||
const payload = useMemo(() => {
|
||||
if (!raw) return null;
|
||||
return buildExportPayload(
|
||||
@@ -142,12 +153,13 @@ export function HostExportDialog({
|
||||
scope === "all" ? null : selectedKeys,
|
||||
groups,
|
||||
withCredentials,
|
||||
pluginSecrets,
|
||||
);
|
||||
}, [raw, scope, selectedKeys, groups, withCredentials]);
|
||||
}, [raw, scope, selectedKeys, groups, withCredentials, pluginSecrets]);
|
||||
|
||||
const preview = useMemo(() => {
|
||||
if (!payload) return "";
|
||||
const masked = maskSecrets(payload);
|
||||
const masked = maskSecrets(payload, pluginSecrets);
|
||||
if (masked.hosts.length <= PREVIEW_HOST_LIMIT) {
|
||||
return JSON.stringify(masked, null, 2);
|
||||
}
|
||||
@@ -163,7 +175,7 @@ export function HostExportDialog({
|
||||
count: payload.hosts.length - PREVIEW_HOST_LIMIT,
|
||||
})
|
||||
);
|
||||
}, [payload, t]);
|
||||
}, [payload, pluginSecrets, t]);
|
||||
|
||||
function toggleGroup(group: FieldGroup) {
|
||||
setGroups((prev) => {
|
||||
|
||||
Reference in new issue
Block a user