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

Commit

Permalink
aichat_bot_comment_card
Browse files Browse the repository at this point in the history
  • Loading branch information
GuhDoy committed Feb 11, 2024
1 parent db567ef commit ad15f9d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/src/main/java/gm/tieba/tabswitch/hooker/eliminate/Purge.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public List<? extends Matcher> matchers() {
new SmaliMatcher("Lcom/baidu/tbadk/coreExtra/floatCardView/AlaLiveTipView;-><init>(Landroid/content/Context;)V")
);
}

final String jsRemoveOtherCardResponse = """
(function (send) {
XMLHttpRequest.prototype.send = function () {
Expand Down Expand Up @@ -85,6 +86,7 @@ public List<? extends Matcher> matchers() {
};
})(XMLHttpRequest.prototype.send);
""";

@Override
public void hook() throws Throwable {
AcRules.findRule(matchers(), (matcher, clazz, method) -> {
Expand Down Expand Up @@ -245,6 +247,16 @@ protected void beforeHookedMethod(final MethodHookParam param) throws Throwable
XposedHelpers.setObjectField(param.thisObject, "hot_card", null);
}
});
// 帖子 AI 聊天
XposedHelpers.findAndHookMethod("tbclient.PbPage.DataRes$Builder", sClassLoader, "build", boolean.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(final MethodHookParam param) throws Throwable {
final var postList = (List<?>) XposedHelpers.getObjectField(param.thisObject, "post_list");
if (postList == null) return;

postList.removeIf(o -> XposedHelpers.getObjectField(o, "aichat_bot_comment_card") != null);
}
});
// 吧页面
XposedHelpers.findAndHookMethod("tbclient.FrsPage.DataRes$Builder", sClassLoader, "build", boolean.class, new XC_MethodHook() {
@Override
Expand Down

0 comments on commit ad15f9d

Please sign in to comment.