Commit 6e4bfd75 authored by Liang Ding's avatar Liang Ding

🎨 忽略日志

parent c7e18483
...@@ -125,20 +125,24 @@ public final class Solos { ...@@ -125,20 +125,24 @@ public final class Solos {
* Reloads blacklist IPs. * Reloads blacklist IPs.
*/ */
public static void reloadBlacklistIPs() { public static void reloadBlacklistIPs() {
final HttpResponse res = HttpRequest.get("https://hacpai.com/apis/blacklist/ip").trustAllCerts(true). try {
connectionTimeout(3000).timeout(7000).header("User-Agent", Solos.USER_AGENT).send(); final HttpResponse res = HttpRequest.get("https://hacpai.com/apis/blacklist/ip").trustAllCerts(true).
if (200 != res.statusCode()) { connectionTimeout(3000).timeout(7000).header("User-Agent", Solos.USER_AGENT).send();
return; if (200 != res.statusCode()) {
} return;
res.charset("UTF-8"); }
final JSONObject result = new JSONObject(res.bodyText()); res.charset("UTF-8");
if (0 != result.optInt(Keys.CODE)) { final JSONObject result = new JSONObject(res.bodyText());
return; if (0 != result.optInt(Keys.CODE)) {
} return;
}
final JSONArray ips = result.optJSONArray(Common.DATA); final JSONArray ips = result.optJSONArray(Common.DATA);
BLACKLIST_IPS.clear(); BLACKLIST_IPS.clear();
BLACKLIST_IPS.addAll(CollectionUtils.jsonArrayToList(ips)); BLACKLIST_IPS.addAll(CollectionUtils.jsonArrayToList(ips));
} catch (final Exception e) {
// ignored
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment