feat(remote): 实现文件上传真实进度显示
- 使用分块上传替代一次性上传 - 调用 /upload/start → /upload/chunk → /upload/merge 接口 - 通过 IPC 事件实时推送上传进度到前端 - 修复 merge 时未使用目标路径的问题
This commit is contained in:
@@ -24,14 +24,19 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
ipcRenderer.on('download-progress', handler);
|
||||
return () => ipcRenderer.removeListener('download-progress', handler);
|
||||
},
|
||||
onUploadProgress: (callback: (data: { progress: number; id: string }) => void) => {
|
||||
const handler = (_event: Electron.IpcRendererEvent, data: { progress: number; id: string }) => callback(data);
|
||||
ipcRenderer.on('upload-progress', handler);
|
||||
return () => ipcRenderer.removeListener('upload-progress', handler);
|
||||
},
|
||||
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),
|
||||
remoteUploadFile: (id: string, serverHost: string, port: number, filePath: string, remotePath: string, password?: string) =>
|
||||
ipcRenderer.invoke('remote-upload-file', id, serverHost, port, filePath, remotePath, password),
|
||||
remoteDownloadFile: (id: string, serverHost: string, port: number, fileName: string, remotePath: string, localPath: string, password?: string) =>
|
||||
ipcRenderer.invoke('remote-download-file', id, serverHost, port, fileName, remotePath, localPath, password),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user