Repository navigation
fix(dumate): 扫码登录后补齐 bce-user-info,修复领取报 csrftoken 缺失 - #67
Merged
Merged
Conversation
现象:扫码登录成功后,账号能查到余额,但每日领取失败并提示 「Cookie 缺少 bce-user-info(无法生成 csrftoken)」。 原因:控制台首页(/dumate/channel 等)并不下发 bce-user-info, 会话里只有 BDUSS / bce-sessionid 时 extractDumateCsrfToken 返回空。 修复:新增 healDumateCookies(),缺该 cookie 时请求 /api/dumate/app/token/get,从 Set-Cookie 的 bce-login-accountid 取账户 ID 作为 bce-user-info 的值(实测该值就是账户 ID,服务端按 cookie 原文与 csrftoken 双提交校验)。扫码链路入库前补齐, 领取时也兜底一次,避免存量账号需要重新登录。 实测:补齐后领取接口返回 checked-in「已领取今日登录赠送积分」; 若把值写成 timestamp|accountId 则返回「登录凭证已过期」, 确认必须为纯账户 ID。
techysy
added a commit
that referenced
this pull request
Nov 15, 2026
Co-Authored-By: Claude Code <noreply@anthropic.com>
techysy
added a commit
that referenced
this pull request
Nov 15, 2026
Co-Authored-By: Claude Code <noreply@anthropic.com>
techysy
added a commit
that referenced
this pull request
Nov 15, 2026
PR #67 的 heal 是内存态:verify/领取前现补一轮 token/get,heal 出的 bce-login-accountid / display-name / device-token 不落库——每次领取都 重补一遍,且补出的新 Cookie 从未持久化。 - refreshContext 补 persistCookieJar(cookieHeader):完整罐回写账号 token 与 cookieSiteSession.cookie(与 onRefresh 同构,log 同步) - checkinDumate 接 persistCookieJar:heal 成功后回写(回写失败不阻断 领取);providers dumate 传 ctx - 测试补两例:heal 后回写断言 + 无钩子时兼容(不强加依赖) Co-Authored-By: Claude Code <noreply@anthropic.com>
techysy
added a commit
that referenced
this pull request
Nov 16, 2026
- 版本号对齐 v1.8.0(root/desktop package.json + fnos manifest) - CHANGELOG 四语封版 2026-11-16:主题行改最终架构口径(Meoo 以网页会话接入,OAuth 独立线试运行一轮后回退);PR #67 条目黏连剥离并补 heal 落库(persistCookieJar);meoo 回退条目补全撤除细节;渠道推送收口条目归位;测试数校准 466/466 Co-Authored-By: Claude Code <noreply@anthropic.com>
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.
现象
扫码登录成功后,账号能正常显示余额,但每日领取失败:
根因
扫码链路走完
console.bce.baidu.com/dumate/channel后,会话里只有BDUSS/bce-sessionid,控制台首页并不下发
bce-user-info。而领取接口需要csrftoken,其值等于bce-user-info的原文,extractDumateCsrfToken()取不到就返回空,请求被直接拦下。修复
新增
healDumateCookies():缺少bce-user-info时请求GET /api/dumate/app/token/get,从响应Set-Cookie里取bce-login-accountid作为
bce-user-info的值(该接口还会一并返回bce-login-display-name、bce-device-token,一并合并进会话)。两处调用:
dumateQr.js:扫码登录收集完 Cookie 后补齐,保证入库账号是完整的;dumateClient.js:领取前兜底一次,存量账号无需重新登录。顺带修了
checkin.js的一个显示问题:当 provider 未返回积分数量时,日志会打印领取成功 +undefined 积分,现在改为打印「领取成功(接口未返回积分数量)」;有数量时行为不变。
实测
补齐后调用领取接口:
{"status":"checked-in","message":"已领取今日登录赠送积分"}对照实验:把
bce-user-info写成timestamp|accountId,接口返回「登录凭证已过期」;写成纯
accountId才成功。说明服务端按 cookie 原文与csrftoken双提交校验,值必须是账户 ID 本身。测试说明
node --check通过;npm test在提交机器上无法运行(Node 启动即Zone Allocation failed的环境问题),未做单元测试;