feat: 补全终端交互逻辑.
This commit is contained in:
@@ -32,7 +32,7 @@ public enum InputTypeEnum {
|
||||
*/
|
||||
CONNECT("co",
|
||||
TerminalConnectHandler.class,
|
||||
new String[]{"type", "sessionId", "cols", "rows"},
|
||||
new String[]{"type", "sessionId", "terminalType", "cols", "rows"},
|
||||
TerminalConnectRequest.class),
|
||||
|
||||
/**
|
||||
|
||||
@@ -110,7 +110,7 @@ public class TerminalConnectHandler extends AbstractTerminalHandler<TerminalConn
|
||||
// 建立连接
|
||||
SessionStore sessionStore = hostTerminalService.openSessionStore(connect);
|
||||
terminalSession = new TerminalSession(sessionId, channel, sessionStore, config);
|
||||
terminalSession.connect(body.getCols(), body.getRows());
|
||||
terminalSession.connect(body.getTerminalType(), body.getCols(), body.getRows());
|
||||
log.info("TerminalConnectHandler-handle success sessionId: {}", sessionId);
|
||||
return terminalSession;
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -25,6 +25,9 @@ import lombok.experimental.SuperBuilder;
|
||||
@Schema(name = "TerminalConnectRequest", description = "终端连接请求 实体对象")
|
||||
public class TerminalConnectRequest extends TerminalBasePayload {
|
||||
|
||||
@Schema(description = "伪终端类型")
|
||||
private String terminalType;
|
||||
|
||||
@Schema(description = "列数")
|
||||
private Integer cols;
|
||||
|
||||
|
||||
@@ -14,10 +14,11 @@ public interface ITerminalSession extends SafeCloseable {
|
||||
/**
|
||||
* 连接
|
||||
*
|
||||
* @param cols cols
|
||||
* @param rows rows
|
||||
* @param terminalType terminalType
|
||||
* @param cols cols
|
||||
* @param rows rows
|
||||
*/
|
||||
void connect(int cols, int rows);
|
||||
void connect(String terminalType, int cols, int rows);
|
||||
|
||||
/**
|
||||
* 重置大小
|
||||
|
||||
@@ -61,14 +61,13 @@ public class TerminalSession implements ITerminalSession {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connect(int cols, int rows) {
|
||||
public void connect(String terminalType, int cols, int rows) {
|
||||
config.setCols(cols);
|
||||
config.setRows(rows);
|
||||
// 打开 shell
|
||||
this.executor = sessionStore.getShellExecutor();
|
||||
executor.size(cols, rows);
|
||||
// FIXME
|
||||
executor.terminalType(TerminalType.XTERM.getType());
|
||||
executor.terminalType(terminalType);
|
||||
executor.streamHandler(this::streamHandler);
|
||||
executor.callback(this::eofCallback);
|
||||
executor.connect();
|
||||
|
||||
Reference in New Issue
Block a user