Conversation
QR code scans were authorized on the phone but the storage stayed stuck on the QR page, and token-only setups failed with "params is null". The driver used appId 8025431004 while the official PC client uses 9317140619. Tokens, sessions and QR sessions are all scoped to an appId, so the mismatch meant the QR poll never saw status:0 and an accessToken could not be exchanged for a sessionSecret. - Use appId 9317140619 and version 7.2.4.0. QR state polling uses clientType=1; password login keeps 10020. - Send the QR poll parameters the official client sends (cb_SaveName, isOauth2, state, user-finger header, logbox Referer) and poll locally instead of only checking once per save. - Parse lt/reqId from the logbox redirect and paramId from appConf.do. The new login page no longer embeds them as inline variables; the old inline format is still supported. - Implement the -133 second device verification via sendSmsCodeForSecondAuth/submitForSecondAuth. That endpoint has no dedicated SMS field: the code goes into epd, encrypted with the same public key used for the password. Persist the DEVICEID cookie so the verification only happens once. - Detect refreshToken.do failures. It reports them as HTTP 200 with a result field, so SetError never fired and a failed refresh was treated as success, surfacing later as a misleading "params is null". - username/password are no longer required, so token-only storages save without placeholders. clientSn/jgOpenId are optional and only sent when configured; user-finger is generated once per storage. - Return named errors instead of panicking when the login page changes shape. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
naiyQAQ
force-pushed
the
fix/189pc-login
branch
from
September 20, 2026 09:00
d415fd8 to
c1ae190
Compare
pikachuren
reviewed
Sep 21, 2026
pikachuren
left a comment
Collaborator
There was a problem hiding this comment.
🙏 感谢 @naiyQAQ 提交!
🤖 AI 自动审核声明:本评审报告由 AI 自动生成,当前使用 Claude Opus 5 模型进行分析。
🎯 结论
✅ Approve — 代码质量良好,建议合并
📖 概要
fix(189pc): 更新天翼云盘PC协议版本,修复扫码卡死,支持账密登录时的验证码二次验证
📊 评审结果
改动合理,无重大问题发现。代码逻辑清晰,符合项目规范。
🎯 结论:✅ Approve — 建议合并
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.
Summary / 摘要
修复 189CloudPC 驱动无法登录的问题,并把协议参数对齐到官方 PC 端当前版本。
问题现象:
res_code: InvalidArgument, res_msg: params is null。根本原因:
驱动使用的
appId是8025431004,而官方 PC 端(cloud.189.cn网页/客户端)已改用9317140619。天翼云盘的 token、session 和二维码会话都与 appId 绑定,所以:9317140619下生成,驱动却拿8025431004去轮询领授权结果 → 服务端认为不是同一个会话 → 永远查不到status: 0→ 页面卡死;accessToken是9317140619签发的,驱动拿8025431004去getSessionForPC.action换 session → 换不回sessionSecret→ 后续请求算不出params→ 报params is null。已用
curl对真实接口验证:同一个 token 配appId=9317140619可以正常换出sessionKey/sessionSecret。用户可感知的变化 / User-visible changes
sms_code字段后再次保存即可完成登录。DEVICEID会被保存下来,后续登录不再重复触发二次校验(官方有效期 120 天)。username/password不再是必填项:只填access_token或refresh_token即可保存存储,不需要再填占位符。refreshToken为空、刷新失败),不再一律显示成误导性的params is null。重要实现变化 / Implementation changes
APP_ID改为9317140619,VERSION改为7.2.4.0。新增QR_CLIENT_TYPE = "1"仅用于扫码状态轮询;密码登录仍保持clientType=10020(已通过抓包确认这里本来就是对的)。cb_SaveName=3、isOauth2=false、state,以及user-finger请求头和真实的 logboxReferer。轮询改为本地循环(2 秒一次,最多 20 秒),超时后把二维码交回前端,避免长连接被反向代理掐断。lt/reqId放在跳转地址上,paramId需另外向appConf.do获取;旧版把三者写在页内变量里的格式仍然兼容。appConf.do的result字段可能是数字也可能是字符串,两种都处理。result: -133):实现sendSmsCodeForSecondAuth.do→submitForSecondAuth.do。该接口没有独立的短信码字段——短信码要放进epd,用登录时encryptConf.do下发的同一个公钥加密(登录时epd装的是密码)。整个流程复用同一套paramId和 cookie 会话,中途不重新初始化。refreshToken.do失败检测:该接口刷新失败时返回 HTTP 200 加{"result":-36,...},而 resty 的SetError只在 4xx/5xx 触发,RespErr里也没有result字段。原先失败被当成成功,access token 被清空后继续去换 session,最终暴露成误导性的params is null。新增RefreshTokenResp单独判断。getSessionForPC.action的三处调用合并为getSessionByRedirectURL,统一补上returnType=JSON和X-Request-ID。配置变化 / Config changes
Addition新增 5 个可选字段,均向后兼容,老配置无需修改:sms_codedevice_idDEVICEID,保留可避免重复校验client_snjg_open_iduser_fingerusername/password由必填改为可选。关于设备标识的说明:
client_sn和jg_open_id只在用户明确填写后才发送。虽然抓包里官方请求带着这两个值,但经curl验证,不带它们同样能成功换出 session;而把某个账号的设备序列号写死进驱动,会让所有用户上报同一个服务端并不认识的设备号,因此改为可选。user_finger每个存储随机生成一次并持久化,保证服务端看到的是稳定的同一台设备。/ 此 PR 包含破坏性变更。
/ 此 PR 修改了公开 API、配置、存储格式或迁移行为。
/ 此 PR 需要关联仓库同步修改。
Related repository PRs / 关联仓库 PR:
Related Issues / 关联 Issue
Testing / 测试
平台: Windows 11 (amd64),Go 1.27.1
手动验证(真实天翼云盘账号,挂抓包代理逐个请求核对):
qrClinentLogin.do?paras=new_uuid=...|9317140619;手机扫码确认后自动完成登录并挂载成功。-106(未扫描)而非报错,证明参数被接受;本地轮询跑满时间窗口后正确把二维码交回前端。-133后成功收到短信,填入sms_code再次保存后校验通过并完成登录。params is null。接口层验证(
curl直连真实接口):appId=9317140619可换出sessionKey/sessionSecret(res_code: 0)。refreshToken.do失败时确认返回 HTTP 200 +result字段,印证SetError检测不到。content-length验算submitForSecondAuth.do抓包的字段组合,确认该接口没有独立短信码字段。epd加密结果格式为{NRP}+ 256 位 hex,与抓包一致(临时测试,未提交进仓库)。命令:
go test ./...go build ./...—— 通过go vet ./drivers/189pc/—— 通过go test ./drivers/189pc/—— 通过Test Build—— 7/7 平台全部成功(darwin-amd64/arm64、windows-amd64/arm64、linux-amd64/arm64-musl、android-arm64)Checklist / 检查清单
/ 我已阅读 CONTRIBUTING。
/ 我确认此贡献符合仓库许可证、贡献规范和行为准则。
gofmt,go fmt, orprettierwhere applicable./ 我已按适用情况使用
gofmt、go fmt或prettier格式化变更代码。/ 我已在适用情况下请求相关维护者或代码所有者审查。
AI Disclosure / AI 使用声明
/ 此 PR 包含 AI 辅助内容。
Tools used / 使用工具:
Usage scope / 使用范围:
Code generation / 代码生成
Refactoring / 重构
Documentation / 文档
Tests / 测试
Translation / 翻译
Review assistance / 审查辅助
I have reviewed and validated all AI-assisted content included in this PR.
/ 我已审核并验证此 PR 中的所有 AI 辅助内容。
I have ensured that all AI-assisted commits include
Co-Authored-Byattribution./ 我已确保所有 AI 辅助提交都包含
Co-Authored-By归属信息。I can reproduce all AI-assisted content included in this PR without any AI tools.
/ 我可以在没有任何 AI 工具的情况下重现此 PR 中包含的所有 AI 辅助内容。