feat(remote): 文件传输改用Electron IPC通道

- 主进程新增4个IPC handler处理远程文件操作
- 前端通过IPC调用而非浏览器fetch访问远程API
- Remote服务新增3003端口专门处理文件传输
- 上传使用文件路径方案,下载使用保存对话框方案
This commit is contained in:
2026-03-10 00:34:02 +08:00
parent 788757b785
commit 6d5520dfa5
7 changed files with 221 additions and 98 deletions

View File

@@ -21,4 +21,12 @@ contextBridge.exposeInMainWorld('electronAPI', {
},
clipboardReadText: () => ipcRenderer.invoke('clipboard-read-text'),
clipboardWriteText: (text: string) => ipcRenderer.invoke('clipboard-write-text', text),
remoteFetchDrives: (serverHost: string, port: number, password?: string) =>
ipcRenderer.invoke('remote-fetch-drives', serverHost, port, password),
remoteFetchFiles: (serverHost: string, port: number, filePath: string, password?: string) =>
ipcRenderer.invoke('remote-fetch-files', serverHost, port, filePath, password),
remoteUploadFile: (serverHost: string, port: number, filePath: string, remotePath: string, password?: string) =>
ipcRenderer.invoke('remote-upload-file', serverHost, port, filePath, remotePath, password),
remoteDownloadFile: (serverHost: string, port: number, fileName: string, remotePath: string, password?: string) =>
ipcRenderer.invoke('remote-download-file', serverHost, port, fileName, remotePath, password),
})