mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-18 05:43:38 +00:00
* fix(vault): round-trip jump host chains in CSV import/export CSV export dropped hostChain, so a vault imported on another machine lost every jump host. Persist the ordered chain as an OpenSSH ProxyJump column and bind each hop on import. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(vault): drop inline hops from a rejected ProxyJump chain A self-referential ProxyJump list created unresolved hops before the chain was skipped, so the import kept those hosts. Discard inline hosts created for that rejected chain. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(vault): prefer a same-group hop when binding CSV ProxyJump When an imported host and an existing vault host both match a hop endpoint, pick the candidate in the target host's group before falling back to the imported match. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(vault): prefer a same-group label when binding CSV ProxyJump Combine imported and existing label matches before pickCsvJumpCandidate so a cross-group imported label cannot beat an existing hop in the target group. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(vault): reject CSV ProxyJump chains that contain a malformed hop A multi-hop ProxyJump cell with any invalid hop now warns and leaves the host chain unset, instead of saving the valid hops as a shortened route. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com>
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
/// <reference lib="webworker" />
|
|
|
|
import { importVaultHostFiles } from "../services/vaultImportBatch";
|
|
import type {
|
|
VaultImportWorkerRequest,
|
|
VaultImportWorkerResponse,
|
|
} from "../services/vaultImportWorkerClient";
|
|
|
|
const workerScope: DedicatedWorkerGlobalScope = self as unknown as DedicatedWorkerGlobalScope;
|
|
|
|
const post = (message: VaultImportWorkerResponse) => {
|
|
workerScope.postMessage(message);
|
|
};
|
|
|
|
workerScope.addEventListener("message", async (event: MessageEvent<VaultImportWorkerRequest>) => {
|
|
if (event.data.type !== "import") return;
|
|
|
|
try {
|
|
post({ type: "progress", progress: { stage: "reading", percent: 10 } });
|
|
const result = await importVaultHostFiles({
|
|
format: event.data.format,
|
|
files: event.data.files,
|
|
relativePaths: event.data.relativePaths,
|
|
encoding: event.data.encoding,
|
|
masterPassword: event.data.masterPassword,
|
|
existingHosts: event.data.existingHosts,
|
|
onProgress: ({ completedFiles, totalFiles, fileName }) => {
|
|
post({
|
|
type: "progress",
|
|
progress: {
|
|
stage: "parsing",
|
|
percent: 10 + Math.round((completedFiles / Math.max(1, totalFiles)) * 50),
|
|
completedFiles,
|
|
totalFiles,
|
|
currentFileName: fileName,
|
|
},
|
|
});
|
|
},
|
|
});
|
|
post({ type: "result", result });
|
|
} catch (error) {
|
|
post({
|
|
type: "error",
|
|
message: error instanceof Error ? error.message : "Vault import failed.",
|
|
});
|
|
}
|
|
});
|