核心功能: - SSH终端: 密码/密钥认证、XTerm.js终端、多主题配色、IP高亮 - SFTP管理: 双栏文件管理、上传下载、传输队列 - 端口转发: 本地/远程转发、SOCKS5动态代理、规则管理 架构改进: - 拆分大型组件 (SFTPView/TabBar/Sidebar) - 添加统一日志和错误处理 - 修复React严格模式下的终端黑屏问题 UI更新: - 新增端口转发视图 - 更新UI预览文档 - 左侧栏右键菜单支持SFTP快捷打开
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
/**
|
|
* Dialog IPC Handlers
|
|
* 处理系统对话框
|
|
*/
|
|
|
|
import { ipcMain, IpcMainInvokeEvent, dialog } from 'electron'
|
|
|
|
// IPC channel names
|
|
export const DIALOG_CHANNELS = {
|
|
SHOW_SAVE: 'dialog:showSaveDialog',
|
|
SHOW_OPEN: 'dialog:showOpenDialog',
|
|
} as const
|
|
|
|
export interface DialogIPCOptions {
|
|
mainWindowGetter: () => Electron.BrowserWindow | null
|
|
}
|
|
|
|
export function registerDialogIPCHandlers(options: DialogIPCOptions): void {
|
|
const { mainWindowGetter } = options
|
|
|
|
// Show save dialog
|
|
ipcMain.handle(DIALOG_CHANNELS.SHOW_SAVE, async (_event: IpcMainInvokeEvent, options: Electron.SaveDialogOptions) => {
|
|
const mainWindow = mainWindowGetter()
|
|
if (!mainWindow) {
|
|
return { canceled: true }
|
|
}
|
|
return dialog.showSaveDialog(mainWindow, options)
|
|
})
|
|
|
|
// Show open dialog
|
|
ipcMain.handle(DIALOG_CHANNELS.SHOW_OPEN, async (_event: IpcMainInvokeEvent, options: Electron.OpenDialogOptions) => {
|
|
const mainWindow = mainWindowGetter()
|
|
if (!mainWindow) {
|
|
return { canceled: true }
|
|
}
|
|
return dialog.showOpenDialog(mainWindow, options)
|
|
})
|
|
}
|