Spaces:
Paused
Paused
icebear icebear0828 commited on
fix: skip proxy update checker in Electron mode (#89)
Browse filesElectron has its own native auto-updater (electron-updater) that handles
download and install via system tray. The backend's startProxyUpdateChecker()
was also running, causing the web UI UpdateModal to pop up and conflict
with the native updater.
- Skip startProxyUpdateChecker() when deploy mode is "electron"
- Don't auto-open UpdateModal in Electron mode
Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com>
- src/index.ts +6 -3
- web/src/App.tsx +3 -2
src/index.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { ProxyPool } from "./proxy/proxy-pool.js";
|
|
| 19 |
import { createProxyRoutes } from "./routes/proxies.js";
|
| 20 |
import { createResponsesRoutes } from "./routes/responses.js";
|
| 21 |
import { startUpdateChecker, stopUpdateChecker } from "./update-checker.js";
|
| 22 |
-
import { startProxyUpdateChecker, stopProxyUpdateChecker, setCloseHandler } from "./self-update.js";
|
| 23 |
import { initProxy } from "./tls/curl-binary.js";
|
| 24 |
import { initTransport } from "./tls/transport.js";
|
| 25 |
import { loadStaticModels } from "./models/model-store.js";
|
|
@@ -116,9 +116,12 @@ export async function startServer(options?: StartOptions): Promise<ServerHandle>
|
|
| 116 |
}
|
| 117 |
console.log();
|
| 118 |
|
| 119 |
-
// Start background update
|
|
|
|
| 120 |
startUpdateChecker();
|
| 121 |
-
|
|
|
|
|
|
|
| 122 |
|
| 123 |
// Start background model refresh (requires auth to be ready)
|
| 124 |
startModelRefresh(accountPool, cookieJar, proxyPool);
|
|
|
|
| 19 |
import { createProxyRoutes } from "./routes/proxies.js";
|
| 20 |
import { createResponsesRoutes } from "./routes/responses.js";
|
| 21 |
import { startUpdateChecker, stopUpdateChecker } from "./update-checker.js";
|
| 22 |
+
import { startProxyUpdateChecker, stopProxyUpdateChecker, setCloseHandler, getDeployMode } from "./self-update.js";
|
| 23 |
import { initProxy } from "./tls/curl-binary.js";
|
| 24 |
import { initTransport } from "./tls/transport.js";
|
| 25 |
import { loadStaticModels } from "./models/model-store.js";
|
|
|
|
| 116 |
}
|
| 117 |
console.log();
|
| 118 |
|
| 119 |
+
// Start background update checkers
|
| 120 |
+
// (Electron has its own native auto-updater — skip proxy update checker)
|
| 121 |
startUpdateChecker();
|
| 122 |
+
if (getDeployMode() !== "electron") {
|
| 123 |
+
startProxyUpdateChecker();
|
| 124 |
+
}
|
| 125 |
|
| 126 |
// Start background model refresh (requires auth to be ready)
|
| 127 |
startModelRefresh(accountPool, cookieJar, proxyPool);
|
web/src/App.tsx
CHANGED
|
@@ -75,12 +75,13 @@ function Dashboard() {
|
|
| 75 |
const prevUpdateAvailable = useRef(false);
|
| 76 |
|
| 77 |
// Auto-open modal when update becomes available after a check
|
|
|
|
| 78 |
useEffect(() => {
|
| 79 |
-
if (update.hasUpdate && !prevUpdateAvailable.current) {
|
| 80 |
setShowModal(true);
|
| 81 |
}
|
| 82 |
prevUpdateAvailable.current = update.hasUpdate;
|
| 83 |
-
}, [update.hasUpdate]);
|
| 84 |
|
| 85 |
const handleProxyChange = async (accountId: string, proxyId: string) => {
|
| 86 |
accounts.patchLocal(accountId, { proxyId });
|
|
|
|
| 75 |
const prevUpdateAvailable = useRef(false);
|
| 76 |
|
| 77 |
// Auto-open modal when update becomes available after a check
|
| 78 |
+
// (Electron has its own native auto-updater — don't show web modal)
|
| 79 |
useEffect(() => {
|
| 80 |
+
if (update.hasUpdate && !prevUpdateAvailable.current && update.proxyUpdateInfo?.mode !== "electron") {
|
| 81 |
setShowModal(true);
|
| 82 |
}
|
| 83 |
prevUpdateAvailable.current = update.hasUpdate;
|
| 84 |
+
}, [update.hasUpdate, update.proxyUpdateInfo?.mode]);
|
| 85 |
|
| 86 |
const handleProxyChange = async (accountId: string, proxyId: string) => {
|
| 87 |
accounts.patchLocal(accountId, { proxyId });
|