From cbdf33f253250ef118ad6b3ec0234c5ede183b0b Mon Sep 17 00:00:00 2001 From: gdlbo <41114720+gdlbo@users.noreply.github.com> Date: Fri, 2 Sep 2022 17:40:04 +0300 Subject: [PATCH] discover adblock --- .../ru/vtosters/lite/hooks/JsonInjectors.java | 59 +++++++++++++++++++ .../com/vk/api/discover/DiscoverGet.smali | 4 ++ 2 files changed, 63 insertions(+) diff --git a/app/src/main/java/ru/vtosters/lite/hooks/JsonInjectors.java b/app/src/main/java/ru/vtosters/lite/hooks/JsonInjectors.java index 0a6be60db..4f72e0fdb 100644 --- a/app/src/main/java/ru/vtosters/lite/hooks/JsonInjectors.java +++ b/app/src/main/java/ru/vtosters/lite/hooks/JsonInjectors.java @@ -204,6 +204,65 @@ public class JsonInjectors { return json; } + public static JSONObject discoverInject(JSONObject json) throws JSONException, ParseException, IOException { + var items = json.optJSONArray("items"); + var newObj = new JSONArray(); + + newsfeedadtest(items); // adblock + +// newObj.put(discoverObj()); // template injection + + for (int i = 0; i < items.length(); i++) { + var curr = items.getJSONObject(i); + if (!curr.optString("template").contains("info")){ + newObj.put(items.optJSONObject(i)); + } + } + + json.put("items", newObj); + + return json; + } + + public static JSONObject discoverObj() throws JSONException, ParseException, IOException { + var mainjson = new JSONObject(); + + var info = new JSONObject(); + info.put("title", "Test Injection"); + info.put("text_color", "#ffffff"); + info.put("description", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat"); + + var image = new JSONArray(); + var imageQuality1 = new JSONObject(); + imageQuality1.put("url", "https://w7.pngwing.com/pngs/505/1021/png-transparent-konata-izumi-lucky-star-desktop-anime-anime-blue-mammal-face.png"); + imageQuality1.put("width", 72); // 72, 108, 144, 216, 288 + imageQuality1.put("height", 72); // 72, 108, 144, 216, 288 + image.put(imageQuality1); + + var background = new JSONArray(); + var backgroundQuality1 = new JSONObject(); + backgroundQuality1.put("url", "https://2ch.life/vg/arch/2022-08-22/src/38524739/16440606579870.jpg"); + backgroundQuality1.put("width", 344); // 344, 516, 680, 1032, 1376 + backgroundQuality1.put("height", 215); // 215, 323, 426, 645, 860 + background.put(backgroundQuality1); + + info.put("image", image); + info.put("background", background); + + mainjson.put("info", info); + mainjson.put("track_code", "info_banner_donut_catalog"); + mainjson.put("template", "info"); + + var action = new JSONObject(); + action.put("type", "open_url"); + action.put("url", "vk.com/vtosters_official"); + action.put("target", "internal"); + + mainjson.put("action", action); + + return mainjson; + } + public static JSONObject menu(JSONObject orig) throws JSONException { var Special = orig.optJSONArray("special"); var Main = orig.getJSONArray("main"); diff --git a/smali/smali_classes2/com/vk/api/discover/DiscoverGet.smali b/smali/smali_classes2/com/vk/api/discover/DiscoverGet.smali index 4d8eaa03e..148e5a8d4 100644 --- a/smali/smali_classes2/com/vk/api/discover/DiscoverGet.smali +++ b/smali/smali_classes2/com/vk/api/discover/DiscoverGet.smali @@ -89,6 +89,10 @@ move-result-object v1 + invoke-static {v1}, Lru/vtosters/lite/hooks/JsonInjectors;->discoverInject(Lorg/json/JSONObject;)Lorg/json/JSONObject; + + move-result-object v1 + iget-object v2, p0, Lcom/vk/api/discover/DiscoverGet;->F:Ljava/lang/String; const/4 v3, 0x0