dwgx@blog:~$dwgx
> cd ../posts

星火无痕: Rolling My Own Windsurf Account Pool Manager

// created

星火无痕 is an Electron desktop app for managing Windsurf accounts. Once you’ve piled up enough accounts, switching between them is pure grunt work: expiry dates, remaining quota, which one still runs, all kept in your head, and sooner or later something slips. So I turned it into a centralized management tool, cramming batch registration, import/export, grouping, querying, and switching into one cross-platform app.

The core is seamless account switching. With the companion extension you can switch inside the editor without restarting, and when a quota runs out it jumps to the next one automatically. It also supports quota polling, message-anchored switching, and hotkey switching, so what used to be manual work is now basically hands-off. Usage stats are visualized too, with quota, credits, and request trends laid out on a panel so you can tell at a glance which account is about to run dry. This repo holds the source of the app itself; building a proper installer still needs the Electron runtime shell and packaging config, which aren’t included here. It’s currently at v8.4.8 and still iterating.

The structure is the standard three-layer Electron setup. The main process main.js creates the window, registers all the IPC handlers, and integrates system capabilities, while also handling version detection and maintenance mode. One pitfall: at startup you have to isolate proxy environment variables like HTTP_PROXY, otherwise they leak into internal requests and cause trouble. The renderer process renderer.js goes entirely through ipcRenderer.invoke to request capabilities from the main process. In the backend src/, the registration bot, temporary email, and machine-code reset are each split into their own module.

Version licensing, registration relay, and the store are all handed off to the remote end; the client just talks plain HTTP. Endpoint addresses, the Worker key, and the Firebase key are kept in js/constants.js, and runtime data is written to the user directory .xinghuowindsurf/shared-data. The stack is built on Electron 26; verification-code retrieval relies on axios, cheerio, puppeteer / puppeteer-real-browser plus chrome-launcher; temporary email goes through imap + mailparser; local storage uses sql.js. The whole thing is roughly 60,000 lines of JS.

Verification-code retrieval is the most grinding part. Several temporary email providers are built in, with IMAP, API, and Puppeteer scraping all implemented, because a single channel is too unreliable and you need fallbacks to cover for each other. There’s also a little self-healing patch: saved prompts kept picking up literal \n, so every startup it quietly fixes them back to real line breaks, since it’s annoying to use otherwise. The helpers like machine-code reset, the registration bot, and GitHub OAuth with TOTP were all added only because I actually needed them.

npm install
npm run check     # 逐文件 node --check 语法检查 跳过 node_modules 和 vendor
npm start         # electron . 直接起

Node 18+, 20+ recommended. MIT-licensed, source is in the repo above; go dig through it yourself.