webssh2-frontend
Version:
WebSSH2 前端终端库 - 可与任何后端集成
86 lines (85 loc) • 1.74 kB
TypeScript
export interface WebSSHClientConfig {
socketUrl: string;
socketPath?: string;
host: string;
port?: number;
username: string;
password?: string;
privateKey?: string;
onConnected?: () => void;
onDisconnected?: () => void;
onError?: (error: string) => void;
}
export declare class WebSSHClient {
private terminal;
private fitAddon;
private socket;
private container;
private config;
private sessionLogEnable;
private loggedData;
private allowreplay;
private allowreauth;
private sessionLog;
private sessionFooter;
private errorExists;
private logBtn;
private credentialsBtn;
private reauthBtn;
private downloadLogBtn;
private status;
private header;
private footer;
private countdown;
private terminalContainer;
constructor(container: HTMLElement | string, config: WebSSHClientConfig);
/**
* 设置完整的WebSSH界面
*/
private setupUI;
/**
* 获取DOM元素引用
*/
private getDOMElements;
/**
* 添加完整的WebSSH样式
*/
private addStyles;
/**
* 初始化终端
*/
private initTerminal;
/**
* 绑定事件
*/
private bindEvents;
/**
* 连接到SSH服务器
*/
connect(): void;
/**
* 设置Socket事件处理
*/
private setupSocketEvents;
/**
* 调整屏幕大小
*/
private resizeScreen;
/**
* 切换日志记录
*/
private toggleLog;
/**
* 下载日志
*/
private downloadLog;
/**
* 断开连接
*/
disconnect(): void;
/**
* 销毁组件
*/
destroy(): void;
}
export default WebSSHClient;