Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
feat: disable webview enter forum page for 12.56.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mkx173 committed Mar 4, 2024
1 parent 029b0e3 commit 8dd6a96
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
targetSdk sdk
versionCode gitCommitCount
versionName '2.9.6'
buildConfigField "String", "TARGET_VERSION", "\"12.56.1.1\""
buildConfigField "String", "TARGET_VERSION", "\"12.56.4.0\""

testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
externalNativeBuild {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ private MethodDataList findMethod(DexKitBridge bridge, FindMethod baseMethodQuer
MethodMatcher.create().name(methodNameMatcher.getName())
)
);
} else if (matcher instanceof final ReturnTypeMatcher<?> returnTypeMatcher) {
ret = bridge.findMethod(
baseMethodQuery.matcher(
MethodMatcher.create().returnType(returnTypeMatcher.getReturnType())
)
);
}
return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import gm.tieba.tabswitch.hooker.deobfuscation.MethodNameMatcher;
import gm.tieba.tabswitch.hooker.deobfuscation.Matcher;
import gm.tieba.tabswitch.hooker.deobfuscation.ResIdentifierMatcher;
import gm.tieba.tabswitch.hooker.deobfuscation.ReturnTypeMatcher;
import gm.tieba.tabswitch.util.ClassMatcherUtils;
import gm.tieba.tabswitch.util.ReflectUtils;

Expand All @@ -36,7 +37,11 @@ public String key() {
public List<? extends Matcher> matchers() {
return List.of(
new ResIdentifierMatcher("tbds400", "dimen", MatcherProperties.create().useClassMatcher(ClassMatcherUtils.usingString("enter_forum_login_tip"))),
new MethodNameMatcher("onSuccess", MatcherProperties.create().useClassMatcher(ClassMatcherUtils.usingString("enter_forum_login_tip")))
new MethodNameMatcher("onSuccess", MatcherProperties.create().useClassMatcher(ClassMatcherUtils.usingString("enter_forum_login_tip"))),
new ReturnTypeMatcher<>(
boolean.class,
MatcherProperties.create().useClassMatcher(ClassMatcherUtils.className("com.baidu.tieba.enterForum.helper.HybridEnterForumHelper")).requireVersion("12.56.4.0")
)
);
}

Expand Down Expand Up @@ -100,6 +105,9 @@ protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
}
});
break;
case "12.56.4.0@HybridEnterForumHelper/boolean": // 禁用Webview进吧页
XposedHelpers.findAndHookMethod(clazz, sClassLoader, method, XC_MethodReplacement.returnConstant(false));
break;
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ public static ClassMatcherUtils usingString(String str) {
return new ClassMatcherUtils(classMatcher, str);
}

public static ClassMatcherUtils className(String className) {
ClassMatcher classMatcher = ClassMatcher.create().className(className);
String simpleClassName = className.substring(className.lastIndexOf('.') + 1);
return new ClassMatcherUtils(classMatcher, simpleClassName);
}

public ClassMatcher getMatcher() {
return this.matcher;
}
Expand Down

0 comments on commit 8dd6a96

Please sign in to comment.