fix: resolve Linux launch issues and improve error handling#7
Open
jimwong8 wants to merge 17 commits into
Open
fix: resolve Linux launch issues and improve error handling#7jimwong8 wants to merge 17 commits into
jimwong8 wants to merge 17 commits into
Conversation
- electron.js: load local build index.html instead of dev server when available - electron.js: use backendPort variable in before-quit flush instead of hardcoded 30001 - electron.js: add isQuitting guard to prevent deadlock in before-quit handler - electron.js: pass options through handleFileOpen to dialog.showOpenDialog - server/server.js: hoist memoryService/toolServiceMgr to module scope (fix ReferenceError) - server/server.js: extend uncaughtException to handle ENOENT open/write errors - server/server.js: explicitly stop child services on SIGINT/SIGTERM - config.js: use XDG_DOCUMENTS_DIR for Linux savePath default instead of hardcoded 'Documents' - fingerPrintService.js: ensure parent directory exists before writing fpData.json - memoryService.js: auto-restart dbservice on unexpected exit - toolServiceManager.js: use config.getIsBuild() instead of direct property access - toolService/index.js: use BACKEND_PORT env var instead of hardcoded localhost:30001 - toolService/lib/envHelper.js: use BACKEND_PORT env var instead of hardcoded localhost:30001 - preload.js: forward options parameter in openFile IPC call
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR makes local backend/tool service connectivity and process lifecycle more configurable and resilient across dev vs packaged environments.
Changes:
- Parameterize backend port usage and shift localhost calls to
127.0.0.1. - Improve service management (auto-restart dbservice on unexpected exit; stop services on shutdown).
- Harden filesystem interactions (create parent dirs for
fpData.json, adjust default save path behavior).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| toolService/lib/envHelper.js | Use BACKEND_PORT and 127.0.0.1 for backend requests. |
| toolService/index.js | Same backend port/loopback adjustment for fetchEnvById. |
| server/services/toolServiceManager.js | Fix build-mode detection via config.getIsBuild(). |
| server/services/memoryService.js | Add auto-restart behavior for dbservice on abnormal exit. |
| server/services/fingerPrintService.js | Ensure fp data directory exists and handle write failures. |
| server/server.js | Broaden ENOENT uncaught handling; start/stop services more centrally. |
| preload.js | Allow passing options into dialog:openFile IPC. |
| electron.js | Accept dialog options in main; adjust start URL selection; flush endpoint uses backend port. |
| config.js | Improve non-Windows/mac defaults; adjust documents/save path logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+7
to
16
| if (err && err.code === 'ENOENT') { | ||
| if (err.syscall === 'rename' && /\.db~/.test(err.path)) { | ||
| console.error('[NeDB] Persistence write error (non-fatal):', err.message); | ||
| return; | ||
| } | ||
| if (err.syscall === 'open' || err.syscall === 'write') { | ||
| console.error('[FS] Non-fatal ENOENT:', err.message); | ||
| return; | ||
| } | ||
| } |
Comment on lines
+92
to
97
| const buildPath = path.join(__dirname, './client/build/index.html'); | ||
| const startURL = fs.existsSync(buildPath) | ||
| ? `file://${buildPath}` | ||
| : 'http://localhost:3000'; | ||
|
|
||
| console.log('[Electron] Loading URL:', startURL); | ||
| mainWindow.loadURL(startURL); |
Comment on lines
+53
to
+56
| if (code !== 0 && signal !== 'SIGTERM' && signal !== 'SIGKILL') { | ||
| console.log('[memoryService] Auto-restarting dbservice in 2s...'); | ||
| setTimeout(() => startDbService(), 2000); | ||
| } |
Comment on lines
+12
to
+14
| const backendPort = process.env.BACKEND_PORT || '30001'; | ||
| return new Promise((resolve) => { | ||
| http.get(`http://localhost:30001/api/getEnvById/${envId}`, (resp) => { | ||
| http.get(`http://127.0.0.1:${backendPort}/api/getEnvById/${envId}`, (resp) => { |
Comment on lines
+77
to
+78
| const docsDir = process.env.XDG_DOCUMENTS_DIR || path.join(home, 'Documents'); | ||
| const defaultPath = path.join(docsDir, 'Web3ToolBox'); |
…sers Major fingerprint system overhaul: - Hardware diversification: memory/concurrency now varies by device type (mobile/low/mid/high) - Screen fingerprint: 12 screen profiles with OS-appropriate resolution matching - Font-OS consistency: fonts selected based on inferred OS (windows/macos/linux/android/ios) - Audio noise upgrade: xorshift128+ PRNG replaces simple LCG, multi-dimensional noise - Fingerprint consistency validation: cross-checks UA/ClientHints/WebGL/Screen/Hardware/Proxy - Behavior simulator: human-like mouse movement (Bezier), typing, scrolling - Fingerprint auditor: automated testing of WebRTC leak, webdriver, plugins, canvas, WebGL, audio - New API routes: /validateFingerprint, /fingerprintAudit/:id - browserPool.js: enhanced fingerprint parameter passing
Author
指纹系统升级(阶段一完成)刚刚推送了重大升级提交,将指纹系统从基础水平提升到接近商业产品水平: 核心升级
测试结果
|
Phase 2+3 upgrades: - Integrate adryfish/fingerprint-chromium 144 (pre-built binary) - Add FP_CHROMIUM_PATH env var to toolService - Update browserPool.js with new fingerprint-chromium CLI args (--fingerprint, --fingerprint-platform, --fingerprint-brand, etc.) - Add TLS fingerprint module (JA3 signatures for chrome/firefox/edge) - Add /api/tls/config and /api/tls/ja3 API routes - Add .gitignore for fingerprint-chromium binaries - Export helper functions from fingerPrintService
Author
阶段二+三完成:Chromium 补丁 + TLS 指纹伪装阶段二:fingerprint-chromium 集成
阶段三:TLS 指纹伪装
测试结果
指纹系统评分:33/100 → ~80/100 |
… avoid TDZ issues in electron utilityProcess
Author
🎉 全部阶段完成 + 测试通过最终测试结果所有 3 个端口正常监听,所有 API 测试通过:
API 测试
修复记录
指纹系统最终评分:~80/100(初始 33/100) |
Backend additions: - POST /api/openEnv - launch browser with fingerprint env - POST /api/initTwitters - initialize Twitter accounts - GET /api/state/sessions/:agentId - get agent sessions - POST /api/state/app/set - set app state - GET/POST /api/state/app/language - get/set language Frontend API additions: - openEnv(), initTwitters() - getStateSessions(), setStateApp(), getStateLanguage(), setStateLanguage() - validateFingerprint(), getFingerprintAudit() - getTLSConfig(), getJA3Signature() - checkMemoryHealth(), storeMemory(), searchMemory(), clearMemory() - checkToolsHealth(), listTools(), executeTool()
- Add signal handlers (SIGTERM/SIGINT/SIGHUP) to prevent accidental quit - Disable window-all-closed auto-quit on Linux - Add comprehensive GPU disable flags for Virtio GPU + llvmpipe - Window now stable for 110+ seconds in PVE VM environment
Author
🎉 窗口稳定性问题已修复最终测试结果Web3ToolBox 在 PVE 虚拟机(Virtio GPU + llvmpipe 软件渲染)环境下稳定运行:
关键修复
指纹系统评分:~80/100(初始 33/100) |
- Switch from nodeIntegration:true to contextIsolation:true - Use contextBridge to expose electronAPI to renderer - Add IPC proxy in main process for backend API calls - Simplify before-quit handler to not kill backend process - Add error handling wrappers for IPC calls - Frontend now uses window.electronAPI for all backend calls Root cause: nodeIntegration:true caused axios to fail in renderer process when backend process was killed during before-quit event.
- Fix duplicate code block in before-quit handler (SyntaxError: Unexpected token '}') - Modify server.js SIGTERM handler to not call process.exit() - Let parent Electron process manage backend lifecycle - Window now stable for 30+ seconds without white screen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes multiple issues preventing Web3ToolBox from launching on Linux desktop environments.
Root Cause
When
IS_BUILD=false(dev mode), the Electron window tried to loadhttp://localhost:3000(React dev server) which was not running, resulting in a blank window.Changes
Critical Fixes
client/build/index.html,存在则加载,否则回退到 dev servermemoryService is not definedReferenceError(变量作用域问题)uncaughtException处理 ENOENT open/write 错误Improvements
backendPort变量而非硬编码 30001isQuitting标志防止 before-quit 死锁XDG_DOCUMENTS_DIR环境变量config.getIsBuild()替代直接属性访问BACKEND_PORT环境变量替代硬编码端口openFile透传 options 参数Testing