Repository navigation
fix: 结构化错误、业务码检查、HTTP 总时限、凭证原子写入(0.1.2) - #1
Merged
Merged
Conversation
- MusicApiException 增加 kind(MusicErrorKind)与 platformCode;网络、超时、 非 JSON 响应、业务错误统一抛它,不再漏出 Gson / IOException / NPE。 - 网易云 weapi 检查 body 里的 code:301 归为 NOT_LOGGED_IN,-460/-461/-462/405 归为 RISK_CONTROL,不再把登录过期、风控当成空列表静默返回;getLoginUid 在 未登录时仍返回 null。QQ musicu 的 code=1000 归为 NOT_LOGGED_IN。 - MusicHttp:读响应体时检查总时限(默认 30 秒),响应体上限 16 MB;正常完成的 连接不再 disconnect,交给 keep-alive 复用;失败路径在 finally 中断开。 - QQ 扫码:每张二维码独立的 cookie jar,同一张二维码的轮询串行;被新二维码取代 的旧轮询得到 EXPIRED,不再与新会话共用、清空同一个 jar。凭证字段 @volatile。 - 剩余的 asString/asInt/asJsonObject/数组越界改为安全访问。 - 日志脱敏:不再输出 qm_keyst 片段、搜索词、授权跳转地址;授权失败的异常信息 只保留 status 与 title,响应原文只进 debug。
先写同目录临时文件(POSIX 下创建即为 rw-------),再 ATOMIC_MOVE 替换正式文件, 写到一半崩溃不会留下半截 JSON;load 时把旧版本写成 0644 的文件收紧为 0600。 load/set/clear 在实例锁内执行,扫码线程、异步池、渲染线程并发写不再互相覆盖。
逐字文本改为取相邻时间戳之间的子串,「(」或以「(」开头的和声字不再被整段跳过 (原来 "Hold (ooh) me" 会解析成 "Hold ooh) me")。翻译对齐改为在 500ms 容差内 取差值最小的一条,与注释一致。
checkQrCode 只在请求前校验一次会话,authorize 链要串行请求多次, 期间 clearLogin 或 createQrCode 后旧轮询仍会写入 musicid/musicKey 并返回 CONFIRMED。 authorizeQq 改为返回凭证,提交前在 loginLock 内确认会话仍为当前会话, 否则丢弃并返回 EXPIRED;ptqrlogin 返回后同样复查。 MusicHttp 请求方法改为 open 以便测试替换网络层,补充登录竞态单测。
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.
修复全量审查中 Cadence 相关的问题(libs-8~13、16)。
行为变化:网易云遇到业务码会抛出 MusicApiException,不再静默返回空列表。宿主需要捕获异常并映射成列表状态,Edge 和 Nova 已适配。
验证:./gradlew clean build publishToMavenLocal 通过。