mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 12:01:13 +00:00
* feat(vault): 新增 FinalShell 主机导入功能 本次提交完整实现了 FinalShell 连接的导入支持,包括: 1. 新增导入格式检测与解析逻辑,支持解密 FinalShell 加密密码 2. 适配导入流程 UI,新增导入选项与批量目录导入支持 3. 补充多语言国际化文案与测试用例 4. 更新所有相关文档与配置文件 * fix(vault): align FinalShell import guards and agent guidance * fix(vault): detect FinalShell connections without usernames * fix(vault): keep password validation lint compliant * fix(ci): use archived Bullseye security packages for ARM builds * fix(vault): retain FinalShell profiles and accept BOM JSON * fix(ci): align archived security source with main --------- Co-authored-by: YS-zdck <admin@zdck8.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
73 lines
2.0 KiB
TypeScript
73 lines
2.0 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import {
|
|
buildVaultImportDestination,
|
|
getVaultImportPickerMode,
|
|
selectVaultImportFiles,
|
|
} from "./vaultImportSelection.ts";
|
|
|
|
test("SecureCRT uses a directory picker and keeps every selected session file", () => {
|
|
const files = [
|
|
new File(["one"], "one.ini"),
|
|
new File(["two"], "two.ini"),
|
|
];
|
|
|
|
assert.deepEqual(getVaultImportPickerMode("securecrt"), {
|
|
directory: true,
|
|
multiple: true,
|
|
});
|
|
assert.deepEqual(getVaultImportPickerMode("securecrt", "file"), {
|
|
directory: false,
|
|
multiple: false,
|
|
});
|
|
assert.deepEqual(selectVaultImportFiles("securecrt", files), files);
|
|
assert.deepEqual(selectVaultImportFiles("csv", files), [files[0]]);
|
|
});
|
|
|
|
test("FinalShell supports conn directory and single JSON file selection", () => {
|
|
const files = [
|
|
new File(["{}"], "one.json"),
|
|
new File(["{}"], "two.json"),
|
|
];
|
|
|
|
assert.deepEqual(getVaultImportPickerMode("finalshell"), {
|
|
directory: true,
|
|
multiple: true,
|
|
});
|
|
assert.deepEqual(getVaultImportPickerMode("finalshell", "file"), {
|
|
directory: false,
|
|
multiple: false,
|
|
});
|
|
assert.deepEqual(selectVaultImportFiles("finalshell", files), files);
|
|
});
|
|
|
|
test("vault import destination supports preserve, existing, and new groups", () => {
|
|
assert.deepEqual(buildVaultImportDestination({ mode: "preserve" }), {
|
|
mode: "preserve",
|
|
});
|
|
assert.deepEqual(buildVaultImportDestination({
|
|
mode: "existing",
|
|
existingGroup: "Production/Linux",
|
|
}), {
|
|
mode: "group",
|
|
group: "Production/Linux",
|
|
});
|
|
assert.deepEqual(buildVaultImportDestination({
|
|
mode: "new",
|
|
newGroup: " Imported / July ",
|
|
}), {
|
|
mode: "group",
|
|
group: "Imported/July",
|
|
});
|
|
assert.equal(buildVaultImportDestination({ mode: "new", newGroup: " " }), null);
|
|
});
|
|
|
|
test("vault import destination rejects an existing group that was deleted", () => {
|
|
assert.equal(buildVaultImportDestination({
|
|
mode: "existing",
|
|
existingGroup: "Deleted",
|
|
availableGroups: ["Production"],
|
|
}), null);
|
|
});
|