Skip to content

Commit

Permalink
Verify the problem of software virus declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
Haleydu committed Aug 31, 2020
1 parent 99ededb commit 4484e59
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ public class PreferenceManager {
public static final String PREFERENCES_MH50_KEY_MSG = "preferences_mh50_key_msg";
public static final String PREFERENCES_MH50_IV_MSG = "preferences_mh50_iv_msg";

public static final String PREF_HHAAZZ_BASEURL = "pref_hhaazz_baseurl";
public static final String PREF_HHAAZZ_SW = "pref_hhaazz_sw";

private SharedPreferences mSharedPreferences;

public PreferenceManager(Context context) {
Expand Down
63 changes: 63 additions & 0 deletions app/src/main/java/com/hiroshi/cimoc/presenter/MainPresenter.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
package com.hiroshi.cimoc.presenter;

import android.widget.Toast;

import com.hiroshi.cimoc.App;
import com.hiroshi.cimoc.core.Update;
import com.hiroshi.cimoc.manager.ComicManager;
import com.hiroshi.cimoc.manager.PreferenceManager;
import com.hiroshi.cimoc.model.Comic;
import com.hiroshi.cimoc.model.MiniComic;
import com.hiroshi.cimoc.rx.RxEvent;
import com.hiroshi.cimoc.ui.activity.MainActivity;
import com.hiroshi.cimoc.ui.view.MainView;

import org.json.JSONException;
import org.json.JSONObject;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import rx.Observable;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.schedulers.Schedulers;

/**
* Created by Hiroshi on 2016/9/21.
Expand All @@ -26,6 +37,8 @@ public class MainPresenter extends BasePresenter<MainView> {
private static final String APP_MD5 = "md5";
private static final String APP_URL= "url";

private static final String SOURCE_URL = "https://raw.githubusercontent.com/Haleydu/update/master/sourceBaseUrl.json";

@Override
protected void onViewAttach() {
mComicManager = ComicManager.getInstance(mBaseView);
Expand Down Expand Up @@ -112,4 +125,54 @@ public void call(Throwable throwable) {
}));
}


public void getSourceBaseUrl() {
mCompositeSubscription.add(
Observable.create(new Observable.OnSubscribe<String>() {
@Override
public void call(Subscriber<? super String> subscriber) {
OkHttpClient client = App.getHttpClient();
Request request = new Request.Builder().url(SOURCE_URL).build();
Response response = null;
try {
response = client.newCall(request).execute();
if (response.isSuccessful()) {
String json = response.body().string();
subscriber.onNext(json);
subscriber.onCompleted();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (response != null) {
response.close();
}
}
subscriber.onError(new Exception());
}
}).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<String>() {
@Override
public void call(String json) {
try {
String HHAAZZ = new JSONObject(json).getString("HHAAZZ");
String sw = new JSONObject(json).getString("sw");
if (!HHAAZZ.equals(App.getPreferenceManager().getString(PreferenceManager.PREF_HHAAZZ_BASEURL, ""))){
App.getPreferenceManager().putString(PreferenceManager.PREF_HHAAZZ_BASEURL, HHAAZZ);
}
if (!sw.equals(App.getPreferenceManager().getString(PreferenceManager.PREF_HHAAZZ_SW, ""))){
App.getPreferenceManager().putString(PreferenceManager.PREF_HHAAZZ_SW, sw);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
}
}));
}

}
1 change: 0 additions & 1 deletion app/src/main/java/com/hiroshi/cimoc/source/Dmzjv2.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ public Comic parseInfo(String html, Comic comic) {

@Override
public List<Chapter> parseChapter(String html, Comic comic) {
LogUtil.iLength("hrd",html);
List<Chapter> list = new LinkedList<>();
try {
String JsonArrayString = StringUtils.match("initIntroData\\((.*)\\);", html, 1);
Expand Down
205 changes: 104 additions & 101 deletions app/src/main/java/com/hiroshi/cimoc/source/HHAAZZ.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package com.hiroshi.cimoc.source;

import android.util.Pair;
import android.util.Log;

import com.hiroshi.cimoc.App;
import com.hiroshi.cimoc.manager.PreferenceManager;
import com.hiroshi.cimoc.model.Chapter;
import com.hiroshi.cimoc.model.Comic;
import com.hiroshi.cimoc.model.ImageUrl;
import com.hiroshi.cimoc.model.Source;
import com.hiroshi.cimoc.parser.MangaCategory;
import com.hiroshi.cimoc.parser.MangaParser;
import com.hiroshi.cimoc.parser.NodeIterator;
import com.hiroshi.cimoc.parser.SearchIterator;
import com.hiroshi.cimoc.soup.Node;
import com.hiroshi.cimoc.utils.StringUtils;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

Expand All @@ -27,9 +27,13 @@ public class HHAAZZ extends MangaParser {

public static final int TYPE = 2;
public static final String DEFAULT_TITLE = "汗汗酷漫";
public static String baseUrl = "";
public static String sw = "";

public HHAAZZ(Source source) {
init(source, new Category());
init(source, null);
baseUrl = App.getPreferenceManager().getString(PreferenceManager.PREF_HHAAZZ_BASEURL, "");
sw = App.getPreferenceManager().getString(PreferenceManager.PREF_HHAAZZ_SW, "");
}

public static Source getDefaultSource() {
Expand All @@ -39,7 +43,7 @@ public static Source getDefaultSource() {
@Override
public Request getSearchRequest(String keyword, int page) {
if (page == 1) {
final String url = "http://www.hhimm.com/comic/?act=search&st=".concat(keyword);
final String url = baseUrl+"/comic/?act=search&st=".concat(keyword);
return new Request.Builder().url(url).build();
}
return null;
Expand All @@ -61,12 +65,12 @@ protected Comic parse(Node node) {

@Override
public String getUrl(String cid) {
return "http://hhaass.com/comic/".concat(cid);
return baseUrl+"/comic/".concat(cid);
}

@Override
public Request getInfoRequest(String cid) {
final String url = StringUtils.format("http://www.hhimm.com/manhua/%s.html", cid);
final String url = StringUtils.format(baseUrl+"/manhua/%s.html", cid);
return new Request.Builder().url(url).build();
}

Expand Down Expand Up @@ -134,7 +138,7 @@ public List<Chapter> parseChapter(String html, Comic comic) {

@Override
public Request getImagesRequest(String cid, String path) {
String url = "http://www.hhimm.com".concat(path);
String url = baseUrl+"".concat(path);
_path = path;
return new Request.Builder().url(url).build();
}
Expand All @@ -153,7 +157,7 @@ public List<ImageUrl> parseImages(String html, Chapter chapter) {
Long comicChapter = chapter.getId();
Long id = Long.parseLong(comicChapter + "000" + i);
list.add(new ImageUrl(id, comicChapter, i,
StringUtils.format("http://www.hhimm.com/%s/%d.html?s=%s&d=0", pathId, i, pathS),
StringUtils.format(baseUrl+"/%s/%d.html?s=%s&d=0", pathId, i, pathS),
true));

i++;
Expand Down Expand Up @@ -194,8 +198,7 @@ public static String fromCharCode(int... codePoints) {
}

private String unsuan(String s) {
final String sw = "44123.com|hhcool.com|hhimm.com";
final String su = "www.hhimm.com";
final String su = baseUrl.replace("http://","");
boolean b = false;

for (int i = 0; i < sw.split("|").length; i++) {
Expand Down Expand Up @@ -253,97 +256,97 @@ public List<Comic> parseCategory(String html, int page) {

@Override
public Headers getHeader() {
return Headers.of("Referer", "http://hhaass.com/");
}

private static class Category extends MangaCategory {

@Override
public String getFormat(String... args) {
if (!"".equals(args[CATEGORY_SUBJECT])) {
return StringUtils.format("http://hhaass.com/lists/%s/%%d", args[CATEGORY_SUBJECT]);
} else if (!"".equals(args[CATEGORY_AREA])) {
return StringUtils.format("http://hhaass.com/lists/%s/%%d", args[CATEGORY_AREA]);
} else if (!"".equals(args[CATEGORY_READER])) {
return StringUtils.format("http://hhaass.com/duzhequn/%s/%%d", args[CATEGORY_PROGRESS]);
} else if (!"".equals(args[CATEGORY_PROGRESS])) {
return StringUtils.format("http://hhaass.com/lianwan/%s/%%d", args[CATEGORY_PROGRESS]);
} else {
return "http://hhaass.com/dfcomiclist_%d.htm";
}
}

@Override
protected List<Pair<String, String>> getSubject() {
List<Pair<String, String>> list = new ArrayList<>();
list.add(Pair.create("全部", ""));
list.add(Pair.create("萌系", "1"));
list.add(Pair.create("搞笑", "2"));
list.add(Pair.create("格斗", "3"));
list.add(Pair.create("科幻", "4"));
list.add(Pair.create("剧情", "5"));
list.add(Pair.create("侦探", "6"));
list.add(Pair.create("竞技", "7"));
list.add(Pair.create("魔法", "8"));
list.add(Pair.create("神鬼", "9"));
list.add(Pair.create("校园", "10"));
list.add(Pair.create("惊栗", "11"));
list.add(Pair.create("厨艺", "12"));
list.add(Pair.create("伪娘", "13"));
list.add(Pair.create("图片", "14"));
list.add(Pair.create("冒险", "15"));
list.add(Pair.create("耽美", "21"));
list.add(Pair.create("经典", "22"));
list.add(Pair.create("亲情", "25"));
return list;
}

@Override
protected boolean hasArea() {
return true;
}

@Override
protected List<Pair<String, String>> getArea() {
List<Pair<String, String>> list = new ArrayList<>();
list.add(Pair.create("全部", ""));
list.add(Pair.create("大陆", "19"));
list.add(Pair.create("香港", "20"));
list.add(Pair.create("欧美", "23"));
list.add(Pair.create("日文", "24"));
return list;
}

@Override
protected boolean hasReader() {
return true;
}

@Override
protected List<Pair<String, String>> getReader() {
List<Pair<String, String>> list = new ArrayList<>();
list.add(Pair.create("全部", ""));
list.add(Pair.create("少年", "1"));
list.add(Pair.create("少女", "2"));
list.add(Pair.create("青年", "3"));
return list;
}

@Override
protected boolean hasProgress() {
return true;
}

@Override
protected List<Pair<String, String>> getProgress() {
List<Pair<String, String>> list = new ArrayList<>();
list.add(Pair.create("全部", ""));
list.add(Pair.create("连载", "1"));
list.add(Pair.create("完结", "2"));
return list;
}

return Headers.of("Referer", baseUrl);
}
//
// private static class Category extends MangaCategory {
//
// @Override
// public String getFormat(String... args) {
// if (!"".equals(args[CATEGORY_SUBJECT])) {
// return StringUtils.format("http://hhaass.com/lists/%s/%%d", args[CATEGORY_SUBJECT]);
// } else if (!"".equals(args[CATEGORY_AREA])) {
// return StringUtils.format("http://hhaass.com/lists/%s/%%d", args[CATEGORY_AREA]);
// } else if (!"".equals(args[CATEGORY_READER])) {
// return StringUtils.format("http://hhaass.com/duzhequn/%s/%%d", args[CATEGORY_PROGRESS]);
// } else if (!"".equals(args[CATEGORY_PROGRESS])) {
// return StringUtils.format("http://hhaass.com/lianwan/%s/%%d", args[CATEGORY_PROGRESS]);
// } else {
// return "http://hhaass.com/dfcomiclist_%d.htm";
// }
// }
//
// @Override
// protected List<Pair<String, String>> getSubject() {
// List<Pair<String, String>> list = new ArrayList<>();
// list.add(Pair.create("全部", ""));
// list.add(Pair.create("萌系", "1"));
// list.add(Pair.create("搞笑", "2"));
// list.add(Pair.create("格斗", "3"));
// list.add(Pair.create("科幻", "4"));
// list.add(Pair.create("剧情", "5"));
// list.add(Pair.create("侦探", "6"));
// list.add(Pair.create("竞技", "7"));
// list.add(Pair.create("魔法", "8"));
// list.add(Pair.create("神鬼", "9"));
// list.add(Pair.create("校园", "10"));
// list.add(Pair.create("惊栗", "11"));
// list.add(Pair.create("厨艺", "12"));
// list.add(Pair.create("伪娘", "13"));
// list.add(Pair.create("图片", "14"));
// list.add(Pair.create("冒险", "15"));
// list.add(Pair.create("耽美", "21"));
// list.add(Pair.create("经典", "22"));
// list.add(Pair.create("亲情", "25"));
// return list;
// }
//
// @Override
// protected boolean hasArea() {
// return true;
// }
//
// @Override
// protected List<Pair<String, String>> getArea() {
// List<Pair<String, String>> list = new ArrayList<>();
// list.add(Pair.create("全部", ""));
// list.add(Pair.create("大陆", "19"));
// list.add(Pair.create("香港", "20"));
// list.add(Pair.create("欧美", "23"));
// list.add(Pair.create("日文", "24"));
// return list;
// }
//
// @Override
// protected boolean hasReader() {
// return true;
// }
//
// @Override
// protected List<Pair<String, String>> getReader() {
// List<Pair<String, String>> list = new ArrayList<>();
// list.add(Pair.create("全部", ""));
// list.add(Pair.create("少年", "1"));
// list.add(Pair.create("少女", "2"));
// list.add(Pair.create("青年", "3"));
// return list;
// }
//
// @Override
// protected boolean hasProgress() {
// return true;
// }
//
// @Override
// protected List<Pair<String, String>> getProgress() {
// List<Pair<String, String>> list = new ArrayList<>();
// list.add(Pair.create("全部", ""));
// list.add(Pair.create("连载", "1"));
// list.add(Pair.create("完结", "2"));
// return list;
// }
//
// }

}

Loading

0 comments on commit 4484e59

Please sign in to comment.