Skip to content

feat: some improvements#193

Merged
roitium merged 8 commits into
devfrom
feat/nitro-fetch
Jan 31, 2026
Merged

feat: some improvements#193
roitium merged 8 commits into
devfrom
feat/nitro-fetch

Conversation

@roitium
Copy link
Copy Markdown
Collaborator

@roitium roitium commented Jan 31, 2026

Summary by CodeRabbit

发布说明 - v2.2.5

  • 缺陷修复

    • 修复了错误报告中非错误类型的显示问题
  • 性能优化

    • 在发布版本中启用 R8 混淆和资源缩减,改进应用性能和包体积
  • 改进

    • 移除重复的标题验证逻辑,简化曲目操作流程

✏️ Tip: You can customize this high-level summary in your review settings.

@roitium roitium added the enhancement New feature or request label Jan 31, 2026
@safedep
Copy link
Copy Markdown

safedep Bot commented Jan 31, 2026

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

This report is generated by SafeDep Github App

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bbplayer-docs Ready Ready Preview, Comment Jan 31, 2026 3:46am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 31, 2026

Walkthrough

此PR移除了trackService中的重复标题验证逻辑,将Orpheus网络库从Cronet迁移至OkHttp用于Media3支持,启用R8混淆,改进Sentry错误报告处理非Error类型的方式,并提升应用版本号。

Changes

Cohort / File(s) Summary
版本与变更日志
apps/mobile/CHANGELOG.md, apps/mobile/package.json
记录UNRELEASED版本变更,移除重复标题检查、Cronet至OkHttp迁移、R8混淆启用和Sentry非Error类型修复;版本号从2.2.4升至2.2.5。
构建配置优化
apps/mobile/app.config.ts
在Android发布构建中启用混淆和资源压缩;引入ProGuard规则以抑制特定警告,保留Retrofit和Kotlin协程相关类。
错误处理改进
apps/mobile/src/lib/errors/service.ts, apps/mobile/src/utils/log.ts
移除TrackAlreadyExists错误类型及其构造函数;在reportErrorToSentry中引入stringifyError辅助函数以正确处理非Error类型。
TrackService简化
apps/mobile/src/lib/services/trackService.ts
移除重复标题验证逻辑和相关的createTrackAlreadyExists导入,简化轨道创建和更新流程。
代码清理
apps/mobile/index.js
移除Platform导入和启动时的console.log调用。
OkHttp网络迁移
packages/orpheus/android/build.gradle, packages/orpheus/android/src/main/java/expo/modules/orpheus/network/OkHttpClientManager.kt, packages/orpheus/android/src/main/java/expo/modules/orpheus/util/DownloadUtil.kt
添加Kotlin KAPT插件和OkHttp依赖;降级Glide从5.0.5至4.16.0;引入OkHttpClientManager单例管理HTTP客户端;将DefaultHttpDataSource.Factory替换为OkHttpDataSource.Factory。
数据模型扩展
packages/orpheus/android/src/main/java/expo/modules/orpheus/bilibili/BilibiliModels.kt, packages/orpheus/android/src/main/java/expo/modules/orpheus/bilibili/NetworkModule.kt
在BilibiliAudioStreamResponse中添加dash字段;引入BilibiliApiResponse和多个新数据类(DashData、DolbyData等)并添加\@keep注解;重构NetworkModule中的OkHttpClient构建方式。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 在代码森林里欢快跳跃
去掉重复的检查,轻松又畅快
OkHttp来替班,网络更通畅
R8的混淆术,安全护周详
版本号升升升,功能更闪亮✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/nitro-fetch

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/mobile/app.config.ts (1)

12-18: ⚠️ Potential issue | 🟠 Major

修复 @typescript-eslint/no-unsafe-assignment(第 12 行)

在启用 recommendedTypeCheckedstylisticTypeChecked 的严格类型检查模式下,直接将 process.env 属性赋值给变量会触发类型不安全警告。建议显式指定类型以消除此警告。

🛠️ 建议修复
-	const versionCodeEnv = process.env.VERSION_CODE ?? undefined
+	const versionCodeEnv = (process.env as Record<string, string | undefined>).VERSION_CODE
🤖 Fix all issues with AI agents
In
`@packages/orpheus/android/src/main/java/expo/modules/orpheus/util/DownloadUtil.kt`:
- Around line 82-85: The OkHttpDataSource.Factory usage in getUpstreamFactory
relies on OkHttpClientManager.okHttpClient to allow cross-protocol redirects;
make this explicit by updating the OkHttpClient instance construction in
OkHttpClientManager.okHttpClient to call .followSslRedirects(true) (and keep
.followRedirects(true) if present) and add a short comment explaining this is to
explicitly allow HTTPS↔HTTP cross-protocol redirects for media redirects;
reference getUpstreamFactory, OkHttpDataSource.Factory, and
OkHttpClientManager.okHttpClient when making the change.
🧹 Nitpick comments (1)
packages/orpheus/android/src/main/java/expo/modules/orpheus/bilibili/BilibiliModels.kt (1)

61-65: 考虑使用泛型 BilibiliApiResponse<NavData> 替代。

BilibiliNavResponse 单独定义了 code 字段,与上面的泛型 BilibiliApiResponse<TData> 模式不一致。如果 API 响应结构兼容(即也包含 message 字段),建议统一使用泛型包装类以减少重复代码。

如果 API 响应结构确实不同(例如缺少 message 字段),则可以忽略此建议。

Comment on lines 82 to +85
private fun getUpstreamFactory(): DataSource.Factory {
val httpDataSourceFactory = DefaultHttpDataSource.Factory()
.setUserAgent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36")
.setAllowCrossProtocolRedirects(true)
val httpDataSourceFactory = androidx.media3.datasource.okhttp.OkHttpDataSource.Factory(
expo.modules.orpheus.network.OkHttpClientManager.okHttpClient
).setUserAgent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

fd -t f "DownloadUtil.kt" --exec head -20 {} \;

Repository: bbplayer-app/BBPlayer

Length of output: 942


🏁 Script executed:

fd -t f "OkHttpClientManager.kt" --exec wc -l {} \;

Repository: bbplayer-app/BBPlayer

Length of output: 160


🏁 Script executed:

git ls-files | grep -E "(DownloadUtil|OkHttpClientManager)" | head -20

Repository: bbplayer-app/BBPlayer

Length of output: 236


🏁 Script executed:

cat -n packages/orpheus/android/src/main/java/expo/modules/orpheus/network/OkHttpClientManager.kt

Repository: bbplayer-app/BBPlayer

Length of output: 545


🏁 Script executed:

cat -n packages/orpheus/android/src/main/java/expo/modules/orpheus/util/DownloadUtil.kt | sed -n '70,100p'

Repository: bbplayer-app/BBPlayer

Length of output: 1414


🏁 Script executed:

git log --oneline -20 -- packages/orpheus/android/src/main/java/expo/modules/orpheus/util/DownloadUtil.kt

Repository: bbplayer-app/BBPlayer

Length of output: 141


🏁 Script executed:

git show --stat 8899a82

Repository: bbplayer-app/BBPlayer

Length of output: 35203


🏁 Script executed:

git show 8899a82 -- packages/orpheus/android/src/main/java/expo/modules/orpheus/util/DownloadUtil.kt | head -150

Repository: bbplayer-app/BBPlayer

Length of output: 6483


🏁 Script executed:

git log -p -1 8899a82 -- packages/orpheus/android/src/main/java/expo/modules/orpheus/util/DownloadUtil.kt | head -200

Repository: bbplayer-app/BBPlayer

Length of output: 47


🏁 Script executed:

git show 2d4757cd3b4d521869e5eca8278c0fd836ae700b -- packages/orpheus/android/src/main/java/expo/modules/orpheus/util/DownloadUtil.kt | head -200

Repository: bbplayer-app/BBPlayer

Length of output: 47


🏁 Script executed:

git log --all --oneline -- packages/orpheus/android/src/main/java/expo/modules/orpheus/util/DownloadUtil.kt | head -20

Repository: bbplayer-app/BBPlayer

Length of output: 193


🏁 Script executed:

git show 835958e -- packages/orpheus/android/src/main/java/expo/modules/orpheus/util/DownloadUtil.kt

Repository: bbplayer-app/BBPlayer

Length of output: 6783


🌐 Web query:

OkHttpDataSource.Factory setAllowCrossProtocolRedirects media3

💡 Result:

OkHttpDataSource.Factory (Media3 media3-datasource-okhttp) does not expose setAllowCrossProtocolRedirects(...); that API exists on DefaultHttpDataSource.Factory (the HttpURLConnection-based implementation) instead. [1], [2]

With OkHttpDataSource, cross-protocol redirects (HTTP↔HTTPS) are controlled by the OkHttpClient you pass in—specifically followRedirects and followSslRedirects (which governs HTTP↔HTTPS redirects). [1], [3]

val client = OkHttpClient.Builder()
  .followRedirects(true)
  .followSslRedirects(true) // allow HTTP <-> HTTPS redirects
  .build()

val dataSourceFactory = OkHttpDataSource.Factory(client)

Sources:
[1] OkHttpDataSource.Factory (Media3) API reference
[2] DefaultHttpDataSource.Factory setAllowCrossProtocolRedirects API reference
[3] OkHttp followSslRedirects API reference


🌐 Web query:

OkHttpClient followRedirects cross-protocol redirect https http

💡 Result:

In OkHttp, cross‑protocol redirects (HTTP ⇄ HTTPS) are controlled by two flags:

  • followRedirects(true/false): master switch for all redirects. Default is true. (square.github.io)
  • followSslRedirects(true/false): allows redirects between HTTPS and HTTP (i.e., scheme/protocol changes). This is only considered if followRedirects is enabled. Default is true. (square.github.io)

So, to block HTTPS → HTTP (downgrade) redirects (and also HTTP → HTTPS), do:

OkHttpClient client = new OkHttpClient.Builder()
    .followRedirects(true)        // still follow same-scheme redirects
    .followSslRedirects(false)    // do NOT follow HTTPS<->HTTP redirects
    .build();

If you set followRedirects(false), no redirects are followed at all, regardless of followSslRedirects. (square.github.io)

Citations:


确认 OkHttpClient 默认支持跨协议重定向,但建议显式配置以提高代码可维护性。

代码从 DefaultHttpDataSource.Factory (显式调用 .setAllowCrossProtocolRedirects(true)) 切换到 OkHttpDataSource.Factory。虽然 OkHttpClient 的默认配置 (followRedirects=truefollowSslRedirects=true) 已支持 HTTPS↔HTTP 跨协议重定向,但建议在 OkHttpClientManager.okHttpClient 中显式调用 .followSslRedirects(true),并添加注释说明此行为,以避免未来维护时的混淆。

🤖 Prompt for AI Agents
In
`@packages/orpheus/android/src/main/java/expo/modules/orpheus/util/DownloadUtil.kt`
around lines 82 - 85, The OkHttpDataSource.Factory usage in getUpstreamFactory
relies on OkHttpClientManager.okHttpClient to allow cross-protocol redirects;
make this explicit by updating the OkHttpClient instance construction in
OkHttpClientManager.okHttpClient to call .followSslRedirects(true) (and keep
.followRedirects(true) if present) and add a short comment explaining this is to
explicitly allow HTTPS↔HTTP cross-protocol redirects for media redirects;
reference getUpstreamFactory, OkHttpDataSource.Factory, and
OkHttpClientManager.okHttpClient when making the change.

@roitium roitium merged commit f46e992 into dev Jan 31, 2026
4 of 5 checks passed
roitium added a commit that referenced this pull request Feb 8, 2026
* fix(mobile): fix version code getter logic

* Merge pull request #193 from bbplayer-app/feat/nitro-fetch

* fix(orpheus, mobile): disable usesCleartextTraffic, only allow hdslb.com use http

* fix(mobile): disable r8

* fix(mobile): update proguard rules and enable R8

* chore(mobile): disable r8

* fix(mobile): r8 made @nandrorjo/galeria raise error

* feat: sync external playlist (#194)

* feat(mobile): e2e (#195)

* feat(mobile): 1 (#196)

* fix(mobile): add more current state check

I don't know why, but I hope it will work.

* feat(mobile): some improvements (#198)

* feat(orpheus): enhance backend retention capabilities

* fix(mobile): player page setpage

* fix(orpheus): allow androidx.media3.player wrapping in REPEAT_MODE_ONE (#199)

* fix(orpheus): allow androidx.media3.player wrapping in REPEAT_MODE_ONE

* chore(mobile): update changelog

---------

Co-authored-by: roitium <65794453+roitium@users.noreply.github.com>

* feat(mobile): improve playlist UI (#200)

* feat(mobile): 1

* feat(mobile): 1

* feat(mobile): 1

* feat(mobile): 1

* feat(mobile): 1

* feat(mobile): 1

* feat(mobile): verbatim lyrics (#201)

* feat(mobile, splash): improve verbatim lyrics

* perf(mobile): improve verbatim lyrics perf

* fix(mobile): player slider cannot slide

* fix(mobile): react compiler in PlayerLyrics

* chore(mobile): remove reanimated logger config

* chore(mobile): edit changelog

* fix(mobile): desktop lyrics not work

* feat(mobile): add firebase analytics integration (#203)

* fix(mobile): improve UI on small screen devices

* perf(mobile): some perf improvements

* feat(mobile): firebase

* feat(mobile): add firebase analytics track

* chore(mobile): update privacy

* chore(mobile): use firebase analytics new api

* chore(root): move some libraries

* fix(mobile): type

* chore(root, mobile): update package.json

* chore(docs): update docs

* chore(docs): update docs

* chore(docs): update docs

* chore(root): wiki

* chore(root): wiki

* chore(orpheus): wiki

* feat(mobile): danmaku (#205)

* feat(mobile): implement bilibili danmaku api

* fix(mobile): use `useWindowDimensions` instead of `Dimensions.get`

* feat(mobile): implement

* fix(mobile): 1

* chore(mobile): bump version

* chore(mobile): update changelog

* ci(mobile): wrong secret key

* fix(root): ci not work

* chore(root): just make sure

* chore(root): remove unnecessary easignore

* chore(root): remove unnecessary easignore

* chore(root): update update json

---------

Co-authored-by: Deyu Wang <kvtoDev@outlook.com>
roitium added a commit that referenced this pull request Feb 9, 2026
* fix(mobile): fix version code getter logic

* Merge pull request #193 from bbplayer-app/feat/nitro-fetch

* fix(orpheus, mobile): disable usesCleartextTraffic, only allow hdslb.com use http

* fix(mobile): disable r8

* fix(mobile): update proguard rules and enable R8

* chore(mobile): disable r8

* fix(mobile): r8 made @nandrorjo/galeria raise error

* feat: sync external playlist (#194)

* feat(mobile): e2e (#195)

* feat(mobile): 1 (#196)

* fix(mobile): add more current state check

I don't know why, but I hope it will work.

* feat(mobile): some improvements (#198)

* feat(orpheus): enhance backend retention capabilities

* fix(mobile): player page setpage

* fix(orpheus): allow androidx.media3.player wrapping in REPEAT_MODE_ONE (#199)

* fix(orpheus): allow androidx.media3.player wrapping in REPEAT_MODE_ONE

* chore(mobile): update changelog

---------

Co-authored-by: roitium <65794453+roitium@users.noreply.github.com>

* feat(mobile): improve playlist UI (#200)

* feat(mobile): 1

* feat(mobile): 1

* feat(mobile): 1

* feat(mobile): 1

* feat(mobile): 1

* feat(mobile): 1

* feat(mobile): verbatim lyrics (#201)

* feat(mobile, splash): improve verbatim lyrics

* perf(mobile): improve verbatim lyrics perf

* fix(mobile): player slider cannot slide

* fix(mobile): react compiler in PlayerLyrics

* chore(mobile): remove reanimated logger config

* chore(mobile): edit changelog

* fix(mobile): desktop lyrics not work

* feat(mobile): add firebase analytics integration (#203)

* fix(mobile): improve UI on small screen devices

* perf(mobile): some perf improvements

* feat(mobile): firebase

* feat(mobile): add firebase analytics track

* chore(mobile): update privacy

* chore(mobile): use firebase analytics new api

* chore(root): move some libraries

* fix(mobile): type

* chore(root, mobile): update package.json

* chore(docs): update docs

* chore(docs): update docs

* chore(docs): update docs

* chore(root): wiki

* chore(root): wiki

* chore(orpheus): wiki

* feat(mobile): danmaku (#205)

* feat(mobile): implement bilibili danmaku api

* fix(mobile): use `useWindowDimensions` instead of `Dimensions.get`

* feat(mobile): implement

* fix(mobile): 1

* chore(mobile): bump version

* chore(mobile): update changelog

* ci(mobile): wrong secret key

* fix(root): ci not work

* chore(root): just make sure

* chore(root): remove unnecessary easignore

* chore(root): remove unnecessary easignore

* chore(root): update update json

* fix(mobile): auto compile protobuf when prepare

* chore(root): update app screenshots

* fix(mobile): player controls button not work (#208)

* fix(mobile): remove player page animation (#212)

* fix(mobile): remove player page animation

* chore(mobile): bump version

* fix(mobile): cover

* chore(mobile): Bump version to 2.3.1 and update release URL

Updated version and URL for the release notes.

---------

Co-authored-by: Deyu Wang <kvtoDev@outlook.com>
@roitium roitium deleted the feat/nitro-fetch branch February 28, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant