Fix container detail terminal isolation and working directory

This commit is contained in:
KodekaTeam committed 2026-06-19 00:27:47 +07:00
1 parent 30e1c5e934
commit 58bc5d2547
6 files changed
+109 -37

No files matched your search

@@ -8,10 +8,15 @@ export interface TerminalSocketTicket {
organizationId?: string;
serverId: string;
sessionId?: string;
target?: TerminalSocketTarget;
createdAt: number;
expiresAt: number;
}
export type TerminalSocketTarget =
| { type: "shell" }
| { type: "command"; command: string };
const terminalSocketTickets = new Map<string, TerminalSocketTicket>();
function pruneExpiredTerminalSocketTickets(now = Date.now()) {
@@ -27,6 +32,7 @@ export function issueTerminalSocketTicket(input: {
organizationId?: string;
serverId: string;
sessionId?: string;
target?: TerminalSocketTarget;
}): TerminalSocketTicket {
const now = Date.now();
pruneExpiredTerminalSocketTickets(now);
@@ -37,6 +43,7 @@ export function issueTerminalSocketTicket(input: {
organizationId: input.organizationId,
serverId: input.serverId,
sessionId: input.sessionId,
target: input.target,
createdAt: now,
expiresAt: now + TERMINAL_SOCKET_TICKET_TTL_MS,
};
@@ -77,4 +84,4 @@ export function consumeTerminalSocketTicket(input: {
}
return ticket;
}
}