Skip to content

fix(mobile): pair with the desktop environment named by the QR code - #598

Merged
huichen merged 1 commit into
mainfrom
claude/mobile-production-apk
Sep 13, 2026
Merged

huichen merged 1 commit into
mainfrom
claude/mobile-production-apk

Conversation

@huichen

@huichen huichen commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

问题

桌面二维码里本来就带完整的领取地址 claim_url,但手机端还额外要求它与 APK 自身的版本渠道一致(release 正式、其余测试)。于是开发版 APK 扫到正式环境桌面的二维码时,在发出任何请求之前就报 PA003,只能靠「按环境各打一次包」绕开——用户实际遇到的正是这个:桌面在正式环境,本地下载的开发版 APK 只认测试环境。

改动

  • isExpectedClaimUrl 改为按二维码地址判断:只接受首方 HTTPS 平台( uture-os.cn / est.future-os.cn)+ 精确领取路径,拒绝非 HTTPS、非默认端口、URL 用户信息、附加查询/片段与其他域名。二维码只用于选择可信服务,不能借此把配对请求引向任意地址。
  • 续期(/auth/token)与撤销(/pair/revoke)地址继续由领取地址派生并随该桌面的凭证保存,因此一个 APK 可同时配对两个环境的不同桌面,切换桌面不会串环境;已有配对无需改存储。
  • 协作方按环境打包的机制(环境开关 / 构建输入)已按要求撤回,CI 无改动。
  • PA003 现在是「配对地址不受信任」,文案与 \DEV_MD/CONNECTION.md\ 支持码表同步修正。

验证

  • \mobile\:
    pm run typecheck\、
    pm run lint\、
    pm test\ 通过(917 项;\SessionList\ 首次在 Windows 冷跑出现一次既有 hook 抖动,重跑通过,与本次改动无关)。
  • 新增/加强用例:两个可信平台的领取/续期/撤销地址逐一断言;13 条不受信任或畸形地址被拒且不发起请求、不写 device id。
  • 真机配对未验证:需安装含本次改动的 APK 后,用正式环境桌面实测扫码。

A desktop QR encodes the full claim URL, but the app also required that URL
to match the platform implied by the APK's own version channel. A dev build
therefore rejected a production desktop with PA003 before sending anything,
and the only workaround was repackaging the app per environment.

Accept the claim URL whenever it is one of the first-party HTTPS platforms
with the exact claim path, and keep refresh/revoke deriving from the URL now
stored with each desktop's credentials, so one APK pairs with either
environment and switching desktops cannot mix them. PA003 now means an
untrusted address rather than a channel mismatch.
@huichen
huichen enabled auto-merge (squash) September 13, 2026 12:46
@huichen
huichen merged commit 160b3dd into main Sep 13, 2026
12 checks passed
@huichen
huichen deleted the claude/mobile-production-apk branch September 13, 2026 12:48
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.

1 participant