|
12 | 12 | import com.raincat.dolby_beta.helper.EAPIHelper; |
13 | 13 | import com.raincat.dolby_beta.helper.SettingHelper; |
14 | 14 |
|
| 15 | +import org.json.JSONArray; |
15 | 16 | import org.json.JSONObject; |
16 | 17 |
|
17 | 18 |
|
@@ -63,16 +64,23 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { |
63 | 64 | } else if (path.contains("batch")) { |
64 | 65 | if (original.contains("comment\\/banner\\/get")) { |
65 | 66 | JSONObject jsonObject = new JSONObject(original); |
66 | | - jsonObject.put("/api/content/exposure/comment/banner/get", "{\"code\":200}"); |
| 67 | + if (!jsonObject.isNull("/api/content/exposure/comment/banner/get")) { |
| 68 | + JSONObject object = new JSONObject(); |
| 69 | + object.put("code", 200); |
| 70 | + object.put("data", new JSONObject()); |
| 71 | + jsonObject.put("/api/content/exposure/comment/banner/get", object); |
| 72 | + } |
| 73 | + if (!jsonObject.isNull("/api/v1/content/exposure/comment/banner/get")) { |
| 74 | + JSONObject object = jsonObject.getJSONObject("/api/v1/content/exposure/comment/banner/get"); |
| 75 | + JSONObject data = object.getJSONObject("data"); |
| 76 | + data.put("count", 0); |
| 77 | + data.put("offset", 999999999); |
| 78 | + data.put("records", new JSONArray()); |
| 79 | + data.put("message", ""); |
| 80 | + object.put("data", data); |
| 81 | + jsonObject.put("/api/v1/content/exposure/comment/banner/get", object); |
| 82 | + } |
67 | 83 | original = jsonObject.toString(); |
68 | | - original = original.replace("\"{\\\"code\\\":200}\"", "{\"code\":200}"); |
69 | | - } |
70 | | - if (original.contains("\\/api\\/v1\\/content\\/exposure\\/comment\\/banner\\/get")) { |
71 | | - JSONObject jsonObject = new JSONObject(original); |
72 | | - jsonObject.put("/api/v1/content/exposure/comment/banner/get", "{-\"code-\":200,-\"data-\":{-\"count-\":0,-\"offset-\":999999999,-\"records-\":[]},-\"message-\":-\"-\"}"); |
73 | | - original = jsonObject.toString(); |
74 | | - original = original.replace("-\\", "").replace("\"\\/api\\/v1\\/content\\/exposure\\/comment\\/banner\\/get\":\"", "\"\\/api\\/v1\\/content\\/exposure\\/comment\\/banner\\/get\":") |
75 | | - .replace("\"message\":\"\"}\"", "\"message\":\"\"}"); |
76 | 84 | } |
77 | 85 | } else if (path.contains("upload/cloud/info/v2")) { |
78 | 86 | JSONObject jsonObject = new JSONObject(original); |
|
0 commit comments