fix: split provider ssh tty modes
This commit is contained in:
@@ -1097,7 +1097,7 @@ function numberFromUnknown(value: unknown, fallback: number, min: number, max: n
|
||||
|
||||
async function handleSshClientMessage(ws: ProviderSocket, raw: string | Buffer): Promise<void> {
|
||||
const text = typeof raw === "string" ? raw : raw.toString("utf8");
|
||||
const message = JSON.parse(text) as { type?: unknown; providerId?: unknown; cwd?: unknown; command?: unknown; data?: unknown; encoding?: unknown; cols?: unknown; rows?: unknown };
|
||||
const message = JSON.parse(text) as { type?: unknown; providerId?: unknown; cwd?: unknown; command?: unknown; tty?: unknown; data?: unknown; encoding?: unknown; cols?: unknown; rows?: unknown };
|
||||
if (message.type === "ssh.open") {
|
||||
const providerId = typeof message.providerId === "string" ? message.providerId : "";
|
||||
if (providerId.length === 0) {
|
||||
@@ -1126,6 +1126,7 @@ async function handleSshClientMessage(ws: ProviderSocket, raw: string | Buffer):
|
||||
};
|
||||
if (typeof message.cwd === "string" && message.cwd.length > 0) openMessage.cwd = message.cwd;
|
||||
if (typeof message.command === "string" && message.command.length > 0) openMessage.command = message.command;
|
||||
if (typeof message.tty === "boolean") openMessage.tty = message.tty;
|
||||
provider.send(JSON.stringify(openMessage));
|
||||
wsSendJson(ws, { type: "ssh.dispatched", providerId, sessionId });
|
||||
logger("info", "ssh_session_dispatched", { providerId, sessionId, hasCommand: typeof openMessage.command === "string" });
|
||||
|
||||
Reference in New Issue
Block a user