修复缺失的 checkStatus IPC处理器

- 添加 checkStatus IPC handler 到主进程
- 实现基础的 API 连通性检查
- 修复 preload API 与主进程不匹配的问题
This commit is contained in:
farion1231
2025-08-06 07:41:43 +08:00
parent ca5035696f
commit ea2a86fe30

View File

@@ -114,4 +114,18 @@ ipcMain.handle('selectConfigFile', async () => {
}
return result.filePaths[0]
})
ipcMain.handle('checkStatus', async (_, provider: Provider) => {
// 简单的连通性检查 - 向API地址发送HEAD请求
try {
const response = await fetch(provider.apiUrl, {
method: 'HEAD',
timeout: 5000
})
return response.ok
} catch (error) {
console.error('检查供应商状态失败:', error)
return false
}
})