Repository navigation
Fix Windows OAuth link copying / 修复 Windows 授权链接复制 - #16
Merged
Merged
Conversation
eerraa
force-pushed
the
fix/windows-compat
branch
from
September 19, 2026 03:52
4fe5e62 to
dae2b74
Compare
This was referenced Sep 19, 2026
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.
English · 简体中文
English
Restore “Copy authorization link” on Windows without changing the login flow or the existing macOS implementation.
Problem and user impact
On Windows, open Add Account and choose “Copy authorization link” to sign in with a browser other than the default. The existing IPC handler unconditionally launches
pbcopy, so it returns无法启动 pbcopy: program not foundand leaves the clipboard unchanged. This is a local platform error, not an OAuth rejection; users must manually recover the URL to continue.Focused fix
The current diff is limited to the Windows clipboard backend: 4 files, one commit. It replaces the earlier multi-topic version of this PR.
copy_to_clipboardcommand to a Windows-only module. The existing non-Windows clipboard function body is unchanged; no Linux clipboard helpers or unrelated copy-call migrations are included.UnicodeText. A fixed command receives Base64-encoded UTF-8 through stdin: the URL never becomes shell syntax, and console encoding does not add a BOM or alter its characters. The helper does not open a console window.This uses the Windows PowerShell/.NET desktop facilities already present on standard Windows installations; it adds no npm/Cargo dependency. An environment that restricts those facilities will still receive a copy error. Account storage, credentials, PKCE/state, callback handling, and token exchange are not changed.
Verification
At head
dae2b74, the dedicated Windows CI passed: frontend build,cargo check --locked --all-targets, the transport test, and a real OS clipboard write/read round-trip covering Unicode/emoji, URL and shell metacharacters, an intentional leading BOM, a long URL, and empty text.The OS clipboard test is ignored by default and requires an explicitly disposable GitHub Actions runner; ordinary local tests do not overwrite the developer's clipboard. This does not claim live OAuth end-to-end coverage.
Independent review: one commit directly on upstream
main(f64a44a). The selectable-URL fallback is a separate, optional UI fix in #17; this backend fix does not require it.简体中文
让 Windows 上的“复制授权链接”恢复可用,不改登录流程,也不改现有 macOS 剪贴板实现。
问题与用户影响
在 Windows 的“添加账号”中点击“复制授权链接”,本意是把链接粘贴到指定浏览器登录。但现有 IPC 处理函数会直接启动
pbcopy,因此返回无法启动 pbcopy: program not found,剪贴板内容并未更新。这是本地平台调用失败,并非 OAuth 授权被拒绝;用户只能设法从界面中手动取出链接继续操作。本次修改范围
当前 diff 已收敛为 4 个文件、1 个提交,仅修复 Windows 剪贴板后端,不再包含这个 PR 最初混在一起的其他修改。
copy_to_clipboard命令转到独立模块。非 Windows 的原有剪贴板函数体保持不变;不增加 Linux 剪贴板工具,也不迁移账号名、会话 ID 等其他复制入口。UnicodeText。固定命令通过 stdin 接收 Base64 编码的 UTF-8 文本,URL 不会被拼接成 Shell 代码,也不会因控制台编码而多出 BOM 或改变字符;辅助进程不弹出控制台窗口。使用标准 Windows 安装已有的 Windows PowerShell/.NET 桌面能力,不新增 npm/Cargo 依赖。若系统策略限制这些能力,仍会明确返回复制错误。账号存储、凭据、PKCE/state、回调处理及令牌交换均不修改。
验证依据
当前提交
dae2b74的独立 Windows CI 已通过:前端构建、cargo check --locked --all-targets、文本传输测试,以及真实系统剪贴板写入后再读回的测试。覆盖 Unicode/emoji、URL 与 Shell 特殊字符、刻意保留的开头 BOM、长 URL 和空文本。真实剪贴板测试默认忽略,仅允许在明确标记为一次性环境的 GitHub Actions runner 上执行,不会在普通本地测试中覆盖开发者的剪贴板。这里不把剪贴板验证当作真实 OAuth 登录的端到端验证。
**可独立审阅和合并:**仅一个提交,直接基于 upstream
main(f64a44a)。#17 单独处理复制失败后的链接展示与重试,本 PR 不依赖它。