Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(electron): address auto-updater review issues

benzntechc11c275678c8
diff --git a/electron/main.js b/electron/main.js
index 0f6b1f6d0c..ad05633ec8 100644
--- a/electron/main.js
+++ b/electron/main.js
@@ -26,7 +26,6 @@ const {
nativeImage,
shell,
session,
- dialog,
Notification,
} = require("electron");
const path = require("path");
@@ -167,26 +166,18 @@ async function checkForUpdates(silent = false) {
}
return;
}
- try {
- await autoUpdater.checkForUpdates();
- } catch (error) {
- console.error("[Electron] Check for updates failed:", error);
- if (!silent) {
- sendToRenderer("update-status", { status: "error", message: error.message });
- }
- }
+ await autoUpdater.checkForUpdates();
}
async function downloadUpdate() {
- try {
- await autoUpdater.downloadUpdate();
- } catch (error) {
- console.error("[Electron] Download update failed:", error);
- sendToRenderer("update-status", { status: "error", message: error.message });
- }
+ await autoUpdater.downloadUpdate();
}
function installUpdate() {
+ if (nextServer) {
+ nextServer.kill("SIGTERM");
+ nextServer = null;
+ }
autoUpdater.quitAndInstall();
}
@@ -486,18 +477,30 @@ function setupIpcHandlers() {
// Auto-update IPC handlers
ipcMain.handle("check-for-updates", async () => {
- await checkForUpdates(false);
- return { success: true };
+ try {
+ await checkForUpdates(false);
+ return { success: true };
+ } catch (error) {
+ console.error("[Electron] Check for updates failed:", error);
+ sendToRenderer("update-status", { status: "error", message: error.message });
+ return { success: false, error: error.message };
+ }
});
ipcMain.handle("download-update", async () => {
- await downloadUpdate();
- return { success: true };
+ try {
+ await downloadUpdate();
+ return { success: true };
+ } catch (error) {
+ console.error("[Electron] Download update failed:", error);
+ sendToRenderer("update-status", { status: "error", message: error.message });
+ return { success: false, error: error.message };
+ }
});
ipcMain.handle("install-update", () => {
installUpdate();
- return { success: true };
+ // No return value — app will quit and restart
});
ipcMain.handle("get-app-version", () => app.getVersion());