mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +00:00
Add a host and group toggle for bastions that allow one session channel per TCP connection. After the handshake, BHostSSH, TERM-SSHD, and CLOUDBILITY take that path automatically. File transfer uses a separate SFTP login, and the interactive terminal is not given another exec, SFTP, copy/split, or port-forward channel. The manual toggle remains for bastions that still advertise OpenSSH.
66 lines
1.8 KiB
TypeScript
66 lines
1.8 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { shouldProbeCommandCwd } from "./commandCwdProbe";
|
|
|
|
test("probes command cwd for session restore even when the SFTP panel is not visible", () => {
|
|
assert.equal(
|
|
shouldProbeCommandCwd({
|
|
restoreTerminalCwd: true,
|
|
visibleSftpHost: null,
|
|
sessionHost: { sftpFollowTerminalCwd: false },
|
|
globalSftpFollowTerminalCwd: false,
|
|
}),
|
|
true,
|
|
);
|
|
});
|
|
|
|
test("does not probe command cwd when neither session restore nor SFTP follow cwd needs it", () => {
|
|
assert.equal(
|
|
shouldProbeCommandCwd({
|
|
restoreTerminalCwd: false,
|
|
visibleSftpHost: null,
|
|
sessionHost: { sftpFollowTerminalCwd: true },
|
|
globalSftpFollowTerminalCwd: true,
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test("probes command cwd for visible SFTP follow cwd using host override", () => {
|
|
assert.equal(
|
|
shouldProbeCommandCwd({
|
|
restoreTerminalCwd: false,
|
|
visibleSftpHost: { sftpFollowTerminalCwd: true },
|
|
sessionHost: { sftpFollowTerminalCwd: false },
|
|
globalSftpFollowTerminalCwd: false,
|
|
}),
|
|
true,
|
|
);
|
|
});
|
|
|
|
test("visible SFTP host override can disable command cwd probing", () => {
|
|
assert.equal(
|
|
shouldProbeCommandCwd({
|
|
restoreTerminalCwd: false,
|
|
visibleSftpHost: { sftpFollowTerminalCwd: false },
|
|
sessionHost: { sftpFollowTerminalCwd: true },
|
|
globalSftpFollowTerminalCwd: true,
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test("does not probe command cwd on single-channel SSH hosts", () => {
|
|
assert.equal(
|
|
shouldProbeCommandCwd({
|
|
restoreTerminalCwd: true,
|
|
visibleSftpHost: { sftpFollowTerminalCwd: true },
|
|
sessionHost: { sftpFollowTerminalCwd: true },
|
|
globalSftpFollowTerminalCwd: true,
|
|
restrictExtraSshChannels: true,
|
|
}),
|
|
false,
|
|
);
|
|
});
|