From 7d074742b2f9d5983451da5fe9f4826646180417 Mon Sep 17 00:00:00 2001 From: "Hydrogen.P" <77036672+CodePwn2021@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:32:07 +0800 Subject: [PATCH 1/6] feat: KillDelayBootHook (#1553) Kill ff_boot_exp_delay_xxx from cloud control in com.bilibili.gripper.exp.a$a --- .../main/java/me/iacn/biliroaming/BiliBiliPackage.kt | 1 + app/src/main/java/me/iacn/biliroaming/XposedInit.kt | 1 + .../me/iacn/biliroaming/hook/KillDelayBootHook.kt | 12 ++++++++++++ 3 files changed, 14 insertions(+) create mode 100644 app/src/main/java/me/iacn/biliroaming/hook/KillDelayBootHook.kt diff --git a/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt b/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt index 07967bf98c..8e3efc2078 100644 --- a/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt +++ b/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt @@ -71,6 +71,7 @@ class BiliBiliPackage constructor(private val mClassLoader: ClassLoader, mContex ?: "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 } diff --git a/app/src/main/java/me/iacn/biliroaming/XposedInit.kt b/app/src/main/java/me/iacn/biliroaming/XposedInit.kt index f358c6c8bd..ff9b8c2240 100644 --- a/app/src/main/java/me/iacn/biliroaming/XposedInit.kt +++ b/app/src/main/java/me/iacn/biliroaming/XposedInit.kt @@ -80,6 +80,7 @@ class XposedInit : IXposedHookLoadPackage, IXposedHookZygoteInit { if (BuildConfig.DEBUG) { startHook(SSLHook(lpparam.classLoader)) } + startHook(KillDelayBootHook(lpparam.classLoader)) startHook(HintHook(lpparam.classLoader)) startHook(BangumiSeasonHook(lpparam.classLoader)) startHook(BangumiPlayUrlHook(lpparam.classLoader)) diff --git a/app/src/main/java/me/iacn/biliroaming/hook/KillDelayBootHook.kt b/app/src/main/java/me/iacn/biliroaming/hook/KillDelayBootHook.kt new file mode 100644 index 0000000000..a85c510c77 --- /dev/null +++ b/app/src/main/java/me/iacn/biliroaming/hook/KillDelayBootHook.kt @@ -0,0 +1,12 @@ +package me.iacn.biliroaming.hook + +import me.iacn.biliroaming.BiliBiliPackage.Companion.instance +import me.iacn.biliroaming.utils.hookAfterMethod + +class KillDelayBootHook(classLoader: ClassLoader) : BaseHook(classLoader) { + override fun startHook() { + instance.gripperBootExpClass?.hookAfterMethod("getDelayMillis") { param -> + param.result = -1L + } + } +} \ No newline at end of file From 845ceffa20b4922c485442612321e03283d51a99 Mon Sep 17 00:00:00 2001 From: "Hydrogen.P" <77036672+CodePwn2021@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:40:44 +0800 Subject: [PATCH 2/6] fix: crash when searching sensitive words (#1551) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在搜索一些敏感词时(比如“药娘”),会因为无法为navList插入元素导致崩溃 --- .../main/java/me/iacn/biliroaming/hook/BangumiSeasonHook.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/me/iacn/biliroaming/hook/BangumiSeasonHook.kt b/app/src/main/java/me/iacn/biliroaming/hook/BangumiSeasonHook.kt index b70de56877..0c8b9768ae 100644 --- a/app/src/main/java/me/iacn/biliroaming/hook/BangumiSeasonHook.kt +++ b/app/src/main/java/me/iacn/biliroaming/hook/BangumiSeasonHook.kt @@ -456,6 +456,10 @@ class BangumiSeasonHook(classLoader: ClassLoader) : BaseHook(classLoader) { val navList = v.callMethodAs>("getNavList") .map { SearchNav.parseFrom(it.callMethodAs("toByteArray")) } .toMutableList() + // fix crash when searching sensitive words + if (navList.size == 0) { + return + } val currentArea = runCatchingOrNull { XposedInit.country.get(5L, TimeUnit.SECONDS) } From 88bb21c543c74eb367155b73a12efff8bc2d6f1a Mon Sep 17 00:00:00 2001 From: Aiden2014 <54656326+Aiden2014@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:53:09 +0800 Subject: [PATCH 3/6] fix: comment copy on play v3.19.1+ and v7.77.0+ (#1537) fix #1460 --- .../me/iacn/biliroaming/BiliBiliPackage.kt | 46 +++++-------------- .../java/me/iacn/biliroaming/hook/CopyHook.kt | 15 +++--- .../proto/me/iacn/biliroaming/configs.proto | 1 + 3 files changed, 21 insertions(+), 41 deletions(-) diff --git a/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt b/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt index 8e3efc2078..41b669b824 100644 --- a/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt +++ b/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt @@ -247,6 +247,8 @@ class BiliBiliPackage constructor(private val mClassLoader: ClassLoader, mContex fun comment3Copy() = mHookInfo.comment3Copy.method.orNull + fun comment3ViewIndex() = mHookInfo.comment3Copy.comment3ViewIndex + fun responseDataField() = runCatchingOrNull { rxGeneralResponseClass?.getDeclaredField("data")?.name } ?: "_data" @@ -1309,7 +1311,7 @@ class BiliBiliPackage constructor(private val mClassLoader: ClassLoader, mContex setExpandLinesIndex, -1, 1, - "VL", + null, -1, null, null, @@ -1458,42 +1460,18 @@ class BiliBiliPackage constructor(private val mClassLoader: ClassLoader, mContex } } comment3Copy = comment3Copy { - val clipBoardCopyMethod = - "com.bilibili.droid.ClipboardHelper".from(classloader) - ?.getDeclaredMethod("copy", Context::class.java, String::class.java)?.let { - dexHelper.encodeMethodIndex(it) - } ?: return@comment3Copy - val commentExtensionsKtClass = - "com.bilibili.app.comment3.utils.CommentExtensionsKt".from(classloader)?.let { - dexHelper.encodeClassIndex(it) - } ?: return@comment3Copy - dexHelper.findMethodInvoked( - clipBoardCopyMethod, - -1, - 2, - "ZLL", - commentExtensionsKtClass, - null, - null, - null, - true - ).firstOrNull()?.let { - dexHelper.findMethodInvoked( - it, - -1, - 3, - "ZLLL", - -1, - null, - null, - null, - true - ).firstOrNull()?.let { - dexHelper.decodeMethodIndex(it) + 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) } - }?.let { + }.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( diff --git a/app/src/main/java/me/iacn/biliroaming/hook/CopyHook.kt b/app/src/main/java/me/iacn/biliroaming/hook/CopyHook.kt index ea224dc438..7ca1808aa6 100644 --- a/app/src/main/java/me/iacn/biliroaming/hook/CopyHook.kt +++ b/app/src/main/java/me/iacn/biliroaming/hook/CopyHook.kt @@ -88,14 +88,15 @@ class CopyHook(classLoader: ClassLoader) : BaseHook(classLoader) { instance.comment3CopyClass?.let { c -> instance.comment3Copy()?.let { m -> - c.replaceAllMethods(m) { param -> - if (!enhanceLongClickCopy) return@replaceAllMethods true - - val view = param.args[2] as View - view.getFirstFieldByExactTypeOrNull()?.also { text -> - showCopyDialog(view.context, text, param) + instance.comment3ViewIndex().let { i -> + c.replaceAllMethods(m) { param -> + if (!enhanceLongClickCopy) return@replaceAllMethods true + val view = param.args[i] as View + view.getFirstFieldByExactTypeOrNull()?.also { text -> + showCopyDialog(view.context, text, param) + } + return@replaceAllMethods true } - return@replaceAllMethods true } } } diff --git a/app/src/main/proto/me/iacn/biliroaming/configs.proto b/app/src/main/proto/me/iacn/biliroaming/configs.proto index 715d9754cb..4eb116f734 100644 --- a/app/src/main/proto/me/iacn/biliroaming/configs.proto +++ b/app/src/main/proto/me/iacn/biliroaming/configs.proto @@ -251,6 +251,7 @@ message CardClickProcessor { message Comment3Copy { optional Class class = 1; optional Method method = 2; + optional int32 comment3ViewIndex = 3; } message HookInfo { From e2bc2c3b99516358f3fc118a35be7694d51ce725 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 02:18:55 +0000 Subject: [PATCH 4/6] build(deps): bump the maven-dependencies group across 1 directory with 8 updates (#1554) --- gradle/libs.versions.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c2094ffd79..89e21bffeb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,11 +1,11 @@ [versions] -protobuf = "4.27.2" -coroutine = "1.8.1" -kotlin = "2.0.0" +protobuf = "4.28.3" +coroutine = "1.9.0" +kotlin = "2.0.21" [plugins] kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } -agp-app = { id = "com.android.application", version = "8.5.1" } +agp-app = { id = "com.android.application", version = "8.7.2" } protobuf = { id = "com.google.protobuf", version = "0.9.4" } lsplugin-jgit = { id = "org.lsposed.lsplugin.jgit", version = "1.1" } lsplugin-resopt = { id = "org.lsposed.lsplugin.resopt", version = "1.6" } From d7f0d822cc92a60733fd7897e70c774d48e6d44b Mon Sep 17 00:00:00 2001 From: "Hydrogen.P" <77036672+CodePwn2021@users.noreply.github.com> Date: Tue, 12 Nov 2024 15:53:48 +0800 Subject: [PATCH 5/6] fix: initHookInfo find biliAccounts class failed on 8.18.0+ (#1555) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 应该解决了 8.18.0+ 启动速度缓慢的问题 --- app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt b/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt index 41b669b824..f4f376e8a6 100644 --- a/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt +++ b/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt @@ -580,10 +580,10 @@ class BiliBiliPackage constructor(private val mClassLoader: ClassLoader, mContex } biliAccounts = biliAccounts { val biliAccountsClass = dexHelper.findMethodUsingString( - "refresh token error", + "logout with account exception", false, -1, - 0, + 1, null, -1, null, From 8c7fd1a97eb60131c8bd7d59e33c67fb623a5079 Mon Sep 17 00:00:00 2001 From: "Hydrogen.P" <77036672+CodePwn2021@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:34:36 +0800 Subject: [PATCH 6/6] fix: home tab filter adds rules for bangumi_v2 and cinema_v2 (#1557) Close #1556 --- app/src/main/java/me/iacn/biliroaming/hook/JsonHook.kt | 7 +++++++ app/src/main/res/values-zh-rTW/arrays.xml | 2 +- app/src/main/res/values/arrays.xml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/me/iacn/biliroaming/hook/JsonHook.kt b/app/src/main/java/me/iacn/biliroaming/hook/JsonHook.kt index 14efa320eb..3f41d2ebb6 100644 --- a/app/src/main/java/me/iacn/biliroaming/hook/JsonHook.kt +++ b/app/src/main/java/me/iacn/biliroaming/hook/JsonHook.kt @@ -471,9 +471,14 @@ class JsonHook(classLoader: ClassLoader) : BaseHook(classLoader) { var hasKoreaTW = false tab.forEach { when (it.getObjectFieldAs("uri")) { + "bilibili://pgc/bangumi_v2", "bilibili://pgc/home" -> hasBangumiCN = true + "bilibili://following/home_activity_tab/6544" -> hasBangumiTW = true + + "bilibili://pgc/cinema_v2", "bilibili://pgc/home?home_flow_type=2" -> hasMovieCN = true + "bilibili://following/home_activity_tab/168644" -> hasMovieTW = true "bilibili://following/home_activity_tab/163541" -> hasKoreaHK = true "bilibili://following/home_activity_tab/95636" -> hasKoreaTW = true @@ -556,10 +561,12 @@ class JsonHook(classLoader: ClassLoader) : BaseHook(classLoader) { "bilibili://pegasus/hottopic" -> purifytabset.contains("hottopic") + "bilibili://pgc/bangumi_v2", "bilibili://pgc/home", "bilibili://following/home_activity_tab/6544" -> purifytabset.contains("bangumi") + "bilibili://pgc/cinema_v2", "bilibili://pgc/home?home_flow_type=2", "bilibili://following/home_activity_tab/168644" -> purifytabset.contains("movie") diff --git a/app/src/main/res/values-zh-rTW/arrays.xml b/app/src/main/res/values-zh-rTW/arrays.xml index 8d8f5d3f55..c1b86cb7b5 100644 --- a/app/src/main/res/values-zh-rTW/arrays.xml +++ b/app/src/main/res/values-zh-rTW/arrays.xml @@ -28,7 +28,7 @@ 直播 推薦 熱門 - 番劇 + 番劇(動畫) 影視 韓綜 其它 diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index de004941db..63dc6c4a02 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -50,7 +50,7 @@ 直播 推荐 热门 - 番剧 + 番剧(动画) 影视 韩综 其它