feat(desktop): dedupe bind windows per platform and cap concurrency at 2

Track active bindPublishAccount calls in a per-platform map so a repeat
invocation reuses and focuses the existing window instead of spawning
a second one, and reject new platforms once 2 bind windows are already
open. Surface desktop_account_bind_limit_reached as a warning modal in
the renderer so users know to finish or close an existing authorization
before starting another.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-20 11:11:21 +08:00
parent 12f972882b
commit 4014eff427
2 changed files with 86 additions and 5 deletions
@@ -53,6 +53,14 @@ function presentClientError(kind: ClientActionKind, error: unknown): ClientError
};
}
if (message === "desktop_account_bind_limit_reached") {
return {
tone: "warning",
title: "授权窗口已达上限",
content: "当前最多同时打开 2 个授权窗口。请先完成或关闭已有授权窗口,再继续新的绑定。",
};
}
if (message === "desktop_account_upsert_failed") {
return {
tone: "error",