From d5d3e61e303ef2fb716a942c4e7b5a98a1ee7189 Mon Sep 17 00:00:00 2001 From: Zhaohui Huang Date: Mon, 6 Jul 2026 19:09:41 -1100 Subject: [PATCH] backup repo --- .github/ISSUE_TEMPLATE/bug_report.yml | 101 + .github/ISSUE_TEMPLATE/config.yml | 8 + .github/ISSUE_TEMPLATE/feature_request.yml | 31 + .github/ISSUE_TEMPLATE/new_server.yml | 40 + .github/dependabot.yml | 23 + .github/workflows/PR.yml | 52 + .github/workflows/android.yml | 77 + .gitignore | 11 + .gitmodules | 3 + LICENSE | 674 +++++ README.md | 77 + app/.gitignore | 3 + app/build.gradle.kts | 186 ++ app/proguard-rules.pro | 41 + app/src/.gitignore | 1 + app/src/main/AndroidManifest.xml | 59 + app/src/main/assets/xhook.js | 7 + app/src/main/assets/xposed_init | 1 + .../iacn/biliroaming/ARGBColorChooseDialog.kt | 111 + .../me/iacn/biliroaming/BaseWidgetDialog.kt | 264 ++ .../me/iacn/biliroaming/BiliBiliPackage.kt | 2523 +++++++++++++++++ .../me/iacn/biliroaming/ColorChooseDialog.kt | 92 + .../iacn/biliroaming/CommentFilterDialog.kt | 111 + .../main/java/me/iacn/biliroaming/Constant.kt | 27 + .../iacn/biliroaming/CustomSubtitleDialog.kt | 192 ++ .../iacn/biliroaming/DynamicFilterDialog.kt | 170 ++ .../me/iacn/biliroaming/HomeFilterDialog.kt | 152 + .../java/me/iacn/biliroaming/MainActivity.kt | 205 ++ .../me/iacn/biliroaming/SearchFilterDialog.kt | 78 + .../java/me/iacn/biliroaming/SettingDialog.kt | 1188 ++++++++ .../me/iacn/biliroaming/SpeedTestDialog.kt | 165 ++ .../me/iacn/biliroaming/VideoExportDialog.kt | 137 + .../java/me/iacn/biliroaming/XposedInit.kt | 223 ++ .../biliroaming/hook/AllowMiniPlayHook.kt | 37 + .../me/iacn/biliroaming/hook/AutoLikeHook.kt | 120 + .../biliroaming/hook/BangumiPageAdHook.kt | 32 + .../biliroaming/hook/BangumiPlayUrlHook.kt | 1128 ++++++++ .../biliroaming/hook/BangumiSeasonHook.kt | 1720 +++++++++++ .../java/me/iacn/biliroaming/hook/BaseHook.kt | 10 + .../iacn/biliroaming/hook/BlockUpdateHook.kt | 20 + .../iacn/biliroaming/hook/CommentImageHook.kt | 97 + .../iacn/biliroaming/hook/CopyCommentHook.kt | 49 + .../java/me/iacn/biliroaming/hook/CopyHook.kt | 186 ++ .../me/iacn/biliroaming/hook/CoverHook.kt | 214 ++ .../iacn/biliroaming/hook/CustomThemeHook.kt | 250 ++ .../me/iacn/biliroaming/hook/DanmakuHook.kt | 42 + .../hook/DialogBlurBackgroundHook.kt | 17 + .../biliroaming/hook/DownloadThreadHook.kt | 67 + .../me/iacn/biliroaming/hook/DrawerHook.kt | 96 + .../me/iacn/biliroaming/hook/DynamicHook.kt | 221 ++ .../java/me/iacn/biliroaming/hook/EnvHook.kt | 136 + .../me/iacn/biliroaming/hook/FullStoryHook.kt | 14 + .../java/me/iacn/biliroaming/hook/GsonHook.kt | 52 + .../java/me/iacn/biliroaming/hook/HintHook.kt | 28 + .../java/me/iacn/biliroaming/hook/JsonHook.kt | 605 ++++ .../biliroaming/hook/KillDelayBootHook.kt | 16 + .../iacn/biliroaming/hook/KotlinxJsonHook.kt | 51 + .../iacn/biliroaming/hook/LiveQualityHook.kt | 198 ++ .../me/iacn/biliroaming/hook/LiveRoomHook.kt | 66 + .../iacn/biliroaming/hook/LongPressSpeed.kt | 23 + .../iacn/biliroaming/hook/MultiWindowHook.kt | 21 + .../biliroaming/hook/MusicNotificationHook.kt | 50 + .../java/me/iacn/biliroaming/hook/P2pHook.kt | 39 + .../me/iacn/biliroaming/hook/PegasusHook.kt | 784 +++++ .../iacn/biliroaming/hook/PlayArcConfHook.kt | 225 ++ .../biliroaming/hook/PlayerLongPressHook.kt | 31 + .../me/iacn/biliroaming/hook/ProtoBufHook.kt | 463 +++ .../hook/PublishToFollowingHook.kt | 18 + .../me/iacn/biliroaming/hook/QualityHook.kt | 22 + .../me/iacn/biliroaming/hook/RewardAdHook.kt | 23 + .../java/me/iacn/biliroaming/hook/SSLHook.kt | 168 ++ .../me/iacn/biliroaming/hook/SettingHook.kt | 243 ++ .../me/iacn/biliroaming/hook/ShareHook.kt | 118 + .../me/iacn/biliroaming/hook/SpeedHook.kt | 27 + .../me/iacn/biliroaming/hook/SplashHook.kt | 145 + .../biliroaming/hook/StartActivityHook.kt | 98 + .../biliroaming/hook/StoryPlayerAdHook.kt | 66 + .../me/iacn/biliroaming/hook/SubtitleHook.kt | 464 +++ .../biliroaming/hook/TeenagersModeHook.kt | 27 + .../hook/TryWatchVipQualityHook.kt | 15 + .../iacn/biliroaming/hook/UposReplaceHook.kt | 88 + .../iacn/biliroaming/hook/VideoQualityHook.kt | 54 + .../iacn/biliroaming/hook/VipSectionHook.kt | 40 + .../me/iacn/biliroaming/hook/WebViewHook.kt | 89 + .../biliroaming/hook/gson/GsonProcessor.kt | 12 + .../hook/gson/SplashListProcessor.kt | 17 + .../hook/gson/SplashShowProcessor.kt | 16 + .../hook/kotlinx/KotlinxProcessor.kt | 12 + .../kotlinx/KotlinxSplashListProcessor.kt | 22 + .../kotlinx/KotlinxSplashShowProcessor.kt | 24 + .../me/iacn/biliroaming/hook/skipVideoAd.kt | 132 + .../biliroaming/network/BiliRoamingApi.kt | 685 +++++ .../biliroaming/utils/BilibiliSponsorBlock.kt | 110 + .../me/iacn/biliroaming/utils/Coroutines.kt | 17 + .../me/iacn/biliroaming/utils/DexHelper.java | 82 + .../biliroaming/utils/KotlinXposedHelper.kt | 498 ++++ .../java/me/iacn/biliroaming/utils/Log.kt | 90 + .../me/iacn/biliroaming/utils/StrokeSpan.kt | 52 + .../iacn/biliroaming/utils/SubtitleHelper.kt | 204 ++ .../biliroaming/utils/UposReplaceHelper.kt | 140 + .../java/me/iacn/biliroaming/utils/Utils.kt | 480 ++++ .../biliroaming/utils/json/FastjsonHelper.kt | 24 + .../iacn/biliroaming/utils/json/GsonHelper.kt | 27 + .../iacn/biliroaming/utils/json/JsonHelper.kt | 51 + app/src/main/jni/CMakeLists.txt | 25 + app/src/main/jni/biliroaming.cc | 1053 +++++++ .../main/proto/me/iacn/biliroaming/api.proto | 1527 ++++++++++ .../proto/me/iacn/biliroaming/configs.proto | 420 +++ app/src/main/res/drawable/demo.webp | Bin 0 -> 6124 bytes app/src/main/res/drawable/demo2.webp | Bin 0 -> 9124 bytes app/src/main/res/drawable/ic_clear.xml | 10 + .../res/drawable/ic_launcher_foreground.xml | 276 ++ app/src/main/res/drawable/tp.webp | Bin 0 -> 5046 bytes .../main/res/layout/cdn_speedtest_item.xml | 24 + app/src/main/res/layout/custom_button.xml | 118 + .../res/layout/custom_subtitle_dialog.xml | 457 +++ .../res/layout/customize_backup_dialog.xml | 85 + .../res/layout/dialog_argb_color_choose.xml | 193 ++ .../main/res/layout/dialog_color_choose.xml | 147 + app/src/main/res/layout/feature.xml | 36 + app/src/main/res/layout/search_bar.xml | 35 + app/src/main/res/layout/seekbar_dialog.xml | 28 + app/src/main/res/layout/video_choose.xml | 42 + .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + app/src/main/res/values-night/colors.xml | 5 + app/src/main/res/values-night/styles.xml | 13 + app/src/main/res/values-zh-rTW/arrays.xml | 156 + app/src/main/res/values-zh-rTW/strings.xml | 290 ++ app/src/main/res/values/arrays.xml | 328 +++ app/src/main/res/values/colors.xml | 5 + app/src/main/res/values/strings.xml | 320 +++ app/src/main/res/values/strings_raw.xml | 38 + app/src/main/res/values/styles.xml | 14 + app/src/main/res/xml/main_activity.xml | 75 + app/src/main/res/xml/prefs_setting.xml | 631 +++++ build.gradle.kts | 0 gradle.properties | 17 + gradle/libs.versions.toml | 27 + gradle/wrapper/gradle-wrapper.properties | 7 + gradlew | 251 ++ gradlew.bat | 94 + imgs/icon.png | Bin 0 -> 206977 bytes imgs/stick1.png | Bin 0 -> 213364 bytes imgs/stick2.png | Bin 0 -> 211502 bytes imgs/stick3.png | Bin 0 -> 189506 bytes imgs/stick4.png | Bin 0 -> 282626 bytes settings.gradle.kts | 18 + 147 files changed, 25311 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/ISSUE_TEMPLATE/new_server.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/PR.yml create mode 100644 .github/workflows/android.yml create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 LICENSE create mode 100644 README.md create mode 100644 app/.gitignore create mode 100644 app/build.gradle.kts create mode 100644 app/proguard-rules.pro create mode 100644 app/src/.gitignore create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/assets/xhook.js create mode 100644 app/src/main/assets/xposed_init create mode 100644 app/src/main/java/me/iacn/biliroaming/ARGBColorChooseDialog.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/BaseWidgetDialog.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/ColorChooseDialog.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/CommentFilterDialog.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/Constant.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/CustomSubtitleDialog.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/DynamicFilterDialog.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/HomeFilterDialog.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/MainActivity.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/SearchFilterDialog.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/SettingDialog.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/SpeedTestDialog.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/VideoExportDialog.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/XposedInit.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/AllowMiniPlayHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/AutoLikeHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/BangumiPageAdHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/BangumiPlayUrlHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/BangumiSeasonHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/BaseHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/BlockUpdateHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/CommentImageHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/CopyCommentHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/CopyHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/CoverHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/CustomThemeHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/DanmakuHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/DialogBlurBackgroundHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/DownloadThreadHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/DrawerHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/DynamicHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/EnvHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/FullStoryHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/GsonHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/HintHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/JsonHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/KillDelayBootHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/KotlinxJsonHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/LiveQualityHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/LiveRoomHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/LongPressSpeed.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/MultiWindowHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/MusicNotificationHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/P2pHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/PegasusHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/PlayArcConfHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/PlayerLongPressHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/ProtoBufHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/PublishToFollowingHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/QualityHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/RewardAdHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/SSLHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/SettingHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/ShareHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/SpeedHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/SplashHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/StartActivityHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/StoryPlayerAdHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/SubtitleHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/TeenagersModeHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/TryWatchVipQualityHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/UposReplaceHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/VideoQualityHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/VipSectionHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/WebViewHook.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/gson/GsonProcessor.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/gson/SplashListProcessor.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/gson/SplashShowProcessor.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/kotlinx/KotlinxProcessor.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/kotlinx/KotlinxSplashListProcessor.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/kotlinx/KotlinxSplashShowProcessor.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/skipVideoAd.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/network/BiliRoamingApi.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/utils/BilibiliSponsorBlock.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/utils/Coroutines.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/utils/DexHelper.java create mode 100644 app/src/main/java/me/iacn/biliroaming/utils/KotlinXposedHelper.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/utils/Log.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/utils/StrokeSpan.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/utils/SubtitleHelper.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/utils/UposReplaceHelper.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/utils/Utils.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/utils/json/FastjsonHelper.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/utils/json/GsonHelper.kt create mode 100644 app/src/main/java/me/iacn/biliroaming/utils/json/JsonHelper.kt create mode 100644 app/src/main/jni/CMakeLists.txt create mode 100644 app/src/main/jni/biliroaming.cc create mode 100644 app/src/main/proto/me/iacn/biliroaming/api.proto create mode 100644 app/src/main/proto/me/iacn/biliroaming/configs.proto create mode 100644 app/src/main/res/drawable/demo.webp create mode 100644 app/src/main/res/drawable/demo2.webp create mode 100644 app/src/main/res/drawable/ic_clear.xml create mode 100644 app/src/main/res/drawable/ic_launcher_foreground.xml create mode 100644 app/src/main/res/drawable/tp.webp create mode 100644 app/src/main/res/layout/cdn_speedtest_item.xml create mode 100644 app/src/main/res/layout/custom_button.xml create mode 100644 app/src/main/res/layout/custom_subtitle_dialog.xml create mode 100644 app/src/main/res/layout/customize_backup_dialog.xml create mode 100644 app/src/main/res/layout/dialog_argb_color_choose.xml create mode 100644 app/src/main/res/layout/dialog_color_choose.xml create mode 100644 app/src/main/res/layout/feature.xml create mode 100644 app/src/main/res/layout/search_bar.xml create mode 100644 app/src/main/res/layout/seekbar_dialog.xml create mode 100644 app/src/main/res/layout/video_choose.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/values-night/colors.xml create mode 100644 app/src/main/res/values-night/styles.xml create mode 100644 app/src/main/res/values-zh-rTW/arrays.xml create mode 100644 app/src/main/res/values-zh-rTW/strings.xml create mode 100644 app/src/main/res/values/arrays.xml create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/strings_raw.xml create mode 100644 app/src/main/res/values/styles.xml create mode 100644 app/src/main/res/xml/main_activity.xml create mode 100644 app/src/main/res/xml/prefs_setting.xml create mode 100644 build.gradle.kts create mode 100644 gradle.properties create mode 100644 gradle/libs.versions.toml create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 imgs/icon.png create mode 100644 imgs/stick1.png create mode 100644 imgs/stick2.png create mode 100644 imgs/stick3.png create mode 100644 imgs/stick4.png create mode 100644 settings.gradle.kts diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..d4a7c4c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,101 @@ +name: 反馈 Bug +description: 反馈遇到的问题 +labels: [bug] +title: "[Bug] " +body: + - type: markdown + attributes: + value: | + 为了使我们更好地帮助你,请提供以下信息。 + - type: textarea + id: desc + attributes: + label: 问题描述 + description: 发生了什么情况?有什么现状? + validations: + required: true + - type: textarea + id: steps + attributes: + label: 复现步骤 + description: 如何复现 + placeholder: | + 1. 打开... + 2. 点击... + 3. 出现...状况 + validations: + required: true + - type: textarea + id: expected + attributes: + label: 预期行为 + description: 正常情况下应该发生什么 + validations: + required: true + - type: textarea + id: actual + attributes: + label: 实际行为 + description: 实际上发生了什么 + validations: + required: true + - type: textarea + id: media + attributes: + label: 截图或录屏 + description: 问题复现时候的截图或录屏 + placeholder: 点击文本框下面小长条可以上传文件 + - type: input + id: android-ver + attributes: + label: 安卓版本 + placeholder: "12" + validations: + required: true + - type: input + id: romaing-ver + attributes: + label: 哔哩漫游版本 + placeholder: 1.6.2 + validations: + required: true + - type: dropdown + id: client + attributes: + label: 哔哩哔哩版本 + options: + - 粉版(普通版) + - 概念版 + - HD 版 + - play 版 + description: 目前仅支持粉版、概念版、HD 版和 play 版 + validations: + required: true + - type: input + id: client-ver + attributes: + label: 哔哩哔哩版本号 + description: 非最新版本可能不受理 + placeholder: 6.74.0 + validations: + required: true + - type: input + id: framework + attributes: + label: 使用的框架和版本 + placeholder: LSPosed 1.8.2 + validations: + required: true + - type: textarea + id: misc + attributes: + label: 其他 + description: 如哪部番、Magisk 版本等 + - type: textarea + id: logs + attributes: + label: 日志 + description: 请使用漫游自带的导出日志功能或者使用 `adb logcat`。无日志提交会被关闭。 + placeholder: 点击文本框下面小长条可以上传文件 + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..1ed7de7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Telegram 频道 + url: https://t.me/biliroaming + about: 可以订阅更新、讨论交流 + - name: QQ 频道 + url: https://qun.qq.com/qqweb/qunpro/share?_wv=3&_wwv=128&inviteCode=NVoD5&from=246610&biz=ka + about: 可以订阅更新、讨论交流 \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..f023beb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,31 @@ +name: 功能请求 +description: 想要请求添加某个功能 +labels: [enhancement] +title: "[Feature] " +body: + - type: textarea + id: reason + attributes: + label: 原因 + description: 为什么想要这个功能 + validations: + required: true + - type: textarea + id: desc + attributes: + label: 功能简述 + description: 想要个怎样的功能 + validations: + required: true + - type: textarea + id: logic + attributes: + label: 功能逻辑 + description: 如何互交、如何使用等 + validations: + required: true + - type: textarea + id: ref + attributes: + label: 实现参考 + description: 该功能可能的实现方式,或者其他已经实现该功能的应用等 diff --git a/.github/ISSUE_TEMPLATE/new_server.yml b/.github/ISSUE_TEMPLATE/new_server.yml new file mode 100644 index 0000000..09027f9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new_server.yml @@ -0,0 +1,40 @@ +name: 添加公共服务器 +description: 把自己的服务器添加到公共服务器列表 +labels: [server] +title: "[Server] " +body: + - type: input + id: contact + attributes: + label: 联系方式 + description: Telegram、Github 账号等联系方式 + validations: + required: true + - type: input + id: domain + attributes: + label: 域名 + description: 服务器域名 + validations: + required: true + - type: checkboxes + id: areas + attributes: + label: 支持地区 + description: 服务器支持解析的地区 + options: + - label: 中国大陆 + - label: 港澳 + - label: 台湾 + - label: 东南亚 + - type: checkboxes + id: premium + attributes: + label: 带会员专享 + options: + - label: 服务器只有带会员用户能解析 + - type: input + id: sponsor + attributes: + label: 赞助地址 + description: 爱发电等 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..595b08e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,23 @@ +version: 2 +updates: + - package-ecosystem: gradle + directory: "/" + schedule: + interval: daily + time: "21:00" + open-pull-requests-limit: 10 + target-branch: master + registries: + - maven-google + - gralde-plugin + groups: + maven-dependencies: + patterns: + - "*" +registries: + maven-google: + type: maven-repository + url: "https://dl.google.com/dl/android/maven2/" + gralde-plugin: + type: maven-repository + url: "https://plugins.gradle.org/m2/" diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml new file mode 100644 index 0000000..733d9dc --- /dev/null +++ b/.github/workflows/PR.yml @@ -0,0 +1,52 @@ +name: PR Build + +on: [pull_request] + +jobs: + build: + name: Build on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + env: + CCACHE_DIR: ${{ github.workspace }}/.ccache + CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" + CCACHE_NOHASHDIR: true + CCACHE_MAXSIZE: 1G + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest ] + + steps: + - name: Check out + uses: actions/checkout@v3 + with: + submodules: 'recursive' + fetch-depth: 0 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + cache: 'gradle' + - name: Set up ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ runner.os }}-${{ github.sha }} + restore-keys: ${{ runner.os }} + - name: Build with Gradle + run: | + echo 'org.gradle.caching=true' >> gradle.properties + echo 'org.gradle.parallel=true' >> gradle.properties + echo 'org.gradle.vfs.watch=true' >> gradle.properties + echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties + echo 'android.native.buildOutput=verbose' >> gradle.properties + ./gradlew assemble + - name: Stop gradle daemon + run: ./gradlew --stop + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }}-artifact + path: | + app/build/outputs + app/release diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..3458560 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,77 @@ +name: Android CI + +on: + push: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + env: + CCACHE_DIR: ${{ github.workspace }}/.ccache + CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" + CCACHE_NOHASHDIR: true + CCACHE_MAXSIZE: 1G + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + fetch-depth: 0 + - name: Setup JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 17 + cache: 'gradle' + - name: Retrieve version + run: | + echo VERSION=$(echo ${{ github.event.head_commit.id }} | head -c 10) >> $GITHUB_ENV + - name: Set up ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ runner.os }}-${{ github.sha }} + restore-keys: ${{ runner.os }} + - name: Write key + if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/master' ) || github.ref_type == 'tag' }} + run: | + if [ ! -z "${{ secrets.SIGNING_KEY }}" ]; then + echo 'Writing sign key' + echo releaseStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> gradle.properties + echo releaseKeyAlias='${{ secrets.ALIAS }}' >> gradle.properties + echo releaseKeyPassword='${{ secrets.KEY_PASSWORD }}' >> gradle.properties + echo releaseStoreFile='key.jks' >> gradle.properties + echo '${{ secrets.SIGNING_KEY }}' | base64 --decode > key.jks + fi + - name: Build with Gradle + run: | + echo 'org.gradle.caching=true' >> gradle.properties + echo 'org.gradle.parallel=true' >> gradle.properties + echo 'org.gradle.vfs.watch=true' >> gradle.properties + echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties + echo 'android.native.buildOutput=verbose' >> gradle.properties + ./gradlew -PappVerName=${{ env.VERSION }} assembleRelease assembleDebug + - name: Upload built apk + if: success() + uses: actions/upload-artifact@v4 + with: + name: snapshot + path: | + app/build/outputs/apk + app/build/outputs/mapping + app/release + - name: Post to channel + if: github.ref == 'refs/heads/master' + env: + CHANNEL_ID: ${{ secrets.TELEGRAM_TO }} + BOT_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} + FILE: app/release/BiliRoaming_${{ env.VERSION }}.apk + COMMIT_MESSAGE: |+ + New push to github\! + ``` + ${{ github.event.head_commit.message }} + ```by `${{ github.event.head_commit.author.name }}` + See commit detail [here](${{ github.event.head_commit.url }}) + Snapshot apk is attached \(unsupported by TAICHI\) + run: | + ESCAPED=`python3 -c 'import json,os,urllib.parse; print(urllib.parse.quote(json.dumps(os.environ["COMMIT_MESSAGE"])))'` + curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_ID}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://release%22,%22parse_mode%22:%22MarkdownV2%22,%22caption%22:${ESCAPED}%7D%5D" -F release="@$FILE" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..46e46c6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +*.iml +.gradle +/local.properties +.idea +.DS_Store +/build +/captures +.externalNativeBuild +*.apk +*.jar +/.kotlin diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..75ee6dc --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "app/src/main/jni/dex_builder"] + path = app/src/main/jni/dex_builder + url = git@github.com:LSPosed/DexBuilder.git diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..30ace6a --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..93be562 --- /dev/null +++ b/README.md @@ -0,0 +1,77 @@ +
+ +logo + +Logo来自[哔哩哔哩漫游娘](https://www.weibo.com/p/230418139a6f1100102vlj6) + +[![Android CI](https://github.com/yujincheng08/BiliRoaming/workflows/Android%20CI/badge.svg)](https://github.com/yujincheng08/BiliRoaming/actions) +[![Chat](https://img.shields.io/badge/Join-QQ%E9%A2%91%E9%81%93-red?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjEgMTQzLjg5Ij48cGF0aCBmaWxsPSIjZmFhYjA3IiBkPSJNNjAuNTAzIDE0Mi4yMzdjLTEyLjUzMyAwLTI0LjAzOC00LjE5NS0zMS40NDUtMTAuNDYtMy43NjIgMS4xMjQtOC41NzQgMi45MzItMTEuNjEgNS4xNzUtMi42IDEuOTE4LTIuMjc1IDMuODc0LTEuODA3IDQuNjYzIDIuMDU2IDMuNDcgMzUuMjczIDIuMjE2IDQ0Ljg2MiAxLjEzNnptMCAwYzEyLjUzNSAwIDI0LjAzOS00LjE5NSAzMS40NDctMTAuNDYgMy43NiAxLjEyNCA4LjU3MyAyLjkzMiAxMS42MSA1LjE3NSAyLjU5OCAxLjkxOCAyLjI3NCAzLjg3NCAxLjgwNSA0LjY2My0yLjA1NiAzLjQ3LTM1LjI3MiAyLjIxNi00NC44NjIgMS4xMzZ6bTAgMCIvPjxwYXRoIGQ9Ik02MC41NzYgNjcuMTE5YzIwLjY5OC0uMTQgMzcuMjg2LTQuMTQ3IDQyLjkwNy01LjY4MyAxLjM0LS4zNjcgMi4wNTYtMS4wMjQgMi4wNTYtMS4wMjQuMDA1LS4xODkuMDg1LTMuMzcuMDg1LTUuMDFDMTA1LjYyNCAyNy43NjggOTIuNTguMDAxIDYwLjUgMCAyOC40Mi4wMDEgMTUuMzc1IDI3Ljc2OSAxNS4zNzUgNTUuNDAxYzAgMS42NDIuMDggNC44MjIuMDg2IDUuMDEgMCAwIC41ODMuNjE1IDEuNjUuOTEzIDUuMTkgMS40NDQgMjIuMDkgNS42NSA0My4zMTIgNS43OTV6bTU2LjI0NSAyMy4wMmMtMS4yODMtNC4xMjktMy4wMzQtOC45NDQtNC44MDgtMTMuNTY4IDAgMC0xLjAyLS4xMjYtMS41MzcuMDIzLTE1LjkxMyA0LjYyMy0zNS4yMDIgNy41Ny00OS45IDcuMzkyaC0uMTUzYy0xNC42MTYuMTc1LTMzLjc3NC0yLjczNy00OS42MzQtNy4zMTUtLjYwNi0uMTc1LTEuODAyLS4xLTEuODAyLS4xLTEuNzc0IDQuNjI0LTMuNTI1IDkuNDQtNC44MDggMTMuNTY4LTYuMTE5IDE5LjY5LTQuMTM2IDI3LjgzOC0yLjYyNyAyOC4wMiAzLjIzOS4zOTIgMTIuNjA2LTE0LjgyMSAxMi42MDYtMTQuODIxIDAgMTUuNDU5IDEzLjk1NyAzOS4xOTUgNDUuOTE4IDM5LjQxM2guODQ4YzMxLjk2LS4yMTggNDUuOTE3LTIzLjk1NCA0NS45MTctMzkuNDEzIDAgMCA5LjM2OCAxNS4yMTMgMTIuNjA3IDE0LjgyMiAxLjUwOC0uMTgzIDMuNDkxLTguMzMyLTIuNjI3LTI4LjAyMSIvPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik00OS4wODUgNDAuODI0Yy00LjM1Mi4xOTctOC4wNy00Ljc2LTguMzA0LTExLjA2My0uMjM2LTYuMzA1IDMuMDk4LTExLjU3NiA3LjQ1LTExLjc3MyA0LjM0Ny0uMTk1IDguMDY0IDQuNzYgOC4zIDExLjA2NS4yMzggNi4zMDYtMy4wOTcgMTEuNTc3LTcuNDQ2IDExLjc3MW0zMS4xMzMtMTEuMDYzYy0uMjMzIDYuMzAyLTMuOTUxIDExLjI2LTguMzAzIDExLjA2My00LjM1LS4xOTUtNy42ODQtNS40NjUtNy40NDYtMTEuNzcuMjM2LTYuMzA1IDMuOTUyLTExLjI2IDguMy0xMS4wNjYgNC4zNTIuMTk3IDcuNjg2IDUuNDY4IDcuNDQ5IDExLjc3MyIvPjxwYXRoIGZpbGw9IiNmYWFiMDciIGQ9Ik04Ny45NTIgNDkuNzI1Qzg2Ljc5IDQ3LjE1IDc1LjA3NyA0NC4yOCA2MC41NzggNDQuMjhoLS4xNTZjLTE0LjUgMC0yNi4yMTIgMi44Ny0yNy4zNzUgNS40NDZhLjg2My44NjMgMCAwMC0uMDg1LjM2Ny44OC44OCAwIDAwLjE2LjQ5NmMuOTggMS40MjcgMTMuOTg1IDguNDg3IDI3LjMgOC40ODdoLjE1NmMxMy4zMTQgMCAyNi4zMTktNy4wNTggMjcuMjk5LTguNDg3YS44NzMuODczIDAgMDAuMTYtLjQ5OC44NTYuODU2IDAgMDAtLjA4NS0uMzY1Ii8+PHBhdGggZD0iTTU0LjQzNCAyOS44NTRjLjE5OSAyLjQ5LTEuMTY3IDQuNzAyLTMuMDQ2IDQuOTQzLTEuODgzLjI0Mi0zLjU2OC0xLjU4LTMuNzY4LTQuMDctLjE5Ny0yLjQ5MiAxLjE2Ny00LjcwNCAzLjA0My00Ljk0NCAxLjg4Ni0uMjQ0IDMuNTc0IDEuNTggMy43NzEgNC4wN20xMS45NTYuODMzYy4zODUtLjY4OSAzLjAwNC00LjMxMiA4LjQyNy0yLjk5MyAxLjQyNS4zNDcgMi4wODQuODU3IDIuMjIzIDEuMDU3LjIwNS4yOTYuMjYyLjcxOC4wNTMgMS4yODYtLjQxMiAxLjEyNi0xLjI2MyAxLjA5NS0xLjczNC44NzUtLjMwNS0uMTQyLTQuMDgyLTIuNjYtNy41NjIgMS4wOTctLjI0LjI1Ny0uNjY4LjM0Ni0xLjA3My4wNC0uNDA3LS4zMDgtLjU3NC0uOTMtLjMzNC0xLjM2MiIvPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik02MC41NzYgODMuMDhoLS4xNTNjLTkuOTk2LjEyLTIyLjExNi0xLjIwNC0zMy44NTQtMy41MTgtMS4wMDQgNS44MTgtMS42MSAxMy4xMzItMS4wOSAyMS44NTMgMS4zMTYgMjIuMDQzIDE0LjQwNyAzNS45IDM0LjYxNCAzNi4xaC44MmMyMC4yMDgtLjIgMzMuMjk4LTE0LjA1NyAzNC42MTYtMzYuMS41Mi04LjcyMy0uMDg3LTE2LjAzNS0xLjA5Mi0yMS44NTQtMTEuNzM5IDIuMzE1LTIzLjg2MiAzLjY0LTMzLjg2IDMuNTE4Ii8+PHBhdGggZmlsbD0iI2ViMTkyMyIgZD0iTTMyLjEwMiA4MS4yMzV2MjEuNjkzczkuOTM3IDIuMDA0IDE5Ljg5My42MTZWODMuNTM1Yy02LjMwNy0uMzU3LTEzLjEwOS0xLjE1Mi0xOS44OTMtMi4zIi8+PHBhdGggZmlsbD0iI2ViMTkyMyIgZD0iTTEwNS41MzkgNjAuNDEycy0xOS4zMyA2LjEwMi00NC45NjMgNi4yNzVoLS4xNTNjLTI1LjU5MS0uMTcyLTQ0Ljg5Ni02LjI1NS00NC45NjItNi4yNzVMOC45ODcgNzYuNTdjMTYuMTkzIDQuODgyIDM2LjI2MSA4LjAyOCA1MS40MzYgNy44NDVoLjE1M2MxNS4xNzUuMTgzIDM1LjI0Mi0yLjk2MyA1MS40MzctNy44NDV6bTAgMCIvPjwvc3ZnPg==)](https://qun.qq.com/qqweb/qunpro/share?_wv=3&_wwv=128&inviteCode=NVoD5&from=246610&biz=ka) +[![Channel](https://img.shields.io/badge/Follow-Telegram-blue.svg?logo=telegram)](https://t.me/biliroaming) +[![Download](https://img.shields.io/github/v/release/yujincheng08/biliroaming?color=critical&label=Downloads&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAF2UlEQVRIiaVWS2xTRxQ9d2bs5y+O4zgEYkgoShcESIG2EQJRREFAKmABRFCpbOiioumqrNiQCmjFiiB1Q6kqwR6k0NIKUBdFLBAt31BBoUqC8xEhgXwcO7bfezPVTJyQkBA+vdKT5fdm7rn3zL3nDilMtlt1dRiOx+G3bSjO4TIGSLkOrrtJMfYBgEoA0cKmAVKqHUR/EXBBSnmJ53JQHg9UIIDA06dY3NwMmoAgMI2NLZDAXuW6XwGogQaeahHFWIUCPiKlvgZjLVKI7wn4gdSLqYzaFC96oSJ612HsiqvUjwZsJlMKE5wvkV7vCVeIq4poEU0I/jlgKATzhMOAEADRZunx3FVEq15c/DpmwIlq80LcsYGthhnLArxe85DasMFEqT/0BAIb7oVCFy3GQFK+Bdxzk4xB2jbmSVkXFOI3WWBBdEmpKYRDNK8rGr3Iddr5vHk3TjPnsAcH4aTTsEpKwDwenQVkLodcXx9EOAzPrFlQrju+h7suyONBq8/366yBgYWW67YaSnuKi/EkGkVnWdkvOifvRDAiEGPIJJPwRqMoWbUKJISJXIMxvx+l69bBE4kg/egRSO8r7NU+NEteXbVCnBfDw+CpFPiemhpIzj8lxvZ5HGdyZoxhuK0NsdpaLG5sxNy6OqQePMBASwucTAbFK1Zg0YEDiK9ejZGuLgzcuQNvUdEkarlScBgryVhW+0godJvpKIjoWzZanZNo1FHHVq5EzdGjhkpzBsGgoU4pNUotYL4tPXIEpWvXIqMz5XzcjyoUEvd4vrOIwPyMrVZEFeqFvrGHhoyjJY2Nk4vBtk3mmr6JZ6Zt8cGD8CcSyPf3T3pPpnvUHJVOf8wcxrabs5qQmTsygv6bN1G+dSu43z9ps/D7IR3HPMLnm+yYc1Ts2oX8s2fTFS6Uz7dDuMCH42BCINvdDR4KoaqhAXO3bDHvc6kUnnZ0AJyjv70dVjhsMhzo6EDX/fsg10VxeTl8RUWILl9uisgUle6/Md9SwhVihQBRhVELzjHS3Y1AeTmqDx5EsKJifPFQMokLu3fDF4thTiyGcDxuziadTOJKQwNSnZ3YfOoUymtr4S0uNi2SevgQwfnzIXS7OM5o9SpVzj9fuvQb3Q0ymzXOlx8/bkAnWjAeR0Sf69WrCCUScHW0uuQtCyKZRM2ePajcscM41YWkqzdYWYnBlha46bQpNJOULvwxucv29qJs40b4Zs+eSj4R3tm3DyXr1yPV2mrYYEIg1daGotpaVO3fj4nirsHm19djyeHDUDq4QjIoiPegOVDbRmjBgmkPe8x0FfrmzEH28WOjMN5IBEsOHXrp+kh1tendbE/P2KsUg5SPUFAIO5OZEZAHAqbfck+eIN3aasD0mc1k4YULTTIY7fMuRkL8qXvQikTQcfnyjJu1hauqsOzYMSxrakJRzcyTS1umr8/QrRjT+nqdsWz2jEa3YjEM3LiB66dPv9JJfM0alOkp8wpLp9N42NyMoFYpzWI2e4Ypy7pMQnS4SiGeSCB58iT+aGpCX0cHpp/ZrzatP49u3cLvDQ3g/f3gWl+l7FFCXKKr9fX6z2fSsk5zIUC2ja72duRLShBMJEw1vskg1kE62SwybW3Q6htNJJB1XXhcdy9X6ie6tnOn4dj2+/9WjrNIEMHDGHLpNNLDw6as3xSQcY5wURG4ZSHrOGC53L/efL5K0yr8paWGX18+/8mAZbXpsaOVgfl8iLygo28CqgPNOQ7cYBBWMFjH9KDXzT9SWWkW6QnwJB6va6uuPq/n4v+9YuhRZ+dyqLSsbdFY7NzYZJlyL729bduWodLSZjEyQm9ziRrL0A4EEO7t3b7s3LmzBR0136ZcE0U2+zPL55cCuIa3gCxcLW5wovc452ehM9PirX9ddyqg1NNayrtcqVqu1BcA7r0OSCG4f8hxvmSOs4KA29O11bQ377HMSKkTRHRCEW0iKTcpovcBzNMyWVipdbiTue51kvICgPPm5F/GDID/AISQbRffDZUGAAAAAElFTkSuQmCC)](https://github.com/yujincheng08/BiliRoaming/releases/latest) +[![Stars](https://img.shields.io/github/stars/yujincheng08/biliroaming?label=Stars&color=important&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAdCAYAAAC5UQwxAAADKUlEQVRIib2WX0iTURTAz737tpWEissM6c9cOUUkCqmHpYEtfAiFyl4yCoQefOmhHozAECGweskMw+hRitRQsD8ULSl0H1mUIDRr5myVpgvJQvP7f+P7Nsfc9s3dMTpw4ePee87vnHvvOeeD/y2IEEKNFOYHMom8lGHedGKWVjcloDJu7QLxRz7exTtpdRlqmurlot+KAHAqutRKsu/YeaQABgIge/e30upTR2hY6K8FEzhADfE3q9DqU0Uo+uoaQFCpQU01UmXS2UJjg+7RjCI3EHBoQFUIABFhGO0lFcmaSDpC6cuZ01p0kZcQilL21TQmayfpCMkoGkIA5TEuKlqkLL/dVWG2ONe80xggH7iXj4XPdiz5rUicKgDBZ8OC36Y+EsDggGj/1HlZ+2KJectXhSnwEaN1Ckw2n8zs8JrzTn1ftZ2bbjeb5i42gwHKkLy0QVNWwBE2hiNGIlEixopTGFjtvg0Zf4kEb+W8C1e1CCVP2XXm1/t9kAGO1NI5gajwJWBJVqEXlXrrNfNMybtzYu6RXuCBTTMOgAOW5FYOqjCIfKVGe3+baDnaC8tphC4Dq+Q4Xcg+eGllatUBGgv72kRLbXdaoBrskAvbXc2R0zE3Zix80C5Zjgeh9I0kAlb1DNufN0cv6eahOFnXYFzoPgmMUk4FE9Gwkl39EO8cuBZvOWHiK2NZj7H053C4lK0lMgDBxpdot1CptzNhEmCymKnlYrKiWiNiwg6kC+R/9uWAqGCqvEQASAIszHYWUwOx4CkNVxwaIeBAwoSdGogEb6wSClUOtWvwoe/oI1cbszBeqmdX97yR4C2KcYcL1kcpt/4O4PUcE7h1VqudplBJDDmAhU9F9EDxY3EYKGiFmZWzK11SXlOLOftgsA1t67gvT9Q0GhYeaUcJ5tDfgOS36tkFNS3iDWUUhsgbIOQ1uGXPnhtcoGej3l5u/sk6yeNoJSPgJiNAyDtwc/MvcLy98Q3MdJSQIXArY9YubqbTrgeKHnzgbr78oeQ2eQVu8VtTVbw9cRNfnL58APFzmxnbzR7do0kg4lRjNWGwZNp65Wkq+ukTAPgHIIGzcZjmG+EAAAAASUVORK5CYII= +)](https://github.com/yujincheng08/BiliRoaming) + +# 哔哩漫游 +解除B站客户端番剧区域限制的Xposed模块,并且提供其他小功能 + +# BiliRoaming +An Xposed module that unblocks bangumi area limit of BILIBILI, and miscellaneous features + +
+ +# 支持以下功能 + +- 解除B站番剧区域限制 +- 港澳台CDN加速 +- 缓存番剧 +- 支持国际版和概念版 +- 自定义主题色 +- 关闭青少年模式弹窗 +- 显示评论区楼层 +- ~概念版添加直播入口~ +- 不以小程序形式分享 +- 自动点赞视频 +- 把我的页面移到侧边栏 +- ~替换音乐状态栏为原生样式~ +- 提取视频、直播封面 +- 自定义屏启动图 + +# Features + +- Unlock bangumi area limit +- CDN speedup +- Download bangumi +- Support International ver and blue ver +- Customize theme +- Close teenager dialog +- Show comment floor +- ~Add live entry to blue ver~ +- Share without mini programs +- Like videos automatically +- Move 'Mine page' to sidebar drawer +- ~Change music notification style to Primitive~ +- Extra covers from videos and live rooms +- Customized splash images + +# download/下载 +https://github.com/yujincheng08/BiliRoaming/releases/latest + +https://modules.lsposed.org/module/me.iacn.biliroaming + +# 使用方法 +https://github.com/yujincheng08/BiliRoaming/wiki#%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95 + +# 特别鸣谢 +- [原作者](https://github.com/iAcn/BiliRoaming) +- [BiliPlus](https://www.biliplus.com/) +- [Kghost](https://github.com/kghost/bilibili-area-limit) + +### 交流 +Telegram: [@biliroaming](https://t.me/biliroaming) +### License +[GNU General Public License, version 3](LICENSE) + + +### 本项目 CDN 加速及安全防护由 Tencent EdgeOne 赞助 +[亚洲最佳CDN、边缘和安全解决方案 - Tencent EdgeOne](https://edgeone.ai/zh?from=github) +![](https://edgeone.ai/media/34fe3a45-492d-4ea4-ae5d-ea1087ca7b4b.png) diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..b5e4b9f --- /dev/null +++ b/app/.gitignore @@ -0,0 +1,3 @@ +/build +/release +/.cxx diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..60769c4 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,186 @@ +import com.google.protobuf.gradle.* + +plugins { + alias(libs.plugins.agp.app) + alias(libs.plugins.kotlin) + alias(libs.plugins.protobuf) + alias(libs.plugins.lsplugin.resopt) + alias(libs.plugins.lsplugin.jgit) + alias(libs.plugins.lsplugin.apksign) + alias(libs.plugins.lsplugin.apktransform) + alias(libs.plugins.lsplugin.cmaker) +} + +val appVerCode = jgit.repo()?.commitCount("refs/remotes/origin/master") ?: 0 +val appVerName: String by rootProject + +apksign { + storeFileProperty = "releaseStoreFile" + storePasswordProperty = "releaseStorePassword" + keyAliasProperty = "releaseKeyAlias" + keyPasswordProperty = "releaseKeyPassword" +} + +apktransform { + copy { + when (it.buildType) { + "release" -> file("${it.name}/BiliRoaming_${appVerName}.apk") + else -> null + } + } +} + +cmaker { + default { + targets("biliroaming") + abiFilters("armeabi-v7a", "arm64-v8a", "x86") + arguments += arrayOf( + "-DANDROID_STL=none", + "-DCMAKE_CXX_STANDARD=23", + "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON", + ) + cFlags += "-flto" + cppFlags += "-flto" + } + + buildTypes { + arguments += "-DDEBUG_SYMBOLS_PATH=${layout.buildDirectory.file("symbols/${it.name}").get().asFile.absolutePath}" + } +} + +android { + namespace = "me.iacn.biliroaming" + compileSdk = 35 + buildToolsVersion = "35.0.0" + ndkVersion = "29.0.14206865" + + buildFeatures { + prefab = true + buildConfig = true + } + + defaultConfig { + applicationId = "me.iacn.biliroaming" + minSdk = 24 + targetSdk = 35 // Target Android U + versionCode = appVerCode + versionName = appVerName + } + + buildTypes { + release { + isMinifyEnabled = true + isShrinkResources = true + proguardFiles("proguard-rules.pro") + } + } + + compileOptions { + sourceCompatibility(JavaVersion.VERSION_11) + targetCompatibility(JavaVersion.VERSION_11) + } + + kotlinOptions { + jvmTarget = "11" + freeCompilerArgs = listOf( + "-Xno-param-assertions", + "-Xno-call-assertions", + "-Xno-receiver-assertions", + "-language-version=2.0", + ) + } + + sourceSets { + named("main") { + proto { + srcDir("src/main/proto") + include("**/*.proto") + } + } + } + + packaging { + resources { + excludes += "**" + } + } + + lint { + checkReleaseBuilds = false + } + + dependenciesInfo { + includeInApk = false + } + + androidResources { + additionalParameters += arrayOf("--allow-reserved-package-id", "--package-id", "0x23") + } + + externalNativeBuild { + cmake { + path("src/main/jni/CMakeLists.txt") + version = "4.1.0+" + } + } +} + +protobuf { + protoc { + artifact = libs.protobuf.protoc.get().toString() + } + + generateProtoTasks { + all().forEach { task -> + task.builtins { + id("java") { + option("lite") + } + id("kotlin") { + option("lite") + } + } + } + } +} + +configurations.all { + exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk7") + exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8") +} + +dependencies { + compileOnly(libs.xposed) + implementation(libs.protobuf.kotlin) + implementation(libs.protobuf.java) + compileOnly(libs.protobuf.protoc) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlin.coroutines.android) + implementation(libs.kotlin.coroutines.jdk) + implementation(libs.androidx.documentfile) + implementation(libs.cxx) + implementation(libs.okhttp) +} + +val adbExecutable: String = androidComponents.sdkComponents.adb.get().asFile.absolutePath + +val restartBiliBili = task("restartBiliBili").apply { + doLast { + exec { + commandLine(adbExecutable, "shell", "am", "force-stop", "tv.danmaku.bili") + } + exec { + commandLine( + adbExecutable, + "shell", + "am", + "start", + "$(pm resolve-activity --components tv.danmaku.bili)" + ) + } + } +} + +afterEvaluate { + tasks.getByPath("installDebug").finalizedBy(restartBiliBili) +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..c000f4b --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,41 @@ +-repackageclasses "biliroaming" + +-keep class me.iacn.biliroaming.XposedInit { + (); +} + +-keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite { + ; +} + +-keepclasseswithmembers class me.iacn.biliroaming.utils.DexHelper { + native ; + long token; + java.lang.ClassLoader classLoader; +} + +-keepattributes RuntimeVisible*Annotations + +-keepclassmembers class * { + @android.webkit.JavascriptInterface ; +} + +-keepclassmembers class * implements android.os.Parcelable { + public static final ** CREATOR; +} + +-keepclassmembers class me.iacn.biliroaming.MainActivity$Companion { + boolean isModuleActive(); +} + +-assumenosideeffects class kotlin.jvm.internal.Intrinsics { + public static void check*(...); + public static void throw*(...); +} + +-assumenosideeffects class java.util.Objects { + public static ** requireNonNull(...); +} + +-allowaccessmodification +-overloadaggressively diff --git a/app/src/.gitignore b/app/src/.gitignore new file mode 100644 index 0000000..86d4c2d --- /dev/null +++ b/app/src/.gitignore @@ -0,0 +1 @@ +generated diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..bb37657 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/assets/xhook.js b/app/src/main/assets/xhook.js new file mode 100644 index 0000000..809be38 --- /dev/null +++ b/app/src/main/assets/xhook.js @@ -0,0 +1,7 @@ +(function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H=[].indexOf||function(a){for(var b=0,c=this.length;b=0||(f=f===b?d[a].length:f,d[a].splice(f,0,c))},c[m]=function(a,c){var f;if(a===b)return void(d={});c===b&&(d[a]=[]),f=e(a).indexOf(c),f!==-1&&e(a).splice(f,1)},c[h]=function(){var b,d,f,g,h,i,j,k;for(b=D(arguments),d=b.shift(),a||(b[0]=z(b[0],y(d))),g=c["on"+d],g&&g.apply(c,b),k=e(d).concat(e("*")),f=i=0,j=k.length;i2)throw"invalid hook";return F[n](d,a,b)},F[c]=function(a,b){if(a.length<2||a.length>3)throw"invalid hook";return F[n](c,a,b)},F.enable=function(){q[u]=t,"function"==typeof r&&(q[g]=r),k&&(q[i]=s)},F.disable=function(){q[u]=F[u],q[g]=F[g],k&&(q[i]=k)},v=F.headers=function(a,b){var c,d,e,f,g,h,i,j,k;switch(null==b&&(b={}),typeof a){case"object":d=[];for(e in a)g=a[e],f=e.toLowerCase(),d.push(f+":\t"+g);return d.join("\n")+"\n";case"string":for(d=a.split("\n"),i=0,j=d.length;ib&&b<4;)k[o]=++b,1===b&&k[h]("loadstart",{}),2===b&&G(),4===b&&(G(),E()),k[h]("readystatechange",{}),4===b&&(t.async===!1?g():setTimeout(g,0))},g=function(){l||k[h]("load",{}),k[h]("loadend",{}),l&&(k[o]=0)},b=0,x=function(a){var b,d;if(4!==a)return void i(a);b=F.listeners(c),(d=function(){var a;return b.length?(a=b.shift(),2===a.length?(a(t,w),d()):3===a.length&&t.async?a(t,w,d):d()):i(4)})()},k=t.xhr=f(),I.onreadystatechange=function(a){try{2===I[o]&&r()}catch(a){}4===I[o]&&(D=!1,r(),q()),x(I[o])},m=function(){l=!0},k[n]("error",m),k[n]("timeout",m),k[n]("abort",m),k[n]("progress",function(){b<3?x(3):k[h]("readystatechange",{})}),("withCredentials"in I||F.addWithCredentials)&&(k.withCredentials=!1),k.status=0,L=e.concat(p);for(J=0,K=L.length;J { + val layout = LinearLayout(context).apply { + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + } + val textView = TextView(context).apply { + text = name + setSingleLine() + ellipsize = TextUtils.TruncateAt.END + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + } + val editText = EditText(context).apply { + setSingleLine() + inputType = type + layoutParams = LinearLayout.LayoutParams( + 0, + LinearLayout.LayoutParams.WRAP_CONTENT + ).apply { weight = 1F } + } + layout.addView(textView) + layout.addView(editText) + return Pair(layout, editText) + } + + private fun keywordTypeHeader( + group: ViewGroup, + name: String, + namMinWidth: Int, + showRegex: Boolean, + onAdd: (v: View) -> Unit, + ): Triple { + val layout = LinearLayout(context).apply { + gravity = Gravity.START + orientation = LinearLayout.HORIZONTAL + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + } + val nameView = TextView(context).apply { + text = name + typeface = Typeface.DEFAULT_BOLD + setTextSize(TypedValue.COMPLEX_UNIT_SP, 16F) + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + minWidth = namMinWidth + } + val addView = Button(context).apply { + text = string(R.string.keyword_group_add) + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + minWidth = 60.dp + minimumWidth = 60.dp + setOnClickListener(onAdd) + } + val clearView = Button(context).apply { + text = string(R.string.keyword_group_clear) + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + visibility = View.GONE + minWidth = 60.dp + minimumWidth = 60.dp + setOnClickListener { group.removeAllViews() } + } + val regexModeView = TextView(context).apply { + text = string(R.string.regex_mode) + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ).apply { marginStart = 4.dp } + } + val regexModeSwitch = Switch(context).apply { + isSoundEffectsEnabled = false + isHapticFeedbackEnabled = false + } + if (!showRegex) { + regexModeView.visibility = View.GONE + regexModeSwitch.visibility = View.GONE + } + layout.addView(nameView) + layout.addView(addView) + layout.addView(clearView) + layout.addView(regexModeView) + layout.addView(regexModeSwitch) + return Triple(layout, clearView, regexModeSwitch) + } + + protected fun keywordInputItem( + parent: ViewGroup, + keyword: String = "", + type: Int = EditorInfo.TYPE_CLASS_TEXT, + ): Pair { + val layout = LinearLayout(context).apply { + orientation = LinearLayout.HORIZONTAL + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + } + val editText = EditText(context).apply { + inputType = type + setText(keyword) + setTextSize(TypedValue.COMPLEX_UNIT_SP, 16F) + setSingleLine() + layoutParams = LinearLayout.LayoutParams( + 0, + LinearLayout.LayoutParams.WRAP_CONTENT + ).apply { weight = 1F } + } + val button = Button(context).apply { + text = string(R.string.keyword_group_delete) + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + minWidth = 60.dp + minimumWidth = 60.dp + setOnClickListener { parent.removeView(layout) } + } + layout.addView(editText) + layout.addView(button) + return Pair(layout, editText) + } + + protected fun LinearLayout.addKeywordGroup( + name: String, + namMinWidth: Int = 64.dp, + showRegex: Boolean = false, + inputType: Int = EditorInfo.TYPE_CLASS_TEXT, + ): Pair { + val group = LinearLayout(context).apply { + orientation = LinearLayout.VERTICAL + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + } + val (_, clearButton, regexModeSwitch) = keywordTypeHeader( + group, name, namMinWidth, showRegex + ) { + keywordInputItem(group, type = inputType).let { + group.addView(it.first) + it.second.requestFocus() + } + }.also { addView(it.first) } + group.setOnHierarchyChangeListener(object : ViewGroup.OnHierarchyChangeListener { + override fun onChildViewAdded(parent: View, child: View) { + if (group.childCount == 0) { + clearButton.visibility = View.GONE + } else { + clearButton.visibility = View.VISIBLE + } + } + + override fun onChildViewRemoved(parent: View, child: View) { + if (group.childCount == 0) { + clearButton.visibility = View.GONE + } else { + clearButton.visibility = View.VISIBLE + } + } + }) + addView(group) + return Pair(group, regexModeSwitch) + } + + protected fun switchPrefsItem(title: String): Pair { + val layout = LinearLayout(context).apply { + gravity = Gravity.CENTER_VERTICAL + orientation = LinearLayout.HORIZONTAL + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + } + val titleView = TextView(context).apply { + text = title + setTextSize(TypedValue.COMPLEX_UNIT_SP, 16F) + setSingleLine() + ellipsize = TextUtils.TruncateAt.END + setPadding(0, 8.dp, 0, 8.dp) + layoutParams = LinearLayout.LayoutParams( + 0, + LinearLayout.LayoutParams.WRAP_CONTENT + ).apply { weight = 1F; marginEnd = 10.dp } + } + val switcher = Switch(context).apply { + isClickable = false + isSoundEffectsEnabled = false + isHapticFeedbackEnabled = false + setBackgroundColor(Color.TRANSPARENT) + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + } + layout.setOnClickListener { switcher.toggle() } + layout.setRippleBackground() + layout.addView(titleView) + layout.addView(switcher) + return Pair(layout, switcher) + } + + protected fun ViewGroup.getKeywords() = children + .filterIsInstance() + .flatMap { it.children } + .filterIsInstance() + .map { it.text.toString().trim() } + .filter { it.isNotEmpty() } + .toSet() +} diff --git a/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt b/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt new file mode 100644 index 0000000..8bcc320 --- /dev/null +++ b/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt @@ -0,0 +1,2523 @@ +@file:Suppress("DEPRECATION") + +package me.iacn.biliroaming + +import android.app.Activity +import android.app.AndroidAppHelper +import android.content.Context +import android.content.SharedPreferences +import android.net.Uri +import android.text.style.ClickableSpan +import android.text.style.LineBackgroundSpan +import android.util.SparseArray +import android.view.View +import android.view.ViewGroup +import android.widget.TextView +import dalvik.system.BaseDexClassLoader +import me.iacn.biliroaming.utils.* +import java.io.File +import java.io.FileInputStream +import java.io.FileOutputStream +import java.io.InputStream +import java.lang.reflect.Constructor +import java.lang.reflect.Method +import java.lang.reflect.Modifier +import java.lang.reflect.ParameterizedType +import java.util.Objects +import kotlin.math.max +import kotlin.system.measureTimeMillis +import kotlin.time.ExperimentalTime +import kotlin.time.measureTimedValue + + +infix fun Configs.Class.from(cl: ClassLoader) = if (hasName()) name.findClassOrNull(cl) else null +val Configs.Method.orNull get() = if (hasName()) name else null +val Configs.Field.orNull get() = if (hasName()) name else null +val Configs.Class.orNull get() = if (hasName()) name else null + +class BiliBiliPackage constructor(private val mClassLoader: ClassLoader, mContext: Context) { + init { + instance = this + } + + @OptIn(ExperimentalTime::class) + private val mHookInfo: Configs.HookInfo = run { + val (result, time) = measureTimedValue { readHookInfo(mContext) } + Log.d("load hookinfo $time") + Log.d(result.copy { clearMapIds() }.print()) + result + } + val bangumiApiResponseClass by Weak { mHookInfo.bangumiApiResponse from mClassLoader } + val rxGeneralResponseClass by Weak { "com.bilibili.okretro.call.rxjava.RxGeneralResponse" from mClassLoader } + val fastJsonClass by Weak { mHookInfo.fastJson.class_ from mClassLoader } + val gsonClass by Weak { "com.google.gson.Gson" from mClassLoader } + val bangumiUniformSeasonClass by Weak { mHookInfo.bangumiSeason from mClassLoader } + val kingPositionComponentClass by Weak { mHookInfo.autoLike.kingPositionComponent.class_ from mClassLoader } + val storyAbsControllerClass by Weak { mHookInfo.autoLike.storyAbsController.class_ from mClassLoader } + val storyDetailClass by Weak { "com.bilibili.video.story.StoryDetail" from mClassLoader } + val retrofitResponseClass by Weak { mHookInfo.retrofitResponse from mClassLoader } + val themeHelperClass by Weak { mHookInfo.themeHelper.class_ from mClassLoader } + val themeIdHelperClass by Weak { mHookInfo.themeIdHelper.class_ from mClassLoader } + val columnHelperClass by Weak { mHookInfo.columnHelper.class_ from mClassLoader } + val settingRouterClass by Weak { mHookInfo.settings.settingRouter from mClassLoader } + val themeListClickClass by Weak { mHookInfo.themeListClick from mClassLoader } + val themeNameClass by Weak { mHookInfo.themeName.class_ from mClassLoader } + val themeProcessorClass by Weak { mHookInfo.themeProcessor.class_ from mClassLoader } + val drawerClass by Weak { mHookInfo.drawer.class_ from mClassLoader } + val generalResponseClass by Weak { mHookInfo.generalResponse from mClassLoader } + val seasonParamsMapClass by Weak { "com.bilibili.bangumi.data.page.detail.BangumiDetailApiService\$UniformSeasonParamsMap" from mClassLoader } + val seasonParamsClass by Weak { mHookInfo.bangumiParams.class_ from mClassLoader } + val brandSplashClass by Weak { "tv.danmaku.bili.ui.splash.brand.ui.BaseBrandSplashFragment" from mClassLoader } + val urlConnectionClass by Weak { "com.bilibili.lib.okhttp.huc.OkHttpURLConnection" from mClassLoader } + val downloadThreadListenerClass by Weak { mHookInfo.downloadThread.listener from mClassLoader } + val downloadThreadViewHostClass by Weak { mHookInfo.downloadThread.viewHost from mClassLoader } + val reportDownloadThreadClass by Weak { mHookInfo.downloadThread.reportDownload.class_ from mClassLoader } + val libBiliClass by Weak { mHookInfo.signQuery.class_ from mClassLoader } + val splashActivityClass by Weak { + "tv.danmaku.bili.ui.splash.SplashActivity" from mClassLoader + ?: "tv.danmaku.bili.MainActivityV2" from mClassLoader + } + val mainActivityClass by Weak { "tv.danmaku.bili.MainActivityV2" from mClassLoader } + val gripperBootExpClass by Weak { "com.bilibili.gripper.exp.a\$a" from mClassLoader } + val homeUserCenterClass by Weak { if (mHookInfo.settings.homeUserCenterCount == 1) mHookInfo.settings.homeUserCenterList.first().class_ from mClassLoader else null } + val menuGroupItemClass by Weak { mHookInfo.settings.menuGroupItem from mClassLoader } + val drawerLayoutClass by Weak { mHookInfo.drawer.layout from mClassLoader } + val drawerLayoutParamsClass by Weak { mHookInfo.drawer.layoutParams from mClassLoader } + val mineAdapterClass by Weak { mHookInfo.settings.mineAdapter from mClassLoader } + val splashInfoClass by Weak { + "tv.danmaku.bili.ui.splash.brand.BrandShowInfo" from mClassLoader + ?: "tv.danmaku.bili.ui.splash.brand.model.BrandShowInfo" from mClassLoader + } + val commentCopyClass by Weak { mHookInfo.commentLongClick from mClassLoader } + val commentCopyNewClass by Weak { mHookInfo.commentLongClickNew from mClassLoader } + val comment3CopyClass by Weak { mHookInfo.comment3Copy.class_ from mClassLoader } + val kotlinJsonClass by Weak { "kotlinx.serialization.json.Json" from mClassLoader } + val gsonConverterClass by Weak { mHookInfo.gsonHelper.gsonConverter from mClassLoader } + val playerCoreServiceV2Class by Weak { mHookInfo.playerCoreService.class_ from mClassLoader } + val teenagersModeDialogActivityClass by Weak { + "com.bilibili.teenagersmode.ui.TeenagersModeDialogActivity" from mClassLoader + } + val pegasusFeedClass by Weak { mHookInfo.pegasusFeed.class_ from mClassLoader } + val popularClass by Weak { mHookInfo.popular.class_ from mClassLoader } + val subtitleSpanClass by Weak { mHookInfo.subtitleSpan from mClassLoader } + val chronosSwitchClass by Weak { mHookInfo.chronosSwitch from mClassLoader } + val biliSpaceClass by Weak { "com.bilibili.app.authorspace.api.BiliSpace" from mClassLoader } + val biliVideoDetailClass by Weak { + ("tv.danmaku.bili.ui.video.api.BiliVideoDetail" from mClassLoader) + ?: ("tv.danmaku.bili.videopage.data.view.model.BiliVideoDetail" from mClassLoader) + } + val commentSpanTextViewClass by Weak { mHookInfo.commentSpan from mClassLoader } + val commentSpanEllipsisTextViewClass by Weak { "com.bilibili.app.comm.comment2.widget.CommentSpanEllipsisTextView" from mClassLoader } + val liveRoomActivityClass by Weak { "com.bilibili.bililive.room.ui.roomv3.LiveRoomActivityV3" from mClassLoader } + val liveKvConfigHelperClass by Weak { "com.bilibili.bililive.tec.kvcore.LiveKvConfigHelper" from mClassLoader } + val storyVideoActivityClass by Weak { "com.bilibili.video.story.StoryVideoActivity" from mClassLoader } + val okioWrapperClass by Weak { mHookInfo.okio.class_ from mClassLoader } + val ellipsizingTextViewClass by Weak { "com.bilibili.bplus.followingcard.widget.EllipsizingTextView" from mClassLoader } + val shareClickResultClass by Weak { "com.bilibili.lib.sharewrapper.online.api.ShareClickResult" from mClassLoader } + val kanbanCallbackClass by Weak { mHookInfo.kanBan.class_ from mClassLoader } + val toastHelperClass by Weak { mHookInfo.toastHelper.class_ from mClassLoader } + val biliAccountsClass by Weak { mHookInfo.biliAccounts.class_ from mClassLoader } + val networkExceptionClass by Weak { "com.bilibili.lib.moss.api.NetworkException" from mClassLoader } + val brotliInputStreamClass by Weak { mHookInfo.brotliInputStream from mClassLoader } + val commentInvalidFragmentClass by Weak { + "com.bilibili.bangumi.ui.page.detail.OGVCommentFragment".from(mClassLoader) + ?: "com.bilibili.bangumi.ui.page.detail.BangumiCommentInvalidFragmentV2" + .from(mClassLoader) + } + val playerQualityServiceClass by Weak { "com.bilibili.playerbizcommon.features.quality.PlayerQualityService" from mClassLoader } + val mossResponseHandlerClass by Weak { "com.bilibili.lib.moss.api.MossResponseHandler" from mClassLoader } + val projectionPlayUrlClass by Weak { "com.bilibili.lib.projection.internal.api.model.ProjectionPlayUrl" from mClassLoader } + val responseBodyClass by Weak { mHookInfo.okHttp.responseBody.class_ from mClassLoader } + val mediaTypeClass by Weak { mHookInfo.okHttp.mediaType.class_ from mClassLoader } + val biliCallClass by Weak { mHookInfo.biliCall.class_ from mClassLoader } + val parserClass by Weak { mHookInfo.biliCall.parser from mClassLoader } + val livePagerRecyclerViewClass by Weak { mHookInfo.livePagerRecyclerView from mClassLoader } + val cronCanvasClass by Weak { "com.bilibili.cron.Canvas" from mClassLoader } + val subtitleConfigGetClass by Weak { "tv.danmaku.biliplayerv2.service.interact.biz.chronos.chronosrpc.methods.receive.GetDanmakuConfig\$SubtitleConfig" from mClassLoader } + val subtitleConfigChangeClass by Weak { "tv.danmaku.biliplayerv2.service.interact.biz.chronos.chronosrpc.methods.send.DanmakuConfigChange\$SubtitleConfig" from mClassLoader } + val liveRoomPlayerViewClass by Weak { "com.bilibili.bililive.room.ui.roomv3.player.container.LiveRoomPlayerContainerView" from mClassLoader } + val biliConfigClass by Weak { mHookInfo.biliConfig.class_ from mClassLoader } + val updateInfoSupplierClass by Weak { mHookInfo.updateInfoSupplier.class_ from mClassLoader } + val latestVersionExceptionClass by Weak { "tv.danmaku.bili.update.internal.exception.LatestVersionException" from mClassLoader } + val playerPreloadHolderClass by Weak { mHookInfo.playerPreloadHolder.class_ from mClassLoader } + val playerSettingHelperClass by Weak { mHookInfo.playerSettingHelper.class_ from mClassLoader } + val autoSupremumQualityClass by Weak { mHookInfo.autoSupremumQuality.class_ from mClassLoader } + val qualityStrategyProviderClass by Weak { mHookInfo.qualityStrategyProvider.class_ from mClassLoader } + val liveRtcEnableClass by Weak { mHookInfo.liveRtcHelper.liveRtcEnableClass from mClassLoader } + val playURLMossClass by Weak { "com.bapis.bilibili.app.playurl.v1.PlayURLMoss" from mClassLoader } + val playViewReqClass by Weak { "com.bapis.bilibili.app.playurl.v1.PlayViewReq" from mClassLoader } + val playerMossClass by Weak { "com.bapis.bilibili.app.playerunite.v1.PlayerMoss" from mClassLoader } + val playViewUniteReqClass by Weak { "com.bapis.bilibili.app.playerunite.v1.PlayViewUniteReq" from mClassLoader } + val viewMossClass by Weak { "com.bapis.bilibili.app.view.v1.ViewMoss" from mClassLoader } + val viewReqClass by Weak { "com.bapis.bilibili.app.view.v1.ViewReq" from mClassLoader } + val viewUniteMossClass by Weak { "com.bapis.bilibili.app.viewunite.v1.ViewMoss" from mClassLoader } + val viewUniteReqClass by Weak { "com.bapis.bilibili.app.viewunite.v1.ViewReq" from mClassLoader } + val bkArcPartClass by Weak { "com.bapis.bilibili.app.listener.v1.BKArcPart" from mClassLoader } + val builtInThemesClass by Weak { mHookInfo.builtInThemes.class_ from mClassLoader } + val themeColorsConstructor by Weak { + mHookInfo.themeColors.from(mClassLoader)?.declaredConstructors?.firstOrNull { it.isPrivate } + ?.apply { isAccessible = true } + } + val biliGlobalPreferenceClass by Weak { mHookInfo.biliGlobalPreference.class_ from mClassLoader } + val dmMossClass by Weak { "com.bapis.bilibili.community.service.dm.v1.DMMoss" from mClassLoader } + val dmViewReqClass by Weak { "com.bapis.bilibili.community.service.dm.v1.DmViewReq" from mClassLoader } + val treePointItemClass by Weak { "com.bilibili.app.comm.list.common.data.ThreePointItem" from mClassLoader } + val dislikeReasonClass by Weak { "com.bilibili.app.comm.list.common.data.DislikeReason" from mClassLoader } + val cardClickProcessorClass by Weak { mHookInfo.cardClickProcessor.class_ from mClassLoader } + val publishToFollowingConfigClass by Weak { mHookInfo.publishToFollowingConfig from mClassLoader } + val imageFragmentClass by Weak { "com.bilibili.lib.imageviewer.fragment.ImageFragment" from mClassLoader } + val unknownFieldSetLiteInstance by Weak { + "com.google.protobuf.UnknownFieldSetLite".from(mClassLoader) + ?.callStaticMethod("getDefaultInstance") + } + val searchAllResponseClass by Weak { "com.bapis.bilibili.polymer.app.search.v1.SearchAllResponse" from mClassLoader } + val searchVideoCardClass by Weak { "com.bapis.bilibili.polymer.app.search.v1.SearchVideoCard" from mClassLoader } + val playSpeedManager by Weak { mHookInfo.playSpeedManager from mClassLoader } + val continuationClass by Weak { mHookInfo.continuation.class_ from mClassLoader } + val vipQualityTrialService by Weak { mHookInfo.vipQualityTrialService.class_ from mClassLoader } + val livePlayUrlSelectUtilClass by Weak { mHookInfo.liveQuality.selectUtil.class_ from mClassLoader } + val liveRTCSourceServiceImplClass by Weak { mHookInfo.liveQuality.sourceService.class_ from mClassLoader } + val defaultRequestInterceptClass by Weak { mHookInfo.liveQuality.interceptor.class_ from mClassLoader } + val httpUrlClass by Weak { mHookInfo.okHttp.httpUrl.class_ from mClassLoader } + val preBuiltConfigClass by Weak { mHookInfo.preBuiltConfig.class_ from mClassLoader } + val dataSPClass by Weak { mHookInfo.dataSP.class_ from mClassLoader } + val fastjsonFieldAnnotation by Weak { "com.alibaba.fastjson.annotation.JSONField" from mClassLoader } + val gsonFieldAnnotation by Weak { "com.google.gson.annotations.SerializedName" from mClassLoader } + val pegasusParserClass by Weak { mHookInfo.pegasusParser from mClassLoader } + val resolveClientCompanionClass by Weak { mHookInfo.resolveClientCompanion.class_ from mClassLoader } + val videoDownloadEntryClass by Weak { "com.bilibili.videodownloader.model.VideoDownloadEntry" from mClassLoader } + val rewardAdClass by Weak { mHookInfo.rewardAd.class_ from mClassLoader } + val tripleSpeedServiceClass by Weak { "com.bilibili.ship.theseus.united.player.TripleSpeedService\$runOldTripleSpeed\$1\$listener\$1\$onLongPress\$1" from mClassLoader } + val storyPagerPlayerClass by Weak { mHookInfo.storyPagerPlayer.class_ from mClassLoader } + + // Compose guard method,由 initHookInfo 中 DexHelper 查找并缓存到 hook info + val composeGuardMethod by Weak { + mHookInfo.composeGuard.orNull?.let { methodName -> + "androidx.compose.ui.platform.AbstractComposeView" + .findClassOrNull(mClassLoader) + ?.declaredMethods?.find { it.name == methodName } + } + } + + // for v8.17.0+ + val useNewMossFunc = instance.viewMossClass?.declaredMethods?.any { + it.name == "executeRelatesFeed" + } ?: false + + private val unitedVideoActivity by Weak { "com.bilibili.ship.theseus.detail.UnitedBizDetailsActivity" from mClassLoader } + val hasUnitedVideoActivity = !Objects.isNull(unitedVideoActivity) + + val ids: Map by lazy { + mHookInfo.mapIds.idsMap + } + + fun getCustomizeAccessKey(area: String): String? { + var key = sPrefs.getString("${area}_accessKey", null) + if (key.isNullOrBlank()) key = accessKey + return key + } + + val biliAccounts by lazy { + biliAccountsClass?.callStaticMethodOrNull( + mHookInfo.biliAccounts.get.orNull, + AndroidAppHelper.currentApplication() + ) + } + + val accessKey by lazy { + biliAccounts?.callMethodOrNullAs(mHookInfo.biliAccounts.getAccessKey.orNull) + } + + val appKey by lazy { + mHookInfo.biliConfig.getAppKey.orNull?.let { + biliConfigClass?.callStaticMethodOrNullAs(it) + } ?: appKeyMap[packageName] ?: "1d8b6e7d45233436" + } + + val clientVersionCode get() = mHookInfo.clientVersionCode + + fun fastJsonParse() = mHookInfo.fastJson.parse.orNull + + fun colorArray() = mHookInfo.themeHelper.colorArray.orNull + + fun colorId() = mHookInfo.themeIdHelper.colorId.orNull + + fun columnColorArray() = mHookInfo.columnHelper.colorArray.orNull + + fun signQueryName() = mHookInfo.signQuery.method.orNull + + fun skinList() = mHookInfo.skinList.orNull + + fun themeReset() = mHookInfo.themeProcessor.methodsList.map { it.orNull } + + fun homeCenters() = mHookInfo.settings.homeUserCenterList.map { + it.class_ from mClassLoader to it.addSetting.orNull + } + + fun requestField() = mHookInfo.okHttp.response.request.orNull + + fun componentMapField() = mHookInfo.autoLike.kingPositionComponent.componentMap.orNull + + fun setMDataMethod() = mHookInfo.autoLike.storyAbsController.setMData.orNull + + fun getMPlayerMethod() = mHookInfo.autoLike.storyAbsController.getMPlayer.orNull + + fun themeName() = mHookInfo.themeName.field.orNull + + fun downloadingThread() = mHookInfo.downloadThread.field.orNull + + fun reportDownloadThread() = mHookInfo.downloadThread.reportDownload.method.orNull + + fun openDrawer() = mHookInfo.drawer.open.orNull + + fun closeDrawer() = mHookInfo.drawer.close.orNull + + fun isDrawerOpen() = mHookInfo.drawer.isOpen.orNull + + fun paramsToMap() = mHookInfo.bangumiParams.paramsToMap.orNull + + fun gson() = mHookInfo.gsonHelper.gson.orNull + + fun getPlaybackSpeed() = mHookInfo.playerCoreService.getPlaybackSpeed.orNull + + fun urlField() = mHookInfo.okHttp.request.url.orNull + + fun gsonToJson() = mHookInfo.gsonHelper.toJson.orNull + + fun gsonFromJson() = mHookInfo.gsonHelper.fromJson.orNull + + fun pegasusFeed() = mHookInfo.pegasusFeed.method.orNull + + fun descCopy() = mHookInfo.descCopy.methodsList.map { it.orNull } + + fun descCopyView() = mHookInfo.descCopy.classesList.map { it from mClassLoader } + + fun comment3Copy() = mHookInfo.comment3Copy.method.orNull + + fun comment3ViewIndex() = mHookInfo.comment3Copy.comment3ViewIndex + + fun responseDataField() = runCatchingOrNull { + rxGeneralResponseClass?.getDeclaredField("data")?.name + } ?: "_data" + + fun okio() = mHookInfo.okio.field.orNull + + fun okioLength() = mHookInfo.okio.length.orNull + + fun okioInputStream() = mHookInfo.okioBuffer.inputStream.orNull + + fun okioReadFrom() = mHookInfo.okioBuffer.readFrom.orNull + + fun seekTo() = mHookInfo.playerCoreService.seekTo.orNull + + fun onSeekComplete() = mHookInfo.playerCoreService.onSeekComplete.orNull + + fun kanbanCallback() = mHookInfo.kanBan.method.orNull + + fun showToast() = mHookInfo.toastHelper.show.orNull + + fun cancelShowToast() = mHookInfo.toastHelper.cancel.orNull + + fun canTrialMethod() = mHookInfo.vipQualityTrialService.canTrial.orNull + + fun setInvalidTips() = commentInvalidFragmentClass?.declaredMethods?.find { m -> + m.parameterTypes.let { it.size == 2 && it[0] == commentInvalidFragmentClass && it[1].name == "kotlin.Pair" } + }?.name + + fun create() = mHookInfo.okHttp.responseBody.create.orNull + + fun string() = mHookInfo.okHttp.responseBody.string.orNull + + fun get() = mHookInfo.okHttp.mediaType.get.orNull + + fun setParser() = mHookInfo.biliCall.setParser.orNull + + fun biliCallRequestField() = mHookInfo.biliCall.request.orNull + + fun onOperateClick() = mHookInfo.onOperateClick.orNull + + fun operateClickHostClass() = mHookInfo.operateClickHostClass.orNull + + fun getContentString() = mHookInfo.getContentString.orNull + + fun check() = mHookInfo.updateInfoSupplier.check.orNull + + fun dynamicDescHolderListeners() = + mHookInfo.dynDescHolderListenerList.map { it.from(mClassLoader) } + + fun playerFullStoryWidgets() = + mHookInfo.playerFullStoryWidgetList.map { it.class_.from(mClassLoader) to it.method.orNull } + + fun bangumiUniformSeasonActivityEntrance() = mHookInfo.bangumiSeasonActivityEntrance.orNull + + fun getPreload() = mHookInfo.playerPreloadHolder.get.orNull + + fun playerQualityServices() = + mHookInfo.playerQualityServiceList.map { it.class_.from(mClassLoader) to it.getDefaultQnThumb.orNull } + + fun getDefaultQn() = mHookInfo.playerSettingHelper.getDefaultQn.orNull + + fun selectQuality() = mHookInfo.qualityStrategyProvider.selectQuality.orNull + + fun liveRtcEnable() = mHookInfo.liveRtcHelper.liveRtcEnableMethod.orNull + + fun allThemesField() = mHookInfo.builtInThemes.all.orNull + + fun getBLKVPrefs() = mHookInfo.biliGlobalPreference.get.orNull + + fun onFeedClicked() = mHookInfo.cardClickProcessor.onFeedClicked.orNull + + fun buildSelectorDataMethod() = mHookInfo.liveQuality.selectUtil.buildSelectorData.orNull + + fun switchAutoMethod() = mHookInfo.liveQuality.sourceService.switchAuto.orNull + + fun interceptMethod() = mHookInfo.liveQuality.interceptor.intercept.orNull + + fun httpUrlParseMethod() = mHookInfo.okHttp.httpUrl.parse.orNull + + fun getPreBuiltConfigMethod() = mHookInfo.preBuiltConfig.get.orNull + + fun getDataSPMethod() = mHookInfo.dataSP.get.orNull + + fun buildCommonResolverParamsMethod() = + mHookInfo.resolveClientCompanion.buildCommonResolverParams.orNull + + fun setExtraContentMethod() = mHookInfo.gCommonResolverParams.setExtraContent.orNull + + fun rewardFlag() = mHookInfo.rewardAd.rewardFlag.orNull + + fun addVideo() = mHookInfo.storyPagerPlayer.addVideo.orNull + + private fun readHookInfo(context: Context): Configs.HookInfo { + try { + val hookInfoFile = File(context.cacheDir, Constant.HOOK_INFO_FILE_NAME) + Log.d("Reading hook info: $hookInfoFile") + val t = measureTimeMillis { + if (hookInfoFile.isFile && hookInfoFile.canRead()) { + val lastUpdateTime = context.packageManager.getPackageInfo( + AndroidAppHelper.currentPackageName(), + 0 + ).lastUpdateTime + val lastModuleUpdateTime = try { + context.packageManager.getPackageInfo(BuildConfig.APPLICATION_ID, 0) + } catch (e: Throwable) { + null + }?.lastUpdateTime ?: 0 + val info = FileInputStream(hookInfoFile).use { + runCatchingOrNull { Configs.HookInfo.parseFrom(it) } + ?: Configs.HookInfo.newBuilder().build() + } + if (info.lastUpdateTime >= lastUpdateTime && info.lastUpdateTime >= lastModuleUpdateTime + && getVersionCode(context.packageName) == info.clientVersionCode + && BuildConfig.VERSION_CODE == info.moduleVersionCode + && BuildConfig.VERSION_NAME == info.moduleVersionName + && info.generation >= getModuleGeneration(context) + && info.biliAccounts.getAccessKey.orNull != null + ) + return info + } + } + Log.d("Read hook info completed: take $t ms") + } catch (e: Throwable) { + Log.w(e) + } + return initHookInfo(context).also { + try { + val hookInfoFile = File(context.cacheDir, Constant.HOOK_INFO_FILE_NAME) + if (hookInfoFile.exists()) hookInfoFile.delete() + FileOutputStream(hookInfoFile).use { o -> it.writeTo(o) } + } catch (e: Exception) { + Log.e(e) + } + } + } + + companion object { + @JvmStatic + fun findRealClassloader(classloader: BaseDexClassLoader): BaseDexClassLoader { + val serviceField = classloader.javaClass.findFirstFieldByExactTypeOrNull( + "com.bilibili.lib.tribe.core.internal.loader.DefaultClassLoaderService" from classloader + ) + val delegateField = classloader.javaClass.findFirstFieldByExactTypeOrNull( + "com.bilibili.lib.tribe.core.internal.loader.TribeLoaderDelegate" from classloader + ) + return if (serviceField != null) { + serviceField.type.declaredFields.filter { f -> + f.type == ClassLoader::class.java + }.map { f -> + classloader.getObjectFieldOrNull(serviceField.name) + ?.getObjectFieldOrNull(f.name) + }.firstOrNull { o -> + o?.javaClass?.name?.startsWith("com.bilibili") == false + } as? BaseDexClassLoader ?: classloader + } else if (delegateField != null) { + val loaderField = + delegateField.type.findFirstFieldByExactTypeOrNull(ClassLoader::class.java) + val out = classloader.getObjectFieldOrNull(delegateField.name) + ?.getObjectFieldOrNull(loaderField?.name) + if (BaseDexClassLoader::class.java.isInstance(out)) out as BaseDexClassLoader else classloader + } else classloader + } + + private fun getModuleGeneration(context: Context): Int = try { + context.createPackageContext(BuildConfig.APPLICATION_ID, + Context.CONTEXT_IGNORE_SECURITY) + .getSharedPreferences("biliroaming_hookinfo", Context.MODE_PRIVATE) + .getInt("generation", 0) + } catch (_: Exception) { 0 } + + @JvmStatic + fun initHookInfo(context: Context) = hookInfo { + val classloader = context.classLoader + val classesList = context.classLoader.allClassesList(::findRealClassloader).asSequence() + + try { + System.loadLibrary("biliroaming") + } catch (e: Throwable) { + Log.e(e) + Log.toast("不支持该架构或框架,部分功能可能失效") + return@hookInfo + } + + val dexHelper = + DexHelper(classloader.findDexClassLoader(::findRealClassloader) ?: return@hookInfo) + + // 查找 AbstractComposeView 的 addView 守卫方法(供 SplashHook 使用) + val guardMethod = dexHelper.findMethodUsingString( + "Cannot add views to ", + true, + -1, -1, null, + -1, + null, null, null, true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + } + if (guardMethod != null) { + composeGuard = method { name = guardMethod.name } + } + + lastUpdateTime = max( + context.packageManager.getPackageInfo( + AndroidAppHelper.currentPackageName(), + 0 + ).lastUpdateTime, + runCatchingOrNull { + context.packageManager.getPackageInfo( + BuildConfig.APPLICATION_ID, + 0 + ) + }?.lastUpdateTime ?: 0 + ) + clientVersionCode = getVersionCode(context.packageName) + moduleVersionCode = BuildConfig.VERSION_CODE + moduleVersionName = BuildConfig.VERSION_NAME + generation = getModuleGeneration(context) + mapIds = mapIds { + val reg = Regex("^tv\\.danmaku\\.bili\\.[^.]*$") + val mask = Modifier.STATIC or Modifier.PUBLIC or Modifier.FINAL + classesList.filter { + it.startsWith("tv.danmaku.bili") + }.filter { + it.matches(reg) + }.flatMap { c -> + c.findClass(classloader).declaredFields.filter { + it.modifiers == mask + && it.type == Int::class.javaPrimitiveType + } + }.forEach { ids[it.name] = it.get(null) as Int } + } + + bangumiApiResponse = class_ { + name = "com.bilibili.bangumi.data.common.api.BangumiApiResponse" + } + retrofitResponse = class_ { + name = "retrofit2.Response".from(classloader)?.name + ?: dexHelper.findMethodUsingString( + "rawResponse must be successful response", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.declaringClass?.name ?: return@class_ + } + val responseBodyClass = "okhttp3.ResponseBody".from(classloader) + ?: dexHelper.findMethodUsingString( + "Cannot buffer entire body for content length: ", + false, + -1, + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it) + }.firstOrNull { + it.declaringClass?.name?.startsWith("okhttp3") == true + }?.declaringClass + okHttp = okHttp { + val responseClass = "okhttp3.Response".from(classloader) + ?: dexHelper.findMethodUsingString( + "Response{protocol=", + false, + -1, + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it) + }.firstOrNull { + it.declaringClass?.name?.startsWith("okhttp3") == true + }?.declaringClass ?: return@okHttp + val requestClass = "okhttp3.Request".from(classloader) + ?: dexHelper.findMethodUsingString( + "Request{method=", + false, + -1, + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it) + }.firstOrNull { + it.declaringClass?.name?.startsWith("okhttp3") == true + }?.declaringClass ?: return@okHttp + val urlClass = "okhttp3.HttpUrl".from(classloader) + ?: dexHelper.findMethodUsingString( + ":@", + false, + -1, + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it) + }.firstOrNull { + it.declaringClass?.name?.startsWith("okhttp3") == true + }?.declaringClass ?: return@okHttp + val parseMethod = urlClass.declaredMethods.firstOrNull { + it.isStatic && it.returnType == urlClass && it.parameterCount == 1 && it.parameterTypes[0] == String::class.java + } ?: return@okHttp + responseBodyClass ?: return@okHttp + val getMethod = dexHelper.findMethodUsingString( + "No subtype found for:", + true, + -1, + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it) + }.firstOrNull { + it.declaringClass?.name?.startsWith("okhttp3") == true + } ?: return@okHttp + request = request { + class_ = class_ { name = requestClass.name } + url = field { + name = requestClass.findFirstFieldByExactTypeOrNull(urlClass)?.name + ?: return@field + } + } + response = response { + class_ = class_ { name = responseClass.name } + request = field { + name = responseClass.findFirstFieldByExactTypeOrNull(requestClass)?.name + ?: return@field + } + } + responseBody = responseBody { + class_ = class_ { name = responseBodyClass.name } + create = method { + name = responseBodyClass.methods.find { + it.isStatic && it.parameterTypes.size == 2 && it.parameterTypes[1] == String::class.java + }?.name ?: return@method + } + string = method { + name = responseBodyClass.declaredMethods.find { + it.parameterTypes.isEmpty() && it.returnType == String::class.java + }?.name ?: return@method + } + } + mediaType = mediaType { + class_ = class_ { name = getMethod.declaringClass.name } + get = method { name = getMethod.name } + } + httpUrl = httpUrl { + class_ = class_ { name = urlClass.name } + parse = method { name = parseMethod.name } + } + } + fastJson = fastJson { + val fastJsonClass = dexHelper.findMethodUsingString( + "toJSON error", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.declaringClass ?: return@fastJson + val notObfuscated = "JSON" == fastJsonClass.simpleName + class_ = class_ { name = fastJsonClass.name } + parse = method { name = if (notObfuscated) "parseObject" else "a" } + } + biliAccounts = biliAccounts { + val biliAccountsClass = dexHelper.findMethodUsingString( + "logout with account exception", + false, + -1, + 1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.declaringClass ?: return@biliAccounts + class_ = class_ { name = biliAccountsClass.name } + val biliAccountIndex = dexHelper.encodeClassIndex(biliAccountsClass) + // 调用图反推兼容方法名被混淆的历史版本;锚点 "initFacial enter" 失效时 + // (如 8.98.0 方法名未混淆),回退到按签名/方法名直接查找 + val calledMethods = dexHelper.findMethodUsingString( + "initFacial enter", + true, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.findMethodInvoking( + it, + -1, + -1, + null, + biliAccountIndex, + null, + null, + null, + false + ).asSequence().mapNotNull { m -> + dexHelper.decodeMethodIndex(m) as? Method + } + } + + get = method { + name = calledMethods?.firstOrNull { + it.isStatic && it.parameterTypes.size == 1 && it.parameterTypes[0] == Context::class.java && it.returnType == biliAccountsClass + }?.name ?: biliAccountsClass.declaredMethods.firstOrNull { + it.isStatic && it.parameterTypes.size == 1 + && it.parameterTypes[0] == Context::class.java + && it.returnType == biliAccountsClass + }?.name ?: return@method + } + getAccessKey = method { + name = calledMethods?.firstOrNull { + it.isNotStatic && it.parameterTypes.isEmpty() && it.returnType == String::class.java + }?.name ?: biliAccountsClass.declaredMethods.firstOrNull { + it.name == "getAccessKey" && it.isNotStatic + && it.parameterTypes.isEmpty() + && it.returnType == String::class.java + }?.name ?: return@method + } + } + themeHelper = themeHelper { + val colorArrayMethod = dexHelper.findMethodUsingString( + "theme_entries_last_key", + false, + dexHelper.encodeClassIndex(Int::class.java), + 1, + null, + -1, + longArrayOf(dexHelper.encodeClassIndex(Context::class.java)), + null, + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + } ?: return@themeHelper + + class_ = class_ { name = colorArrayMethod.declaringClass.name } + colorArray = field { name = colorArrayMethod.name } + } + themeIdHelper = themeIdHelper { + val mWebActivityClass = "tv.danmaku.bili.ui.webview.MWebActivity".from(classloader) + ?: return@themeIdHelper + val mWebActivityIndex = dexHelper.encodeClassIndex(mWebActivityClass) + val themeIdHelperClass = dexHelper.findMethodUsingString( + "native.theme", + false, + -1, + -1, + null, + mWebActivityIndex, + null, + null, + null, + true + ).firstOrNull()?.run { + dexHelper.findMethodInvoking( + this, + -1, + 0, + "I", + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + }?.declaringClass + } ?: return@themeIdHelper + class_ = class_ { name = themeIdHelperClass.name } + colorId = field { + name = themeIdHelperClass.declaredFields.find { + it.type == SparseArray::class.java + }?.name ?: return@field + } + } + columnHelper = columnHelper { + val columnHelperClass = classesList.filter { + it.startsWith("com.bilibili.column.helper") + }.firstNotNullOfOrNull { c -> + c.findClass(classloader).takeIf { + it.declaredFields.count { f -> + Modifier.isStatic(it.modifiers) && f.type == SparseArray::class.java + } > 1 + } + } ?: return@columnHelper + class_ = class_ { + name = columnHelperClass.name ?: return@class_ + } + colorArray = field { + name = columnHelperClass.declaredFields.firstOrNull { + it.type == SparseArray::class.java && + (it.genericType as ParameterizedType).actualTypeArguments[0].toString() == "int[]" + }?.name ?: return@field + } + } + skinList = method { + val biliSkinListClass = + "tv.danmaku.bili.ui.theme.api.BiliSkinList".findClassOrNull(classloader) + ?: return@method + name = + "tv.danmaku.bili.ui.theme.ThemeStoreActivity".findClassOrNull(classloader)?.declaredMethods?.firstOrNull { + it.parameterTypes.size == 2 && it.parameterTypes[0] == biliSkinListClass && + it.parameterTypes[1] == Boolean::class.javaPrimitiveType + }?.name ?: return@method + } + themeProcessor = themeProcessor { + val biliSkinListClass = + "tv.danmaku.bili.ui.theme.api.BiliSkinList".findClassOrNull(classloader) + val themeProcessorClass = classesList.filter { + it.startsWith("tv.danmaku.bili.ui.theme") + }.firstNotNullOfOrNull { c -> + c.findClass(classloader).takeIf { + it.declaredFields.count { f -> + f.type == biliSkinListClass + } > 1 + } + } ?: return@themeProcessor + class_ = class_ { name = themeProcessorClass.name } + methods += themeProcessorClass.declaredMethods.filter { + it.parameterTypes.isEmpty() && it.modifiers == 0 + }.map { method { name = it.name } } + } + themeListClick = class_ { + name = + "tv.danmaku.bili.ui.theme.ThemeStoreActivity".findClassOrNull(classloader)?.declaredClasses?.firstOrNull { + it.interfaces.contains(View.OnClickListener::class.java) + }?.name ?: return@class_ + } + themeName = themeName { + val mainGarbClass = dexHelper.findMethodUsingString( + ".garb.GARB_CHANGE", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it)?.declaringClass + }.firstOrNull() ?: return@themeName + val id2NameIndex = dexHelper.findMethodUsingString( + "white", + false, + -1, + 1, + null, + dexHelper.encodeClassIndex(mainGarbClass), + null, + null, + null, + true + ).asSequence().firstOrNull() ?: return@themeName + val themeNameClass = dexHelper.findMethodInvoking( + id2NameIndex, + dexHelper.encodeClassIndex(Map::class.java), + 0, + null, + -1, + null, + null, + null, + true + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it)?.declaringClass + }.firstOrNull() ?: return@themeName + class_ = class_ { + name = themeNameClass.name + } + field = field { + name = themeNameClass.declaredFields.firstOrNull { + it.type == Map::class.java + && Modifier.isStatic(it.modifiers) + }?.name ?: return@field + } + } + autoLike = autoLike { + kingPositionComponent = kingPositionComponent { + val kingPositionComponentClass = dexHelper.findMethodUsingString( + "LikeClicked(view=", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it)?.declaringClass?.run { + var outerClass = this + while (outerClass.declaringClass != null) { + outerClass = outerClass.declaringClass!! + } + outerClass + } + } ?: return@kingPositionComponent + val componentMapField = kingPositionComponentClass.declaredFields.firstOrNull { + it.type == Map::class.java + } ?: return@kingPositionComponent + class_ = class_ { name = kingPositionComponentClass.name } + componentMap = field { name = componentMapField.name } + } + storyAbsController = storyAbsController { + val storyAbsControllerClass = dexHelper.findMethodUsingString( + "notify player state fail", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it)?.declaringClass + }.firstOrNull() ?: return@storyAbsController + val storyPagerPlayerInterface = dexHelper.findMethodUsingString( + " play item but is inactivate", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it)?.declaringClass?.interfaces?.getOrNull(0) + }.firstOrNull() ?: return@storyAbsController + val storyDetailClass = "com.bilibili.video.story.StoryDetail".from(classloader) + val setMDataMethod = storyAbsControllerClass.declaredMethods.firstOrNull { + it.returnType == Void.TYPE && it.parameterCount == 1 && it.parameterTypes[0] == storyDetailClass + } ?: return@storyAbsController + val getMPlayerMethod = storyAbsControllerClass.declaredMethods.firstOrNull { + storyPagerPlayerInterface.isAssignableFrom(it.returnType) && it.parameterCount == 0 + } ?: return@storyAbsController + class_ = class_ { name = storyAbsControllerClass.name } + setMData = method { name = setMDataMethod.name } + getMPlayer = method { name = getMPlayerMethod.name } + } + } + signQuery = signQuery { + val signedQueryClass = + "com.bilibili.nativelibrary.SignedQuery".findClassOrNull(classloader) + ?: return@signQuery + val libBiliClass = + "com.bilibili.nativelibrary.LibBili" from classloader ?: return@signQuery + class_ = class_ { name = libBiliClass.name } + method = method { + name = libBiliClass.declaredMethods.firstOrNull { + it.parameterTypes.size == 1 && it.parameterTypes[0] == Map::class.java && + it.returnType == signedQueryClass + }?.name ?: return@method + } + } + settings = settings { + val menuGroupItemClass = + ("com.bilibili.lib.homepage.mine.MenuGroup\$Item" from classloader) + ?: return@settings + menuGroupItem = class_ { name = menuGroupItemClass.name } + settingRouter = class_ { + name = dexHelper.findMethodUsingString( + "UperHotMineSolution", + false, + -1, + 0, + "V", + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.declaringClass?.interfaces?.firstOrNull()?.let { + dexHelper.encodeClassIndex(it) + }?.let { + dexHelper.findField(it, null, true).asSequence().firstNotNullOfOrNull { f -> + dexHelper.decodeFieldIndex(f) + }?.declaringClass + }?.name ?: return@class_ + } + val contextIndex = dexHelper.encodeClassIndex(Context::class.java) + val listIndex = dexHelper.encodeClassIndex(List::class.java) + // 旧版 DEX 扫描链: 先通过字符串定位 HomeUserCenter 类 + val homeUserCenterClasses = dexHelper.findMethodUsingString( + "main.my-information.noportrait.0.show", + false, + -1, + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().mapNotNull { dexHelper.decodeMethodIndex(it)?.declaringClass }.toList() + val legacyResult = homeUserCenterClasses.mapNotNull { homeUserCenterClass -> + val homeUserCenterIndex = dexHelper.encodeClassIndex(homeUserCenterClass) + val addSettingMethod = dexHelper.findMethodUsingString( + "bilibili://main/scan", + true, + -1, + -1, + null, + homeUserCenterIndex, + null, + longArrayOf(contextIndex), + null, + false + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it) as? Method + }.firstOrNull { + it.parameterTypes.size == 2 && + it.parameterTypes[1] != List::class.java + } ?: dexHelper.findMethodUsingString( + "activity://main/preference", + true, + -1, + -1, + null, + homeUserCenterIndex, + null, + longArrayOf(contextIndex, listIndex), + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + } ?: dexHelper.findMethodUsingString( + "bilibili://main/preference", + true, + -1, + -1, + null, + homeUserCenterIndex, + null, + longArrayOf(contextIndex, listIndex), + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + } + addSettingMethod?.let { homeUserCenterClass to it } + }.toList() + if (legacyResult.isNotEmpty()) { + legacyResult.forEach { (cls, method) -> + homeUserCenter += homeUserCenter { + class_ = class_ { name = cls.name } + addSetting = method { name = method.name } + } + } + } else { + // 8.97.0: addSetting 方法未找到,通过字符串扫描拿到的类找菜单适配器 + val adapterType = + ("androidx.recyclerview.widget.RecyclerView\$Adapter" from classloader) + ?: ("android.support.v7.widget.RecyclerView\$Adapter" from classloader) + mineAdapter = class_ { + adapterType ?: return@class_ + name = homeUserCenterClasses.firstNotNullOfOrNull { cls -> + cls.declaredFields.firstOrNull { + adapterType.isAssignableFrom(it.type) + }?.type?.name + } ?: return@class_ + } + } + } + drawer = drawer { + val navigationViewClass = + "android.support.design.widget.NavigationView" from classloader + val regex = Regex("^tv\\.danmaku\\.bili\\.ui\\.main2\\.[^.]*$") + class_ = class_ { + name = classesList.filter { + it.startsWith("tv.danmaku.bili.ui.main2") + }.filter { it.matches(regex) }.firstOrNull { c -> + c.findClass(classloader).declaredFields.any { + it.type == navigationViewClass + } + } ?: return@class_ + } + val drawerLayoutClass = "androidx.drawerlayout.widget.DrawerLayout" from classloader + ?: "android.support.v4.widget.DrawerLayout" from classloader ?: return@drawer + layout = class_ { name = drawerLayoutClass.name } + layoutParams = class_ { + name = drawerLayoutClass.declaredClasses.firstOrNull { + it.superclass == ViewGroup.MarginLayoutParams::class.java + }?.name ?: return@class_ + } + try { + open = method { + name = drawerLayoutClass.getMethod( + "openDrawer", + View::class.java, + Boolean::class.javaPrimitiveType + ).name ?: throw Throwable() + } + close = method { + name = drawerLayoutClass.getMethod( + "closeDrawer", + View::class.java, + Boolean::class.javaPrimitiveType + ).name ?: throw Throwable() + } + } catch (e: Throwable) { + val a = drawerLayoutClass.declaredMethods.filter { + Modifier.isPublic(it.modifiers) && + it.parameterTypes.size == 2 && it.parameterTypes[0] == View::class.java && + it.parameterTypes[1] == Boolean::class.javaPrimitiveType + }.map { it.name }.toTypedArray() + if (a.size == 2) { + open = method { name = a[0] } + close = method { name = a[1] } + } + } + isOpen = method { + name = runCatchingOrNull { + drawerLayoutClass.getMethod("isDrawerOpen", View::class.java).name + } ?: drawerLayoutClass.declaredMethods.firstOrNull { + Modifier.isPublic(it.modifiers) && + it.parameterTypes.size == 1 && it.parameterTypes[0] == View::class.java && + it.returnType == Boolean::class.javaPrimitiveType + }?.name ?: return@method + } + } + downloadThread = downloadThread { + val viewHostClass = (if (platform == "android_hd") + "tv.danmaku.bili.ui.offline.HdOfflineDowningFragment".from(classloader) + else + "tv.danmaku.bili.ui.offline.DownloadingActivity".from(classloader)) + ?: return@downloadThread + viewHost = class_ { name = viewHostClass.name } + field = field { + name = viewHostClass.declaredFields.find { + it.type == Int::class.javaPrimitiveType + }?.name ?: return@downloadThread + } + val onTaskCountClickMethod = viewHostClass.declaredMethods.find { m -> + m.isSynthetic && m.parameterTypes.let { + it.size == 4 && if (platform == "android_hd") { + it[0] == TextView::class.java && it[1] == viewHostClass + } else it[0] == viewHostClass && it[1] == TextView::class.java + } + } ?: return@downloadThread + val listenerClass = dexHelper.findMethodInvoked( + dexHelper.encodeMethodIndex(onTaskCountClickMethod), + -1, + 1, + "VL", + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + }?.declaringClass ?: return@downloadThread + listener = class_ { name = listenerClass.name } + val reportMethod = dexHelper.findMethodUsingString( + "meantime", + false, + -1, + -1, + null, + dexHelper.encodeClassIndex(viewHostClass), + null, + null, + null, + true + ).firstOrNull()?.run { + dexHelper.findMethodInvoking( + this, + -1, + 2, + "VLI", + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + } + } ?: return@downloadThread + reportDownload = reportDownload { + class_ = class_ { name = reportMethod.declaringClass.name } + method = method { name = reportMethod.name } + } + } + bangumiParams = bangumiParams { + val bangumiParamsClass = dexHelper.findMethodUsingString( + "UniformSeasonParams(", + true, + -1, + 0, + null, + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + }?.declaringClass ?: return@bangumiParams + class_ = class_ { name = bangumiParamsClass.name } + paramsToMap = method { + name = bangumiParamsClass.declaredMethods.firstOrNull { + it.returnType == java.util.Map::class.java + }?.name ?: return@method + } + } + gsonHelper = gsonHelper { + val gsonClass = dexHelper.findMethodUsingString( + "AssertionError (GSON", + true, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.declaringClass ?: return@gsonHelper + val gsonConverterClass = + dexHelper.findField(dexHelper.encodeClassIndex(gsonClass), null, false) + .asSequence().firstNotNullOfOrNull { + dexHelper.decodeFieldIndex(it)?.takeIf { f -> + f.isStatic && f.isFinal && f.isPublic + }?.declaringClass?.takeIf { c -> + c.declaredMethods.any { m -> + m.returnType == gsonClass && m.isNotStatic + } + } + } ?: return@gsonHelper + gsonConverter = class_ { name = gsonConverterClass.name } + gson = field { + name = gsonConverterClass.declaredMethods.firstOrNull { m -> + m.returnType == gsonClass && m.isNotStatic + }?.name ?: return@field + } + toJson = method { + name = gsonClass.declaredMethods.firstOrNull { m -> + m.returnType == String::class.java && m.parameterTypes.size == 1 && m.parameterTypes[0] == Object::class.java + }?.name ?: return@method + } + fromJson = method { + name = gsonClass.declaredMethods.firstOrNull { m -> + m.returnType == Object::class.java && m.parameterTypes.size == 2 && m.parameterTypes[0] == String::class.java && m.parameterTypes[1] == Class::class.java + }?.name ?: return@method + } + } + playerCoreService = playerCoreService { + val seekToMethod = dexHelper.findMethodUsingString( + "[player]seek to", + true, + -1, + 1, + "VI", + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + } ?: run { + val doSeekToIndex = dexHelper.findMethodUsingString( + "[player]seek to", + true, + -1, + 2, + "VIZ", + -1, + null, + null, + null, + true + ).firstOrNull() ?: return@playerCoreService + val doSeekToMethod = + dexHelper.decodeMethodIndex(doSeekToIndex) ?: return@playerCoreService + val playerCoreServiceIndex = + dexHelper.encodeClassIndex(doSeekToMethod.declaringClass) + dexHelper.findMethodInvoked( + doSeekToIndex, + -1, + 1, + "VI", + playerCoreServiceIndex, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + } ?: run { + dexHelper.findMethodInvoked( + doSeekToIndex, + -1, + 2, + "VIZ", + playerCoreServiceIndex, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + } + } ?: doSeekToMethod + } + val playerCoreServiceClass = seekToMethod.declaringClass + seekTo = method { name = seekToMethod.name } + class_ = class_ { name = playerCoreServiceClass.name } + val onSeekCompleteMethod = dexHelper.findMethodUsingString( + "[player]seek complete", + true, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + } ?: return@playerCoreService + onSeekComplete = method { name = onSeekCompleteMethod.name } + seekCompleteListener = + class_ { name = onSeekCompleteMethod.declaringClass.name } + getPlaybackSpeed = method { + name = dexHelper.findMethodUsingString( + "player_key_video_speed", + true, + -1, + 1, + "FZ", + dexHelper.encodeClassIndex(playerCoreServiceClass), + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.name ?: return@method + } + } + val playSpeedManagerClass = ("com.bilibili.player.tangram.basic.PlaySpeedManagerImpl" from classloader) ?: run { + val pcsFacadeClass = dexHelper.findMethodUsingString( + "Cannot switch to quality ", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.declaringClass ?: return@run null + + val playSpeedManagerInterface = pcsFacadeClass.declaredFields.firstNotNullOfOrNull { f -> + if (f.type.isInterface && f.type.declaredMethods.size == 1) f.type else null + } + classesList.filter { + it.startsWith("com.bilibili.player.tangram") + }.firstNotNullOfOrNull { c -> + c.findClass(classloader).takeIf { it.interfaces.contains(playSpeedManagerInterface) } + } + } + playSpeedManager = class_ { + name = playSpeedManagerClass?.name ?: return@class_ + } + generalResponse = class_ { + name = "com.bilibili.okretro.GeneralResponse" + } + pegasusFeed = pegasusFeed { + val fastJSONObject = + dexHelper.encodeClassIndex( + "com.alibaba.fastjson.JSONObject" from classloader ?: return@pegasusFeed + ) + val pegasusFeedClass = dexHelper.findMethodUsingString( + "card_type is empty", + false, + -1, + -1, + null, + -1, + null, + longArrayOf(fastJSONObject), + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.declaringClass ?: return@pegasusFeed + class_ = class_ { name = pegasusFeedClass.name } + method = method { + name = pegasusFeedClass.declaredMethods.firstOrNull { + it.parameterTypes.size == 1 && it.parameterTypes[0].name == this@hookInfo.okHttp.responseBody.class_.name + && it.returnType != Object::class.java + }?.name ?: return@method + } + } + popular = popular { + class_ = class_ { name = "com.bapis.bilibili.app.show.popular.v1.PopularMoss" } + method = method { + name = "index" + } + } + chronosSwitch = class_ { + val regex = Regex("""^tv\.danmaku\.chronos\.wrapper\.[^.]*$""") + name = classesList.filter { + it.matches(regex) + }.firstOrNull { c -> + c.findClass(classloader).declaredFields.count { + it.type == Boolean::class.javaObjectType + } >= 5 + } ?: return@class_ + } + subtitleSpan = class_ { + name = classesList.filter { + it.startsWith("tv.danmaku.danmaku.subititle") || + it.startsWith("tv.danmaku.danmaku.subtitle") + }.firstOrNull { c -> + c.findClass(classloader).interfaces.contains(LineBackgroundSpan::class.java) + } ?: return@class_ + } + val commentSpanClass = "com.bilibili.app.comm.comment2.widget.CommentExpandableTextView" + .from(classloader) ?: dexHelper.findMethodUsingString( + "comment.catch_on_draw_exception", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.declaringClass + commentSpan = class_ { + name = commentSpanClass?.name ?: return@class_ + } + val viewIndex = dexHelper.encodeClassIndex(View::class.java) + commentLongClick = class_ { + val onLongClickListenerIndex = dexHelper.encodeMethodIndex( + View::class.java.getDeclaredMethod( + "setOnLongClickListener", + View.OnLongClickListener::class.java + ) + ) + name = dexHelper.findMethodInvoked( + onLongClickListenerIndex, + -1, + 2, + "VLL", + -1, + longArrayOf(viewIndex, -1), + null, + null, + false + ).firstOrNull { + dexHelper.decodeMethodIndex(it)?.run { + this !is Constructor<*> && isStatic && isPublic && (this as? Method)?.parameterTypes.let { t -> + t?.get(0) == View::class.java && t[1] != CharSequence::class.java + } + } == true + }?.let { + dexHelper.findMethodInvoking(it, -1, 2, "VLL", -1, null, null, null, false) + .asSequence() + .firstNotNullOfOrNull { m -> dexHelper.decodeMethodIndex(m) }?.declaringClass?.name + } ?: return@class_ + } + commentLongClickNew = class_ { + val setExpandLinesMethod = commentSpanClass?.declaredMethods?.find { + it.parameterTypes.size == 1 && it.parameterTypes[0] == Int::class.javaPrimitiveType + } ?: return@class_ + val setExpandLinesIndex = dexHelper.encodeMethodIndex(setExpandLinesMethod) + name = dexHelper.findMethodInvoked( + setExpandLinesIndex, + -1, + 1, + null, + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.findMethodInvoking(it, -1, 2, "VLL", -1, null, null, null, true) + .map { m -> dexHelper.decodeMethodIndex(m) } + .firstOrNull()?.declaringClass?.name + } ?: return@class_ + } + okio = okIO { + val responseClassIndex = + dexHelper.encodeClassIndex(responseBodyClass ?: return@okIO) + val createMethodIndex = dexHelper.findMethodUsingString( + "source == null", + false, + -1, + -1, + null, + responseClassIndex, + null, + null, + null, + true + ).firstOrNull() ?: return@okIO + val wrapperClass = dexHelper.findMethodInvoking( + createMethodIndex, + -1, + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it).takeIf { m -> + m is Constructor<*> + } + }?.declaringClass ?: return@okIO + class_ = class_ { name = wrapperClass.name } + val okioField = wrapperClass.declaredFields.firstOrNull { f -> + f.type.isAbstract + } ?: return@okIO + field = field { name = okioField.name } + val okioLenField = wrapperClass.declaredFields.firstOrNull { f -> + f.type == Long::class.javaPrimitiveType + } ?: return@okIO + length = field { name = okioLenField.name } + } + okioBuffer = okIOBuffer { + val okioBufferClass = dexHelper.findMethodUsingString( + "already attached to a buffer", + false, + -1, + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it) + }.firstNotNullOfOrNull { + val method = it as? Method ?: return@firstNotNullOfOrNull null + val firstParameterType = method.parameterTypes.firstOrNull() + val returnType = method.returnType + when { + method.declaringClass?.name?.startsWith("okio") != true -> null + // https://github.com/square/okio/blob/okio-parent-2.0.0-RC1/okio/jvm/src/main/java/okio/Buffer.kt#L1717 + firstParameterType == null || firstParameterType == returnType -> it.declaringClass + // https://github.com/square/okio/blob/parent-2.10.0/okio/src/commonMain/kotlin/okio/internal/Buffer.kt#L1509 + else -> firstParameterType + } + } ?: return@okIOBuffer + class_ = class_ { name = okioBufferClass.name } + val okioInputStreamMethod = okioBufferClass.declaredMethods.firstOrNull { + it.parameterTypes.isEmpty() && it.returnType == InputStream::class.java + } ?: return@okIOBuffer + inputStream = method { name = okioInputStreamMethod.name } + val okioReadFromMethod = okioBufferClass.declaredMethods.firstOrNull { + it.parameterTypes.size == 1 && it.parameterTypes[0] == InputStream::class.java + } ?: return@okIOBuffer + readFrom = method { name = okioReadFromMethod.name } + } + classesList.filter { + it.startsWith("com.bilibili.bplus.followinglist.module.item") + && View.OnLongClickListener::class.java.isAssignableFrom(it.on(classloader)) + }.let { l -> dynDescHolderListener.addAll(l.toList().map { class_ { name = it } }) } + descCopy = descCopy { + classesList.filter { + it.startsWith("com.bilibili.ship.theseus.ugc.intro.ugcheadline.UgcIntroductionComponent") + }.map { it.on(classloader) }.flatMap { c -> + c.declaredMethods.filter { + it.isPublic && it.parameterCount == 2 && it.parameterTypes[0] == View::class.java && it.parameterTypes[1] == ClickableSpan::class.java + } + }.forEach { + classes += class_ { name = it.declaringClass.name } + methods += method { name = it.name } + } + + val descViewHolderClass = dexHelper.findMethodUsingString( + "AV%d", + false, + -1, + 0, + "V", + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.declaringClass ?: return@descCopy + val descViewHolderIndex = dexHelper.encodeClassIndex(descViewHolderClass) + val copyMethodIndex = dexHelper.findMethodUsingString( + "clipboard", + false, + -1, + -1, + null, + descViewHolderIndex, + null, + null, + null, + true + ).firstOrNull() ?: return@descCopy + val toCopyMethodIndex = dexHelper.findMethodInvoked( + copyMethodIndex, + -1, + 3, + "VLZL", + descViewHolderIndex, + null, + null, + null, + true + ).firstOrNull() ?: return@descCopy + val clickableSpanIndex = dexHelper.encodeClassIndex(ClickableSpan::class.java) + dexHelper.findMethodInvoked( + toCopyMethodIndex, + -1, + 2, + "VLL", + -1, + longArrayOf(viewIndex, clickableSpanIndex), + null, + null, + false + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it) + }.forEach { + classes += class_ { name = it.declaringClass.name } + methods += method { name = it.name } + } + } + comment3Copy = comment3Copy { + classesList.filter { + it.startsWith("com.bilibili.app.comment3.ui.holder.handle.CommentContentRichTextHandler") + }.map { it.on(classloader) }.flatMap { c -> + c.declaredMethods.filter { + (it.isPrivate && it.parameterCount == 6 && it.parameterTypes[5] == View::class.java) || + (it.isPrivate && it.parameterCount == 3 && it.parameterTypes[2] == View::class.java) + } + }.firstOrNull()?.let { + Log.d(it.declaringClass.name + it.name) + class_ = class_ { name = it.declaringClass.name } + method = method { name = it.name } + comment3ViewIndex = it.parameterCount - 1 + } + } + dexHelper.findMethodUsingString( + "BangumiAllButton", + true, -1, 0, null, -1, null, null, null, true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + }?.declaringClass?.declaringClass?.let { + bangumiSeason = class_ { name = it.name } + bangumiSeasonActivityEntrance = method { + name = it.declaredMethods.firstOrNull { + it.parameterTypes.isEmpty() && it.genericReturnType.toString() + .contains("ActivityEntrance") + }?.name ?: return@method + } + } + kanBan = kanBan { + val statusClass = + "tv.danmaku.bili.ui.kanban.KanBanUserStatus".findClassOrNull(classloader) + ?: return@kanBan + statusClass.runCatchingOrNull { + getDeclaredMethod("isUseKanBan") + }?.let { + dexHelper.findMethodInvoked( + dexHelper.encodeMethodIndex(it), + -1, + 1, + "VL", + -1, + null, + null, + null, + true + ).firstOrNull() + }?.let { + dexHelper.decodeMethodIndex(it) + }?.let { + class_ = class_ { name = it.declaringClass.name } + method = method { name = it.name } + } + } + toastHelper = toastHelper { + val showToastCallerIndex = dexHelper.findMethodUsingString( + "main.lessonmodel.enterdetail.change-pswd-success.click", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).firstOrNull() ?: return@toastHelper + val contextIndex = dexHelper.encodeClassIndex(Context::class.java) + val stringIndex = dexHelper.encodeClassIndex(String::class.java) + val showToastMethod = dexHelper.findMethodInvoking( + showToastCallerIndex, + -1, + 3, + "VLLI", + -1, + longArrayOf(contextIndex, stringIndex, -1), + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + } ?: return@toastHelper + val toastHelperClass = showToastMethod.declaringClass + class_ = class_ { name = toastHelperClass.name } + show = method { name = showToastMethod.name } + cancel = method { + name = toastHelperClass.declaredMethods.firstOrNull { + it.isStatic && it.parameterTypes.isEmpty() + }?.name ?: return@method + } + } + brotliInputStream = class_ { + name = dexHelper.findMethodUsingString( + "Brotli decoder initialization failed", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.declaringClass?.name ?: return@class_ + } + dexHelper.findMethodUsingString( + "player.player.story-button.0.player", + false, + -1, + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().mapNotNull { + val clazz = dexHelper.decodeMethodIndex(it)?.declaringClass + val method = clazz?.declaredMethods?.find { m -> + m.isStatic && m.parameterTypes.size == 1 && m.parameterTypes[0] == clazz && m.returnType == Boolean::class.javaPrimitiveType + } + if (clazz != null && method != null) { + playerFullStoryWidget { + class_ = class_ { name = clazz.name } + this.method = method { name = method.name } + } + } else null + }.let { playerFullStoryWidget.addAll(it.toList()) } + biliCall = biliCall { + val biliCallClass = "com.bilibili.okretro.call.BiliCall".from(classloader) + ?: dexHelper.findMethodUsingString( + "Any arguments of BiliCall constructor can not be null", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.declaringClass ?: return@biliCall + val setParserMethod = biliCallClass.methods.find { + it.parameterTypes.size == 1 && it.parameterTypes[0].let { c -> + c.isInterface && c.interfaces.size == 1 && c.interfaces[0].declaredMethods.size == 1 + } + } ?: return@biliCall + val requestFiled = biliCallClass.declaredFields.find { + it.type.name == this@hookInfo.okHttp.request.class_.name + } ?: return@biliCall + class_ = class_ { name = biliCallClass.name } + parser = class_ { name = setParserMethod.parameterTypes[0].name } + setParser = method { name = setParserMethod.name } + request = field { name = requestFiled.name } + } + biliConfig = biliConfig { + val biliConfigClass = "com.bilibili.api.BiliConfig".from(classloader) + ?: dexHelper.findMethodUsingString( + "Call BiliConfig.init() first!", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.declaringClass ?: return@biliConfig + class_ = class_ { + name = biliConfigClass.name + } + val biliConfigClassIdx = dexHelper.encodeClassIndex(biliConfigClass) + val loginMethodIdx = dexHelper.findMethodUsingString( + "url_find_pwd_no_sms", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstOrNull() ?: return@biliConfig + dexHelper.findMethodInvoking( + loginMethodIdx, + -1, + 0, + null, + biliConfigClassIdx, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.let { + getAppKey = method { name = it.name } + } + } + dexHelper.findMethodUsingString( + "im.chat-group.msg.repost.click", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it) as? Method + }.find { method -> + // 跨版本匹配: 方法在 ConversationActivity 中,或在捕获了 + // ConversationActivity 的 lambda 类中。用 Activity 类型做混淆无关匹配 + val dc = method.declaringClass + Activity::class.java.isAssignableFrom(dc) || + dc.declaredFields.any { + Activity::class.java.isAssignableFrom(it.type) + } + }?.let { method -> + // 跨版本获取 BaseTypedMessage: 旧版为方法参数,新版为 captured field + val btmClass = method.parameterTypes.getOrNull(1) + ?: method.declaringClass.declaredFields.firstNotNullOfOrNull { f -> + f.type.takeIf { t -> + t != String::class.java && !t.isPrimitive && + t.declaredMethods.any { m -> + m.returnType == String::class.java && m.parameterTypes.isEmpty() + } + } + } + ?: return@let + val getContentStringMethod = btmClass.declaredMethods.find { m -> + m.returnType == String::class.java && m.parameterTypes.isEmpty() + } ?: return@let + onOperateClick = method { name = method.name } + operateClickHostClass = class_ { name = method.declaringClass.name } + getContentString = method { name = getContentStringMethod.name } + } + livePagerRecyclerView = class_ { + val liveVerticalPagerView = + "com.bilibili.bililive.room.ui.roomv3.vertical.widget.LiveVerticalPagerView" + .from(classloader) ?: return@class_ + name = liveVerticalPagerView.declaredFields.find { + View::class.java.isAssignableFrom(it.type) + }?.type?.name ?: return@class_ + } + updateInfoSupplier = updateInfoSupplier { + val checkMethod = dexHelper.findMethodUsingString( + "Do sync http request.", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + } ?: return@updateInfoSupplier + class_ = class_ { name = checkMethod.declaringClass.name } + check = method { name = checkMethod.name } + } + playerPreloadHolder = playerPreloadHolder { + dexHelper.findMethodUsingString( + "preloadKey is null", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).firstOrNull()?.run { + val stringClassIndex = dexHelper.encodeClassIndex(String::class.java) + dexHelper.findMethodInvoking( + this, + stringClassIndex, + 2, + "LLL", + -1, + null, + longArrayOf(stringClassIndex), + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + } + }?.let { + class_ = class_ { name = it.declaringClass.name } + get = method { name = it.name } + return@playerPreloadHolder + } + // 粉版 7.39.0+ + val geminiPreloadClass = dexHelper.findMethodUsingString( + "PreloadData(type=", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it)?.declaringClass?.declaringClass + } ?: return@playerPreloadHolder + geminiPreloadClass.declaredMethods.firstOrNull { + it.isPublic && it.parameterTypes.count() == 1 + }?.let { + class_ = class_ { name = it.declaringClass.name } + get = method { name = it.name } + } + } + dexHelper.findMethodUsingString( + "player.unite_login_qn", + false, + -1, + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it)?.let { m -> + playerQualityService { + class_ = class_ { name = m.declaringClass.name } + getDefaultQnThumb = method { name = m.name } + } + } + }.let { playerQualityService.addAll(it.toList()) } + playerSettingHelper = playerSettingHelper { + val getDefaultQnMethod = dexHelper.findMethodUsingString( + "quality settings:", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + } ?: return@playerSettingHelper + class_ = class_ { name = getDefaultQnMethod.declaringClass.name } + getDefaultQn = method { name = getDefaultQnMethod.name } + } + val autoSupremumQualityClass = dexHelper.findMethodUsingString( + "AutoSupremumQuality(loginHalfScreen=", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + }?.declaringClass?.also { + autoSupremumQuality = autoSupremumQuality { + class_ = class_ { + name = it.name + } + } + } + qualityStrategyProvider = qualityStrategyProvider { + val buildStrategyMethod = dexHelper.findMethodUsingString( + "Quality Strategy share:", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it) + } ?: return@qualityStrategyProvider + val providerClass = buildStrategyMethod.declaringClass + val selectQualityMethod = providerClass.declaredMethods.asSequence().filter { + it.parameterCount == 3 && it.parameterTypes.contentEquals( + arrayOf( + autoSupremumQualityClass, + Boolean::class.javaPrimitiveType, + Boolean::class.javaPrimitiveType + ) + ) + }.firstNotNullOfOrNull { method -> + val methodIdx = dexHelper.encodeMethodIndex(method) + val isConnectedMethods = dexHelper.findMethodInvoking( + methodIdx, + dexHelper.encodeClassIndex(Int::class.javaPrimitiveType!!), + 1, + null, + -1, + longArrayOf(dexHelper.encodeClassIndex(Context::class.java)), + null, + null, + true + ) + if (isConnectedMethods.isEmpty()) method else null + } ?: return@qualityStrategyProvider + class_ = class_ { name = providerClass.name } + selectQuality = method { name = selectQualityMethod.name } + } + liveRtcHelper = liveRtcHelper { + val liveRtcEnable = dexHelper.findMethodUsingString( + "systemSupportLiveP2P", + true, + dexHelper.encodeClassIndex(Boolean::class.java), + 0, + null, + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + } ?: return@liveRtcHelper + liveRtcEnableClass = class_ { name = liveRtcEnable.declaringClass.name } + liveRtcEnableMethod = method { name = liveRtcEnable.name } + } + val themeColorsClass = dexHelper.findMethodUsingString( + "GarbThemeColors(garb=", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + }?.declaringClass?.also { + themeColors = class_ { name = it.name } + } + builtInThemes = builtInThemes { + val themeColorsConstIdx = themeColorsClass?.declaredConstructors?.maxByOrNull { + it.parameterTypes.size + }?.let { dexHelper.encodeMethodIndex(it) } ?: return@builtInThemes + val clazz = dexHelper.findMethodInvoked( + themeColorsConstIdx, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).firstOrNull()?.run { + dexHelper.findMethodInvoking( + this, + dexHelper.encodeClassIndex(Map::class.java), + 0, + null, + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + } + }?.declaringClass ?: return@builtInThemes + val field = clazz.declaredFields.firstOrNull { + it.type == Map::class.java + } ?: return@builtInThemes + class_ = class_ { name = clazz.name } + all = field { name = field.name } + } + biliGlobalPreference = biliGlobalPreference { + val clazz = "com.bilibili.base.BiliGlobalPreferenceHelper".from(classloader) + ?: dexHelper.findMethodUsingString( + "instance.bili_preference", + false, + -1, + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().firstNotNullOfOrNull { idx -> + dexHelper.decodeMethodIndex(idx)?.declaringClass?.takeIf { !it.superclass.isAbstract } + } ?: return@biliGlobalPreference + val method = clazz.declaredMethods.firstOrNull { + it.isStatic && it.parameterTypes.isEmpty() && it.returnType == SharedPreferences::class.java + } ?: return@biliGlobalPreference + class_ = class_ { name = clazz.name } + get = method { name = method.name } + } + cardClickProcessor = cardClickProcessor { + val method = dexHelper.findMethodUsingString( + "action:feed:dislike_reason", + false, + -1, + 5, + null, + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it) + } ?: return@cardClickProcessor + class_ = class_ { name = method.declaringClass.name } + onFeedClicked = method { name = method.name } + } + dexHelper.findMethodUsingString( + "PublishToFollowingConfig(visible=", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).firstOrNull()?.let { + dexHelper.decodeMethodIndex(it)?.declaringClass + }?.let { + publishToFollowingConfig = class_ { name = it.name } + } + + continuation = continuation { + val continuationImpl = dexHelper.findMethodUsingString( + "create(Continuation) has not been overridden", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it)?.declaringClass + } ?: return@continuation + val continuation = continuationImpl.interfaces.firstOrNull() ?: return@continuation + class_ = class_ { name = continuation.name } + } + vipQualityTrialService = vipQualityTrialService { + val serviceClass = dexHelper.findMethodUsingString( + "go to buy vip: ", + false, + -1, + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it)?.declaringClass + }.firstOrNull { + it.name.startsWith("com.bilibili") + } ?: return@vipQualityTrialService + val canTrialMethod = serviceClass.declaredMethods.asSequence().filter { + it.returnType == Boolean::class.javaPrimitiveType && it.parameterCount == 0 + }.firstNotNullOfOrNull { candidate -> + val getTrialInfoMethods = dexHelper.findMethodInvoking( + dexHelper.encodeMethodIndex(candidate), + -1, + 0, + null, + dexHelper.encodeClassIndex(serviceClass), + null, + null, + null, + true + ) + if (getTrialInfoMethods.isNotEmpty()) candidate else null + } ?: return@vipQualityTrialService + class_ = class_ { name = serviceClass.name } + canTrial = method { name = canTrialMethod.name } + } + liveQuality = liveQuality { + val utilClass = dexHelper.findMethodUsingString( + "select 秒开 play url --codec:", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).map { + dexHelper.decodeMethodIndex(it)?.declaringClass + }.firstOrNull() ?: return@liveQuality + val selectorDataClass = dexHelper.findMethodUsingString( + "LiveUrlSelectorData(playUrl=", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).map { + dexHelper.decodeMethodIndex(it)?.declaringClass + }.firstOrNull() ?: return@liveQuality + val buildSelectorDataMethod = utilClass.declaredMethods.firstOrNull { + it.returnType == selectorDataClass && it.parameterCount == 1 && it.parameterTypes[0] == Uri::class.java + } ?: return@liveQuality + val switchAutoMethod = dexHelper.findMethodUsingString( + "switchAuto ", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).map { + dexHelper.decodeMethodIndex(it) + }.firstOrNull() ?: return@liveQuality + val interceptorClass = dexHelper.findMethodUsingString( + "inject common param to body failure : ", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).map { + dexHelper.decodeMethodIndex(it)?.declaringClass + }.firstOrNull() ?: return@liveQuality + val interceptMethod = interceptorClass.declaredMethods.firstOrNull { + it.isPublic && it.parameterCount == 1 && it.returnType == it.parameterTypes[0] + } ?: return@liveQuality + selectUtil = livePlayUrlSelectUtil { + class_ = class_ { name = utilClass.name } + buildSelectorData = method { name = buildSelectorDataMethod.name } + } + sourceService = liveRTCSourceServiceImpl { + class_ = class_ { name = switchAutoMethod.declaringClass.name } + switchAuto = method { name = switchAutoMethod.name } + } + interceptor = defaultRequestIntercept { + class_ = class_ { name = interceptorClass.name } + intercept = method { name = interceptMethod.name } + } + } + preBuiltConfig = preBuiltConfig { + val getMap = dexHelper.findMethodUsingString( + "/config.json", + false, + -1, + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().mapNotNull { dexHelper.decodeMethodIndex(it) } + .firstOrNull { it.declaringClass.name.contains("blconfig") } + ?: return@preBuiltConfig + class_ = class_ { name = getMap.declaringClass.name } + get = method { name = getMap.name } + } + dataSP = dataSP { + val spxClass = + ("com.bilibili.lib.blkv.SharedPrefX" from classloader) ?: return@dataSP + val blkvClass = ("com.bilibili.lib.blkv.BLKV" from classloader) ?: return@dataSP + val getBLSP = runCatchingOrNull { + blkvClass.getDeclaredMethod( + "getBLSharedPreferences", + Context::class.java, + File::class.java, + Boolean::class.javaPrimitiveType, + Int::class.javaPrimitiveType + ) + } ?: return@dataSP + val getDataSP = dexHelper.findMethodInvoked( + dexHelper.encodeMethodIndex(getBLSP), + dexHelper.encodeClassIndex(spxClass), + -1, + null, + -1, + null, + null, + null, + false + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it) + }.firstOrNull { + Log.d(it) + it.declaringClass.name.startsWith("com.bilibili.lib.blconfig.internal.TypedContext") + } ?: return@dataSP + class_ = class_ { name = getDataSP.declaringClass.name } + get = method { name = getDataSP.name } + } + pegasusParser = class_ { + val getPegasusParser = dexHelper.findMethodUsingString( + "[Pegasus]PegasusParser", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().mapNotNull { dexHelper.decodeMethodIndex(it) }.firstOrNull() + ?: return@class_ + name = getPegasusParser.declaringClass.name + } + resolveClientCompanion = resolveClientCompanion { + val resolveClientClass = dexHelper.findMethodUsingString( + "Invalid segment id: %s, segment list size:%s", + false, + -1, + -1, + null, + -1, + null, + null, + null, + true + ).asSequence().firstNotNullOfOrNull { + dexHelper.decodeMethodIndex(it)?.declaringClass + } ?: return@resolveClientCompanion + val resolveClientCompanionClass = "${resolveClientClass.name}\$a".from(classloader) + ?: return@resolveClientCompanion + val paramsClass = + "com.bilibili.app.gemini.base.player.GeminiCommonResolverParams".from( + classloader + ) + val videoDownloadEntryClass = + "com.bilibili.videodownloader.model.VideoDownloadEntry".from(classloader) + val buildParamsMethod = resolveClientCompanionClass.declaredMethods.firstOrNull { + it.returnType == paramsClass && it.parameterCount == 1 && it.parameterTypes[0] == videoDownloadEntryClass + } ?: return@resolveClientCompanion + class_ = class_ { name = resolveClientCompanionClass.name } + buildCommonResolverParams = method { name = buildParamsMethod.name } + } + gCommonResolverParams = gCommonResolverParams { + val commonResolverParamsClass = + "com.bilibili.app.gemini.base.player.GeminiCommonResolverParams".from( + classloader + ) ?: return@gCommonResolverParams + val setExtraContentMethod = commonResolverParamsClass.declaredMethods?.firstOrNull { + it.returnType == Void.TYPE && it.parameterCount == 1 && it.parameterTypes[0] == Map::class.java + } ?: return@gCommonResolverParams + class_ = class_ { name = commonResolverParamsClass.name } + setExtraContent = method { name = setExtraContentMethod.name } + } + rewardAd = rewardAd { + val rewardAdActivityClass = + "com.bilibili.ad.reward.RewardAdActivity".from(classloader) ?: return@rewardAd + + class_ = class_ { name = rewardAdActivityClass.name } + val rewardFlagField = + rewardAdActivityClass.declaredFields.filter { it.type == Boolean::class.javaPrimitiveType } + .getOrNull(1) ?: return@rewardAd + + rewardFlag = field { name = rewardFlagField.name } + + } + storyPagerPlayer = storyPagerPlayer { + val storyPagerPlayerClass = + "com.bilibili.video.story.player.StoryPagerPlayer".from(classloader) ?: return@storyPagerPlayer + + class_ = class_ { name = storyPagerPlayerClass.name } + + val addVideoMethod = dexHelper.findMethodUsingString( + " add ", + false, + -1, + -1, + null, + dexHelper.encodeClassIndex(storyPagerPlayerClass), + null, + longArrayOf(dexHelper.encodeClassIndex(List::class.java)), + null, + true + ).asSequence().mapNotNull { + dexHelper.decodeMethodIndex(it) + }.firstOrNull() ?: return@storyPagerPlayer + + addVideo = method { name = addVideoMethod.name } + } + + dexHelper.close() + } + + @Volatile + lateinit var instance: BiliBiliPackage + } +} diff --git a/app/src/main/java/me/iacn/biliroaming/ColorChooseDialog.kt b/app/src/main/java/me/iacn/biliroaming/ColorChooseDialog.kt new file mode 100644 index 0000000..78ef206 --- /dev/null +++ b/app/src/main/java/me/iacn/biliroaming/ColorChooseDialog.kt @@ -0,0 +1,92 @@ +package me.iacn.biliroaming + +import android.app.AlertDialog +import android.content.Context +import android.graphics.Color +import android.text.Editable +import android.text.TextWatcher +import android.view.View +import android.widget.EditText +import android.widget.SeekBar +import android.widget.SeekBar.OnSeekBarChangeListener +import android.widget.TextView +import me.iacn.biliroaming.utils.inflateLayout + +/** + * Created by iAcn on 2019/7/14 + * Email i@iacn.me + */ +class ColorChooseDialog(context: Context, defColor: Int) : AlertDialog.Builder(context) { + private val view = context.inflateLayout(R.layout.dialog_color_choose) + private val sampleView: View = view.findViewById(R.id.view_sample) + private val etColor: EditText = view.findViewById(R.id.et_color) + private val sbColorR: SeekBar = view.findViewById(R.id.sb_colorR) + private val sbColorG: SeekBar = view.findViewById(R.id.sb_colorG) + private val sbColorB: SeekBar = view.findViewById(R.id.sb_colorB) + private val tvColorR: TextView = view.findViewById(R.id.tv_colorR) + private val tvColorG: TextView = view.findViewById(R.id.tv_colorG) + private val tvColorB: TextView = view.findViewById(R.id.tv_colorB) + val color: Int + get() = Color.rgb(sbColorR.progress, sbColorG.progress, sbColorB.progress) + + private fun setEditTextListener() { + etColor.addTextChangedListener(object : TextWatcher { + override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {} + override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { + updateValue(handleUnknownColor(s.toString())) + } + + override fun afterTextChanged(s: Editable) {} + }) + } + + private fun setSeekBarListener() { + val listener: OnSeekBarChangeListener = object : OnSeekBarChangeListener { + override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { + if (fromUser) { + val color = Color.rgb(sbColorR.progress, sbColorG.progress, sbColorB.progress) + etColor.setText(String.format("%06X", 0xFFFFFF and color)) + } + tvColorR.text = sbColorR.progress.toString() + tvColorG.text = sbColorG.progress.toString() + tvColorB.text = sbColorB.progress.toString() + } + + override fun onStartTrackingTouch(seekBar: SeekBar) {} + override fun onStopTrackingTouch(seekBar: SeekBar) {} + } + sbColorR.setOnSeekBarChangeListener(listener) + sbColorG.setOnSeekBarChangeListener(listener) + sbColorB.setOnSeekBarChangeListener(listener) + } + + private fun updateValue(color: Int) { + sampleView.setBackgroundColor(color) + val progressR = Color.red(color) + val progressG = Color.green(color) + val progressB = Color.blue(color) + sbColorR.progress = progressR + sbColorG.progress = progressG + sbColorB.progress = progressB + tvColorR.text = progressR.toString() + tvColorG.text = progressG.toString() + tvColorB.text = progressB.toString() + } + + private fun handleUnknownColor(color: String) = + try { + Color.parseColor("#$color") + } catch (e: IllegalArgumentException) { + Color.BLACK + } + + init { + setView(view) + setEditTextListener() + setSeekBarListener() + updateValue(defColor) + etColor.setText(String.format("%06X", 0xFFFFFF and defColor)) + setTitle("自选颜色") + setNegativeButton("取消", null) + } +} diff --git a/app/src/main/java/me/iacn/biliroaming/CommentFilterDialog.kt b/app/src/main/java/me/iacn/biliroaming/CommentFilterDialog.kt new file mode 100644 index 0000000..89a77bb --- /dev/null +++ b/app/src/main/java/me/iacn/biliroaming/CommentFilterDialog.kt @@ -0,0 +1,111 @@ +package me.iacn.biliroaming + +import android.app.Activity +import android.content.SharedPreferences +import android.view.inputmethod.EditorInfo +import android.widget.* +import me.iacn.biliroaming.utils.Log +import me.iacn.biliroaming.utils.dp +import me.iacn.biliroaming.utils.inflateLayout + +class CommentFilterDialog(activity: Activity, prefs: SharedPreferences) : + BaseWidgetDialog(activity) { + init { + val scrollView = ScrollView(context).apply { + scrollBarStyle = ScrollView.SCROLLBARS_OUTSIDE_OVERLAY + } + val root = LinearLayout(context).apply { + orientation = LinearLayout.VERTICAL + layoutParams = FrameLayout.LayoutParams( + FrameLayout.LayoutParams.MATCH_PARENT, + FrameLayout.LayoutParams.WRAP_CONTENT + ) + } + scrollView.addView(root) + + val (contentGroup, contentRegexSwitch) = root.addKeywordGroup( + string(R.string.keyword_group_name_content), 40.dp, true + ) + contentRegexSwitch.isChecked = prefs.getBoolean("comment_filter_content_regex_mode", false) + val upNameGroup = root.addKeywordGroup(string(R.string.keyword_group_name_at_up), 40.dp).first + val uidGroup = root.addKeywordGroup( + string(R.string.keyword_group_name_at_uid), + 40.dp, + inputType = EditorInfo.TYPE_CLASS_NUMBER + ).first + prefs.getStringSet("comment_filter_keyword_content", null)?.forEach { + contentGroup.addView(keywordInputItem(contentGroup, it).first) + } + prefs.getStringSet("comment_filter_keyword_at_upname", null)?.forEach { + upNameGroup.addView(keywordInputItem(upNameGroup, it).first) + } + prefs.getStringSet("comment_filter_keyword_at_uid", null)?.forEach { + uidGroup.addView(keywordInputItem(uidGroup, it, EditorInfo.TYPE_CLASS_NUMBER).first) + } + + val blockAtCommentSwitch = switchPrefsItem( + string(R.string.comment_filter_block_at_comment_title) + ).let { root.addView(it.first); it.second } + blockAtCommentSwitch.isChecked = prefs.getBoolean("comment_filter_block_at_comment", false) + + val targetCommentAuthorLevelTitle = + categoryTitle(string(R.string.target_comment_author_level_title)) + root.addView(targetCommentAuthorLevelTitle) + + val seekBarView = context.inflateLayout(R.layout.seekbar_dialog) + val currentTargetCommentAuthorLevel = + prefs.getLong("target_comment_author_level", 0L).toInt() + val tvHint = seekBarView.findViewById(R.id.tvHint).apply { + text = if (currentTargetCommentAuthorLevel == 0) "关闭" else XposedInit.moduleRes.getString( + R.string.danmaku_filter_weight_hint, + currentTargetCommentAuthorLevel + ) + } + val seekBar = seekBarView.findViewById(R.id.seekBar).apply { + max = 6 + setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { + override fun onProgressChanged( + seekBar: SeekBar?, progress: Int, fromUser: Boolean + ) { + tvHint.text = + if (progress == 0) "关闭" else XposedInit.moduleRes.getString( + R.string.danmaku_filter_weight_hint, + progress + ) + } + + override fun onStartTrackingTouch(seekBar: SeekBar?) {} + override fun onStopTrackingTouch(seekBar: SeekBar?) {} + }) + progress = currentTargetCommentAuthorLevel + } + root.addView(seekBarView) + + setTitle(string(R.string.filter_comment_title)) + + setPositiveButton(android.R.string.ok) { _, _ -> + + val contents = contentGroup.getKeywords() + val contentRegexMode = contentRegexSwitch.isChecked + if (contentRegexMode && contents.runCatching { forEach { it.toRegex() } }.isFailure) { + Log.toast(string(R.string.invalid_regex), force = true) + return@setPositiveButton + } + + prefs.edit().apply { + putStringSet("comment_filter_keyword_content", contents) + putStringSet("comment_filter_keyword_at_upname", upNameGroup.getKeywords()) + putStringSet("comment_filter_keyword_at_uid", uidGroup.getKeywords()) + putBoolean("comment_filter_content_regex_mode", contentRegexMode) + putBoolean("comment_filter_block_at_comment", blockAtCommentSwitch.isChecked) + putLong("target_comment_author_level", seekBar.progress.toLong()) + }.apply() + Log.toast(string(R.string.prefs_save_success_and_reboot)) + } + setNegativeButton(android.R.string.cancel, null) + + root.setPadding(16.dp, 10.dp, 16.dp, 10.dp) + + setView(scrollView) + } +} diff --git a/app/src/main/java/me/iacn/biliroaming/Constant.kt b/app/src/main/java/me/iacn/biliroaming/Constant.kt new file mode 100644 index 0000000..c13a5ec --- /dev/null +++ b/app/src/main/java/me/iacn/biliroaming/Constant.kt @@ -0,0 +1,27 @@ +package me.iacn.biliroaming + +/** + * Created by iAcn on 2019/4/12 + * Email i@iacn.me + */ +object Constant { + const val PINK_PACKAGE_NAME = "tv.danmaku.bili" + const val BLUE_PACKAGE_NAME = "com.bilibili.app.blue" + const val PLAY_PACKAGE_NAME = "com.bilibili.app.in" + const val HD_PACKAGE_NAME = "tv.danmaku.bilibilihd" + val BILIBILI_PACKAGE_NAME = hashMapOf( + "原版" to PINK_PACKAGE_NAME, + "概念版" to BLUE_PACKAGE_NAME, + "play版" to PLAY_PACKAGE_NAME, + "HD版" to HD_PACKAGE_NAME + ) + const val TAG = "BiliRoaming" + const val HOOK_INFO_FILE_NAME = "hookinfo.pb" + const val TYPE_SEASON_ID = 0 + const val TYPE_MEDIA_ID = 1 + const val TYPE_EPISODE_ID = 2 + const val CUSTOM_COLOR_KEY = "biliroaming_custom_color" + const val CURRENT_COLOR_KEY = "theme_entries_current_key" + const val DEFAULT_CUSTOM_COLOR = -0xe6b7d + const val zoneUrl = "https://api.bilibili.com/x/web-interface/zone" +} diff --git a/app/src/main/java/me/iacn/biliroaming/CustomSubtitleDialog.kt b/app/src/main/java/me/iacn/biliroaming/CustomSubtitleDialog.kt new file mode 100644 index 0000000..060e192 --- /dev/null +++ b/app/src/main/java/me/iacn/biliroaming/CustomSubtitleDialog.kt @@ -0,0 +1,192 @@ +@file:Suppress("DEPRECATION") + +package me.iacn.biliroaming + +import android.app.Activity +import android.app.AlertDialog +import android.app.Fragment +import android.content.ActivityNotFoundException +import android.content.Intent +import android.content.SharedPreferences +import android.graphics.Color +import android.text.SpannableString +import android.text.Spanned +import android.view.View +import android.widget.* +import me.iacn.biliroaming.BiliBiliPackage.Companion.instance +import me.iacn.biliroaming.hook.SubtitleHook +import me.iacn.biliroaming.utils.Log +import me.iacn.biliroaming.utils.inflateLayout + +class CustomSubtitleDialog(activity: Activity, fragment: Fragment, prefs: SharedPreferences) : + AlertDialog.Builder(activity) { + private var fontStatus: TextView? = null + + init { + val oldClient = instance.cronCanvasClass == null + val view = context.inflateLayout(R.layout.custom_subtitle_dialog) + val noBgSwitch = view.findViewById(R.id.noBg).apply { + isSoundEffectsEnabled = false + isHapticFeedbackEnabled = false + isChecked = prefs.getBoolean(tag.toString(), true) + } + val llNoBg = view.findViewById(R.id.ll_noBg) + llNoBg.setOnClickListener { noBgSwitch.toggle() } + val boldSwitch = view.findViewById(R.id.bold).apply { + isSoundEffectsEnabled = false + isHapticFeedbackEnabled = false + isChecked = prefs.getBoolean(tag.toString(), true) + } + val llBold = view.findViewById(R.id.ll_bold) + llBold.setOnClickListener { boldSwitch.toggle() } + fontStatus = view.findViewById(R.id.tv_fontStatus) + refreshFontStatus() + val fontColor = view.findViewById(R.id.font_color) + fontColor.setText(prefs.getString(fontColor.tag.toString(), "FFFFFFFF")) + val backgroundColor = view.findViewById(R.id.background_color) + backgroundColor.setText(prefs.getString(backgroundColor.tag.toString(), "20000000")) + val fontSize = view.findViewById(R.id.font_size) + fontSize.setText(prefs.getInt(fontSize.tag.toString(), 30).toString()) + val fontSizePortrait = view.findViewById(R.id.fontSizePortrait) + fontSizePortrait.setText(prefs.getInt(fontSizePortrait.tag.toString(), 0).toString()) + val fontSizeLandscape = view.findViewById(R.id.fontSizeLandscape) + fontSizeLandscape.setText(prefs.getInt(fontSizeLandscape.tag.toString(), 0).toString()) + val fontBlurSolid = view.findViewById(R.id.font_blur_solid) + fontBlurSolid.setText(prefs.getInt(fontBlurSolid.tag.toString(), 1).toString()) + val strokeColor = view.findViewById(R.id.stroke_color) + strokeColor.setText(prefs.getString(strokeColor.tag.toString(), "FF000000")) + val strokeWidth = view.findViewById(R.id.stroke_width) + strokeWidth.setText(prefs.getFloat(strokeWidth.tag.toString(), 5.0F).toString()) + val fixBreak = view.findViewById(R.id.cb_fixBreak) + fixBreak.isChecked = prefs.getBoolean(fixBreak.tag.toString(), false) + val offset = view.findViewById(R.id.subOffset) + offset.setText(prefs.getInt(offset.tag.toString(), 0).toString()) + view.findViewById