Console Improvements (#767)

This commit is contained in:
Louis Lam
2025-03-30 07:14:33 +08:00
committed by GitHub
parent c62b91682e
commit 0ceb6336dd
10 changed files with 56 additions and 53 deletions

View File

@@ -38,6 +38,11 @@ export class TerminalSocketHandler extends AgentSocketHandler {
try {
checkLogin(socket);
// Throw an error if console is not enabled
if (!server.config.enableConsole) {
throw new ValidationError("Console is not enabled.");
}
// TODO: Reset the name here, force one main terminal for now
terminalName = "console";
@@ -66,6 +71,18 @@ export class TerminalSocketHandler extends AgentSocketHandler {
}
});
// Check if MainTerminal is enabled
agentSocket.on("checkMainTerminal", async (callback) => {
try {
checkLogin(socket);
callbackResult({
ok: server.config.enableConsole,
}, callback);
} catch (e) {
callbackError(e, callback);
}
});
// Interactive Terminal for containers
agentSocket.on("interactiveTerminal", async (stackName : unknown, serviceName : unknown, shell : unknown, callback) => {
try {