Skip to content

feat(bangumi): OAuth 直连登录(回环回调 + 7 天自动轮换) - #95

Merged
ModerRAS merged 2 commits into
masterfrom
feat/bangumi-oauth
Oct 20, 2026
Merged

ModerRAS merged 2 commits into
masterfrom
feat/bangumi-oauth

Conversation

@ModerRAS

@ModerRAS ModerRAS commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Bangumi OAuth 直连登录:TV 内嵌 WebView 授权 + 回环回调接 code + 换 token 加密落库 + 临期 24h 自动轮换。手动贴 Token 链路保留,TV 设置页为唯一入口(Web 端已有 token 管理端点,不做 OAuth surface,见 parity 表)。CI 同仓库 PR 注入 BANGUMI_CLIENT_ID/SECRET(#94),fork PR 显示未配置态。

设备实测(HK1,2026-10-20)

  • 设置 → 元数据 → 使用 Bangumi 登录 → WebView 授权页 → 登录授权 → 自动跳回:显示"Token 已保存在加密存储中。"+"有效期至 2026-10-27 20:57"(7 天 TTL,证明换 token 解析与落库正确)+ 退出登录 + "元数据 已设置 1 项"
  • force-stop 冷启动后登录态仍在,无崩溃;全程 logcat 无 AndroidRuntime:E
  • 同步全部 Bangumi 进度在空库下无可见变化:符合设计(animeCount>0 才显示结果行),不是 bug
  • 代理链路:设备直连 bgm.tv 被墙,配系统代理后 WebView 正常打开;token 交换走应用内 OkHttp 代理

未覆盖(原因已记入 pre-pr-checklist)

  • 外部浏览器路径、退出登录清理(会登出真实账号,需授权)、临期自动刷新(需时间窗口)、无网络失败态

顺带发现(非本 PR 范围,另起跟进)

  • WebView 不走应用代理只认系统代理:墙内无系统代理的盒子连授权页都打不开,建议文档/二维码方案跟进
  • bgm 验证码对抗自动化:代理出口 IP 下几乎必弹,连错 4 次后停手;只做人走查
  • ANi RSS 全量扫描在某次真机运行中卡住 15 分钟且零落库(疑似某阻塞调用,待钉死;可能是代理侧偶发,需复跑区分)

- 新增 BangumiOAuthClient(scraper-core):授权 URL 拼装、
  code 换 token、refresh_token 轮换,代理复用现有配置
- 新增回环回调监听 + BangumiOAuthCoordinator(sync-engine-shared):
  state 机、state 校验、换 token 跑独立协程、临期 24h 自动刷新
- SecurePreferences 存 refresh token + 过期时间,登出/清空一并清除
- AppModule 装配:BuildConfig 读 client id/secret(缺省未配置不断构建)
- TV 设置元数据区:登录按钮 + WebView 对话框 + 外部浏览器入口 +
  状态/有效期展示;手动贴 token 链路保留
- i18n 四地文案 + resolver 映射;单测覆盖 client/协调器/VM 接线
- 文档:pre-pr checklist 条目 + parity 表(OAuth 流程为 TV-only)
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1915b23f-5649-4719-bfa6-a0d90f7bb60b
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ModerRAS
ModerRAS marked this pull request as ready for review October 20, 2026 14:03
@ModerRAS
ModerRAS merged commit 309cb3f into master Oct 20, 2026
5 checks passed
@ModerRAS
ModerRAS deleted the feat/bangumi-oauth branch October 20, 2026 15:16
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