adblock lmao

This commit is contained in:
gdlbo
2022-08-01 21:36:47 +03:00
parent 4db73ff3d1
commit 6b90aedae8
4 changed files with 45 additions and 67 deletions
@@ -14,6 +14,10 @@ import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isMusicBlock;
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isNewsBlock;
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isPostRecommendations;
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isRecomsGroup;
import static ru.vtosters.lite.utils.Preferences.ads;
import static ru.vtosters.lite.utils.Preferences.adsslider;
import static ru.vtosters.lite.utils.Preferences.authorsrecomm;
import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.vkme;
@@ -23,6 +27,7 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
public class NewsfeedHook {
@@ -73,4 +78,42 @@ public class NewsfeedHook {
}
return list;
}
public static String[] feedParams(){
HashSet<String> params = new HashSet<>();
params.add("post");
params.add("photo");
params.add("photo_tag");
if (!friendsrecomm()) {
params.add("friends_recomm");
}
if (!ads()) {
params.add("app_widget");
params.add("promo_button");
}
if (!authorsrecomm()) {
params.add("authors_rec");
}
return params.toArray(new String[0]);
}
public static void adsParams(HashSet hashSet) {
if (ads() || adsslider()) {
hashSet.add("ads_disabled");
return;
}
hashSet.add("ads_app");
hashSet.add("ads_site");
hashSet.add("ads_post");
hashSet.add("ads_app_slider");
hashSet.add("ads_site_slider");
hashSet.add("ads_app_video");
hashSet.add("ads_post_pretty_cards");
hashSet.add("ads_post_snippet_video");
}
}
@@ -1,6 +1,4 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Preferences.ads;
import static ru.vtosters.lite.utils.Preferences.adsslider;
import static ru.vtosters.lite.utils.Preferences.dev;
import android.util.Log;
@@ -15,12 +13,6 @@ public class RequestDumper{
apiver = "5.187";
}
if (params.get("filters") != null) {
if (params.get("filters").toString().contains("ads_app") && ads() && adsslider()) {
params.put("filters", "ads_disabled");
}
}
if (dev()) {
Log.d("RequestDumper", "Method: " + method);
Log.d("RequestDumper", "API version: " + apiver);
@@ -46,22 +46,7 @@
.method static constructor <clinit>()V
.locals 7
const-string v0, "post"
const-string v1, "photo"
const-string v2, "photo_tag"
const-string v3, "friends_recomm"
const-string v4, "app_widget"
const-string v5, "promo_button"
const-string v6, "authors_rec"
.line 1
filled-new-array/range {v0 .. v6}, [Ljava/lang/String;
invoke-static {}, Lru/vtosters/lite/hooks/NewsfeedHook;->feedParams()[Ljava/lang/String;
move-result-object v0
@@ -327,10 +327,6 @@
if-eqz v0, :cond_0
const-string v0, "ads_disabled"
.line 16
invoke-static {v1, v0}, Lcom/vtosters/lite/utils/Utils;->a(Ljava/lang/StringBuilder;Ljava/lang/String;)V
.line 17
:cond_0
@@ -742,45 +738,7 @@
invoke-direct {v0, p0}, Ljava/util/HashSet;-><init>(Ljava/util/Collection;)V
const-string p0, "ads_app"
.line 12
invoke-virtual {v0, p0}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
const-string p0, "ads_site"
.line 13
invoke-virtual {v0, p0}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
const-string p0, "ads_post"
.line 14
invoke-virtual {v0, p0}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
const-string p0, "ads_app_slider"
.line 15
invoke-virtual {v0, p0}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
const-string p0, "ads_site_slider"
.line 16
invoke-virtual {v0, p0}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
const-string p0, "ads_app_video"
.line 17
invoke-virtual {v0, p0}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
const-string p0, "ads_post_pretty_cards"
.line 18
invoke-virtual {v0, p0}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
const-string p0, "ads_post_snippet_video"
.line 19
invoke-virtual {v0, p0}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
invoke-static {v0}, Lru/vtosters/lite/hooks/NewsfeedHook;->adsParams(Ljava/util/HashSet;)V
.line 20
invoke-virtual {v0}, Ljava/util/HashSet;->size()I