UNPKG

@seasongold4/webssh2-frontend-fixed

Version:

WebSSH2 前端终端库 - 修复版本,完全兼容原项目后端,解决终端显示乱码问题

84 lines (83 loc) 1.79 kB
export interface WebSSHConfig { socketUrl?: string; socketPath?: string; namespace?: string; host: string; port?: number; username: string; password?: string; privateKey?: string; terminal?: { theme?: any; fontSize?: number; fontFamily?: string; cursorBlink?: boolean; scrollback?: number; cols?: number; rows?: number; }; ui?: { headerText?: string; headerBackground?: string; showReconnectButton?: boolean; }; onConnected?: () => void; onDisconnected?: () => void; onError?: (error: string) => void; onData?: (data: string) => void; } export declare class WebSSHTerminal { private terminal; private fitAddon; private socket; private container; private config; private isConnected; constructor(container: HTMLElement | string, config: WebSSHConfig); /** * 初始化终端 */ private initTerminal; /** * 设置UI界面 */ private setupUI; /** * 添加样式 */ private addStyles; /** * 连接到SSH服务器 */ connect(): void; /** * 设置Socket事件 */ private setupSocketEvents; /** * 更新连接状态 */ private updateConnectionStatus; /** * 断开连接 */ disconnect(): void; /** * 发送数据到终端 */ sendData(data: string): void; /** * 调整终端大小 */ resize(): void; /** * 清空终端 */ clear(): void; /** * 销毁终端 */ destroy(): void; } export declare function createWebSSHTerminal(container: HTMLElement | string, config: WebSSHConfig): WebSSHTerminal; export default WebSSHTerminal;