feat: some improvements#193
Conversation
This reverts commit 2d4757c.
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep Github App |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Walkthrough此PR移除了trackService中的重复标题验证逻辑,将Orpheus网络库从Cronet迁移至OkHttp用于Media3支持,启用R8混淆,改进Sentry错误报告处理非Error类型的方式,并提升应用版本号。 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 行)在启用
recommendedTypeChecked和stylisticTypeChecked的严格类型检查模式下,直接将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字段),则可以忽略此建议。
| 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") |
There was a problem hiding this comment.
🧩 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 -20Repository: bbplayer-app/BBPlayer
Length of output: 236
🏁 Script executed:
cat -n packages/orpheus/android/src/main/java/expo/modules/orpheus/network/OkHttpClientManager.ktRepository: 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.ktRepository: bbplayer-app/BBPlayer
Length of output: 141
🏁 Script executed:
git show --stat 8899a82Repository: 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 -150Repository: 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 -200Repository: 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 -200Repository: 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 -20Repository: bbplayer-app/BBPlayer
Length of output: 193
🏁 Script executed:
git show 835958e -- packages/orpheus/android/src/main/java/expo/modules/orpheus/util/DownloadUtil.ktRepository: 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 iffollowRedirectsis 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:
- 1: https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/-builder/follow-redirects.html?utm_source=openai
- 2: https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/-builder/follow-ssl-redirects.html?utm_source=openai
- 3: https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/-builder/follow-redirects.html?utm_source=openai
确认 OkHttpClient 默认支持跨协议重定向,但建议显式配置以提高代码可维护性。
代码从 DefaultHttpDataSource.Factory (显式调用 .setAllowCrossProtocolRedirects(true)) 切换到 OkHttpDataSource.Factory。虽然 OkHttpClient 的默认配置 (followRedirects=true、followSslRedirects=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.
* 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>
* 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>
Summary by CodeRabbit
发布说明 - v2.2.5
缺陷修复
性能优化
改进
✏️ Tip: You can customize this high-level summary in your review settings.