Skip to content

Fix OAuth link overflow and copy retry / 修复授权链接溢出与复制重试 - #17

Merged
VallierDev merged 1 commit into
VallierDev:mainfrom
eerraa:fix/oauth-link-fallback
Sep 19, 2026
Merged

VallierDev merged 1 commit into
VallierDev:mainfrom
eerraa:fix/oauth-link-fallback

Conversation

@eerraa

@eerraa eerraa commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

English · 简体中文

English

A clipboard failure should not leave the user with a clipped authorization URL or force a new login attempt just to copy it again.

Problem and reproduction

In Add Account, generate an OpenAI or Google authorization link while native clipboard copying is unavailable. The existing fallback puts the entire URL into a centered status message. A long URL can overflow the dialog, making the complete link difficult to select. Closing and reopening to retry starts another authorization attempt. The OpenAI fallback also puts the outgoing authorization URL into the field intended for the returning callback URL.

These are fallback-UI problems on any platform; they are separate from Windows failing to launch pbcopy.

What changes—and what does not

Production changes are confined to three frontend files: the account modal, its CSS, and a small OAuthLink component. The other four files are an isolated browser regression fixture and its runner.

  • Display the exact generated URL in a selectable, read-only textarea, with bounded status/error text. Keep the callback input separate.
  • Retry copying the same URL through the existing IPC. Re-copying does not start OAuth again or regenerate PKCE/state. Show “waiting for browser authorization” rather than an indefinite “processing” label once the link is available.
  • Ignore late link-generation results from an attempt whose modal has been closed and reopened.

No Rust code, clipboard backend, OAuth parameters, callback validation, token exchange, account schema, or unrelated screens are changed. This adds no package dependency and contains no Korean localization.

Verification

Local Windows validation at head fb82d59 passed:

npm run build
node scripts/oauth-link-smoke.mjs

The browser test passed 8 isolated scenes, with assertions for both providers' copy failure/retry, exact URL preservation, no extra login call on re-copy, an empty callback input, three smaller viewport sizes, and close/reopen races. Native IPC and account data are mocked; outbound service requests are blocked. This verifies UI behavior, not real OAuth login or native clipboard availability.

Independent review: one commit directly on upstream main (f64a44a). #16 fixes the Windows clipboard backend; this PR makes its failure path usable and does not require #16. Either can be merged on its own.


简体中文

剪贴板复制失败后,用户仍应能取出完整的授权链接,而不必为了再复制一次就重新发起登录。

问题与复现方式

在“添加账号”中生成 OpenAI 或 Google 授权链接,并让系统剪贴板复制失败。现有兜底逻辑会把整条 URL 放进居中的状态提示中;链接较长时会撑出弹窗,难以完整选中。用户关闭后重开来重试,又会产生新的授权请求。此外,OpenAI 分支还会把“发起授权的 URL”写进本应用于粘贴“授权完成后回调 URL”的输入状态。

这是各平台都可能遇到的失败兜底问题,与 Windows 无法执行 pbcopy 是两个独立问题。

本次改什么、不改什么

实际界面修改只涉及 3 个前端文件:账号弹窗、对应 CSS、一个小型 OAuthLink 组件。其余 4 个文件用于隔离的浏览器回归测试。

  • 用可选中的只读文本框显示生成的原始完整 URL,限制状态和错误提示的宽度;回调输入保持独立。
  • “再次复制”通过现有 IPC 复制同一条链接,不重新启动 OAuth,不重新生成 PKCE/state。链接就绪后显示“等待浏览器授权”,避免一直显示“处理中”。
  • 弹窗关闭并重新打开后,忽略上一轮迟到的链接生成结果。

不改 Rust 后端、剪贴板实现、OAuth 参数、回调校验、令牌交换、账号结构或其他页面;不新增依赖,也不包含韩语本地化。

验证依据

在 Windows 上针对当前提交 fb82d59 完成本地验证:

npm run build
node scripts/oauth-link-smoke.mjs

8 个隔离浏览器场景通过。断言覆盖 OpenAI/Google 两条路径的复制失败与重试、URL 原文保留、再次复制不增加登录调用、回调输入仍为空、3 种较小窗口尺寸,以及关闭后重开时的异步结果处理。测试使用模拟 IPC 和账号数据,并阻止外部服务请求;验证的是界面行为,不把它表述为真实 OAuth 登录或系统剪贴板测试。

**可独立审阅和合并:**仅一个提交,直接基于 upstream main(f64a44a)。#16 解决 Windows 剪贴板后端问题,本 PR 解决复制失败后的界面可用性,两者互不依赖,可以分别接受。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants