feat(initialization): 添加初始化页面和相关功能

- 新增初始化页面组件和路由
- 实现环境检查、Git下载、后端代码克隆等功能
- 添加下载服务和环境服务模块
- 更新类型定义,增加 Electron API 接口
This commit is contained in:
2025-08-07 00:11:29 +08:00
parent 18202045bf
commit ae151a9311
20 changed files with 2777 additions and 490 deletions

View File

@@ -8,5 +8,22 @@ window.addEventListener('DOMContentLoaded', () => {
contextBridge.exposeInMainWorld('electronAPI', {
openDevTools: () => ipcRenderer.invoke('open-dev-tools'),
selectFolder: () => ipcRenderer.invoke('select-folder'),
selectFile: (filters?: any[]) => ipcRenderer.invoke('select-file', filters)
selectFile: (filters?: any[]) => ipcRenderer.invoke('select-file', filters),
// 初始化相关API
checkEnvironment: () => ipcRenderer.invoke('check-environment'),
downloadPython: (mirror?: string) => ipcRenderer.invoke('download-python', mirror),
downloadGit: () => ipcRenderer.invoke('download-git'),
installDependencies: (mirror?: string) => ipcRenderer.invoke('install-dependencies', mirror),
cloneBackend: (repoUrl?: string) => ipcRenderer.invoke('clone-backend', repoUrl),
updateBackend: (repoUrl?: string) => ipcRenderer.invoke('update-backend', repoUrl),
startBackend: () => ipcRenderer.invoke('start-backend'),
// 监听下载进度
onDownloadProgress: (callback: (progress: any) => void) => {
ipcRenderer.on('download-progress', (_, progress) => callback(progress))
},
removeDownloadProgressListener: () => {
ipcRenderer.removeAllListeners('download-progress')
}
})