Add optional GitHub Star developer unlock - #37
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthrough新增基于GitHub OAuth Device Flow的Star验证流程用于激活开发者模式:定义数据结构与存储键、扩展HttpClient原始请求能力、实现GitHubStarVerifier核心逻辑、在Settings页面集成完整验证UI流程;同步更新隐私政策、新增OAuth配置模板、扩展CI脚本以支持ScanKit补丁和配置文件占位生成。 ChangesGitHub Star验证Developer Mode解锁
CI脚本扩展
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@entry/src/main/ets/pages/SettingsPageV2.ets`:
- Around line 3904-3906: The code currently writes the GitHub access token into
long-lived preferences via
PreferencesUtil.put(SettingsKeys.DEV_GITHUB_ACCESS_TOKEN, accessToken) in
SettingsPageV2.ets; instead, stop persisting the raw token in PreferencesUtil:
store it in a secure credential store (e.g., platform secure storage/keystore
API) or keep it only in-memory for the session and clear it immediately after
use. Replace the PreferencesUtil.put call for
SettingsKeys.DEV_GITHUB_ACCESS_TOKEN with a secure-storage write (or remove
persistence and use a transient in-memory/session variable) and ensure any
retrieval logic expects the secure store or session-only token; leave the
non-sensitive SettingsKeys.DEV_GITHUB_LOGIN write intact if desired.
- Around line 3888-3891: The PENDING/SLOW_DOWN branch is calling
saveDeveloperPendingDeviceCode(deviceCode) which recomputes expires_at (current
time + expiresInSeconds) and thus keeps extending local expiry; instead only
update the polling interval without touching expires_at. Change the branch
handling PENDING/SLOW_DOWN to set deviceCode.intervalSeconds and persist it with
a method that preserves the existing expires_at (either add an optional
parameter preserveExpiry:boolean to saveDeveloperPendingDeviceCode and call
saveDeveloperPendingDeviceCode(deviceCode, {preserveExpiry: true}) or introduce
a new helper like updateDeveloperPendingDeviceCodeInterval(deviceCode) that
updates only intervalSeconds in storage). Ensure the code paths that
compute/overwrite expires_at (inside saveDeveloperPendingDeviceCode) are skipped
when preserveExpiry is requested.
In `@entry/src/main/ets/utils/GitHubStarVerifier.ets`:
- Around line 241-246: The githubApiHeaders function is missing a User-Agent
header which can cause GitHub to reject requests; update
GitHubStarVerifier.githubApiHeaders to include a stable User-Agent (e.g. add a
static constant like GitHubStarVerifier.USER_AGENT and set headers['User-Agent']
= GitHubStarVerifier.USER_AGENT) so fetchLogin and checkStar (which reuse
githubApiHeaders) inherit the header; no other call-site changes required beyond
creating the USER_AGENT constant and returning it in githubApiHeaders.
In `@PRIVACY_POLICY.md`:
- Around line 95-96: PRIVACY_POLICY.md now documents that the app calls GitHub
OAuth Device Flow and GitHub API for optional developer-mode GitHub Star
verification, but the in-app PrivacyPolicyDialog in SettingsPageV2.ets
(component PrivacyPolicyDialog) still states “no internet data transfer / no
third-party services”; update the PrivacyPolicyDialog text to match the
PRIVACY_POLICY.md disclosure by changing the relevant copy in
PrivacyPolicyDialog (in entry/src/main/ets/pages/SettingsPageV2.ets) to
explicitly mention the optional GitHub OAuth Device Flow and GitHub API usage
for developer-mode Star verification (or rephrase to a consistent statement that
third‑party services are used only for that optional verification), ensuring
both documents convey the same scope and optional nature of the GitHub
third‑party interaction.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a1370f28-5dd0-424b-ac8a-cce1eb3b9a62
📒 Files selected for processing (7)
PRIVACY_POLICY.mdentry/src/main/ets/config/GitHubOAuthConfig.etsentry/src/main/ets/config/GitHubOAuthConfig.ets.exampleentry/src/main/ets/pages/SettingsPageV2.etsentry/src/main/ets/service/SettingsService.etsentry/src/main/ets/utils/GitHubStarVerifier.etsentry/src/main/ets/utils/HttpClient.ets
Summary
GET /user/starred/{owner}/{repo}after authorization.GITHUB_OAUTH_CLIENT_IDis configured, while preserving the existing activation-code path as fallback.AppGallery / HarmonyOS Market Notes
qiin2333/moonlight-vplususes GitHub OAuth Device Flow plus GitHub Star verification for developer feature unlock.GITHUB_OAUTH_CLIENT_IDempty unless review confirms this is acceptable.Configuration
entry/src/main/ets/config/GitHubOAuthConfig.etsGITHUB_OAUTH_CLIENT_ID = ''by default, so GitHub Star unlock is disabled.AlkaidLab/moonlight-harmony.Verification
DEVECO_SDK_HOME=/Applications/DevEco-Studio.app/Contents/sdk sh ./hvigorw --mode module -p module=entry assembleHap --no-daemon:entry:default@CompileArkTScompleted successfully.:entry:default@PackageHapbecause this local machine has no Java Runtime installed: “Unable to locate a Java Runtime.”Summary by CodeRabbit
发行说明
新功能
文档
Chores