Skip to content

feat: 无痕模式与多账号登录 / Incognito mode and multi-account login - #39

Open
NZJ-Jimmy wants to merge 9 commits into
BPTPW:mainfrom
NZJ-Jimmy:codex/privacy-multi-account
Open

NZJ-Jimmy wants to merge 9 commits into
BPTPW:mainfrom
NZJ-Jimmy:codex/privacy-multi-account

Conversation

@NZJ-Jimmy

@NZJ-Jimmy NZJ-Jimmy commented Oct 3, 2026 •

Copy link
Copy Markdown

Closes #22.

中文说明

为 #22 添加无痕模式,并支持多账号按功能分工、四种登录方式及 PiliPlus 兼容的账号导入导出。

功能与行为

  • 无痕模式:停止首次、定时及退出播放时的观看记录上报,也不新增本地搜索历史;保留已有历史和账号分工。用户主动点赞、收藏等操作仍使用主账号。无痕模式不代表网络匿名。
  • 多账号分工:主账号、记录观看、推荐、视频取流可独立指定账号或 0(匿名),支持快速统一切换。每个请求使用同一账号的 Cookie、令牌和 CSRF,并禁用自动 Cookie 注入;切换后丢弃旧账号的过期响应。
  • 登录方式:密码、短信、扫码、Cookie。保留密码登录的极验和手机号安全验证;短信支持国际区号、极验、重发倒计时及手机号与验证码绑定;扫码支持确认、过期刷新和离开页面停止轮询;Cookie 登录校验有效性及 UID 一致性。
  • 账号导入导出:在“账号与隐私”和“关于”中使用统一的“导入账号/导出账号”文案及图标,兼容 PiliPlus 的 UID 字典 JSON,保留额外 Cookie、访问/刷新令牌及 type 功能分工。空 type 保持未分配;文件选择兼容被文件来源识别为普通数据或文本的 JSON,选择后校验内容。
  • 账号显示与存储:列表及切换菜单显示“用户名(ID)”,缓存用户名;尚未取得名称时显示 ID。凭据和分工保存在本设备 Keychain,兼容旧数据并迁移原单账号凭据;读取或写入失败时保留已存数据。

验证与已知限制

  • 提交 ee70449efecdbd6bcd6df703fedb847a9999100e 已通过未签名 iOS 设备编译及 34 项模拟器单元测试:14 项登录/导入导出、14 项账号/隐私、6 项原有回归测试。
  • 测试覆盖凭据隔离、账号切换与无痕上报、Keychain 迁移及失败处理、模拟登录协议、JSON 往返、用户名持久化与过期响应处理。测试凭据均为虚构数据,未将用户提供的真实账号文件提交到仓库或 CI。
  • 用户反馈账号功能基本可用,并据反馈修复文件选择问题;尚未对真实账号的密码登录、短信送达、扫码确认及多账号播放进行完整实机验证。
  • Cookie 登录不会生成 App 令牌,依赖 App 令牌的部分功能可能不可用;IPA 安装需自行签名。

AI 辅助声明

本 PR 使用 OpenAI Codex(AI) 辅助完成代码实现、测试编写、问题修复及 PR 文案整理。上述自动化验证已实际运行;AI 辅助及测试通过不替代仓库维护者的代码审查和实机验证。

English description

Adds incognito mode for #22, role-based multi-account support, four login methods, and PiliPlus-compatible account import/export.

Features and behavior

  • Incognito mode: suppresses initial, periodic, and final viewing reports and new local search history while preserving existing history and account assignments. Explicit actions such as likes and favorites still use the main account. Incognito does not provide network anonymity.
  • Independent account roles: main, history, recommendation, and playback can each use a selected account or anonymous (0), with a quick all-role switch. Requests keep Cookie, token, and CSRF from the same account, disable automatic Cookie injection, and discard stale account-owned responses after switching.
  • Login methods: password, SMS, QR, and Cookie. Retains password Geetest and phone security verification; SMS supports international dialing codes, Geetest, resend cooldowns, and phone-bound verification credentials. QR login handles confirmation, expiry/refresh, and polling cancellation when leaving the page. Cookie login validates the session and matching UID.
  • Account transfer: matching import/export labels and icons in account settings and About. PiliPlus-compatible UID-keyed JSON preserves additional cookies, access/refresh tokens, and role type arrays; empty arrays remain unassigned. Account import accepts JSON files reported as generic data/text by file providers and validates their contents after selection.
  • Display and storage: lists and switch menus show username (UID), cache names, and fall back to UID when no name is available. Credentials and assignments are stored in device-only Keychain, with backward compatibility, legacy single-account migration, and protection against overwriting stored data after read/write failures.

Validation and limitations

  • Commit ee70449efecdbd6bcd6df703fedb847a9999100e passed unsigned iOS device compilation and 34 simulator unit tests: 14 authentication/transfer, 14 account/privacy, and 6 existing regression tests.
  • Coverage includes credential isolation, account switching and incognito reporting, Keychain migration/failures, mocked login protocols, JSON round trips, username persistence, and stale-response handling. Test credentials are fictitious; the user's actual account export was not committed or sent to CI.
  • The user reported that account functionality was broadly usable, and the file selection issue was subsequently addressed. Full real-device validation of password login, SMS delivery, QR confirmation, and playback with real accounts remains outstanding.
  • Cookie login does not obtain App tokens, so capabilities requiring them may be unavailable. Installing the IPA requires signing.

AI assistance disclosure

This PR used OpenAI Codex (AI) to assist with implementation, test authoring, fixes, and the PR description. The stated automated checks were actually executed. AI assistance and passing tests do not replace maintainer review or real-device validation.

构建与附件 / Build and artifacts

@NZJ-Jimmy NZJ-Jimmy changed the title feat: add incognito browsing and role-based multi-account login feat: add incognito, role-based accounts and four login methods Oct 3, 2026
@NZJ-Jimmy NZJ-Jimmy changed the title feat: add incognito, role-based accounts and four login methods feat: 无痕模式与多账号登录 / Incognito mode and multi-account login Oct 3, 2026
@NZJ-Jimmy
NZJ-Jimmy marked this pull request as ready for review October 3, 2026 09:03
Copilot AI balanced review requested due to automatic review settings October 3, 2026 09:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

[Feat] 隐私(无痕)模式

2 participants