Skip to content

Commit d5ec95a

Browse files
committed
Update version check, and fix some bugs
1 parent 510d9ba commit d5ec95a

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/main/java/lau/ZBChecker/Main.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public class Main {
2323
public static boolean isCloudMode = false;
2424
public static transient Log log = LogFactory.getLog("Main");
2525
public static long totalTriedTimes = 0;
26-
public static List<String> proxyList = new ArrayList<String>();
27-
public static List<String> comboList = new ArrayList<String>();
26+
public static List<String> proxyList = new ArrayList<>();
27+
public static List<String> comboList = new ArrayList<>();
2828
public static Counter counter = new Counter();
2929
public static String fileFolderName = "./results/" + (new Date()).toString().replace(':', '-');
3030
public static int totalThreads = 0;
@@ -41,6 +41,7 @@ public static void main(String[] args) {
4141
" / /__ | |_| | | |___ | | | | | |___ | |___ | | \\ \\ | |___ | | \\ \\ \n" +
4242
"/_____| |_____/ \\_____| |_| |_| |_____| \\_____| |_| \\_\\ |_____| |_| \\_\\|@ \n" +
4343
"@|yellow By Github@layou233|@\n"));
44+
UpdateCheck.updateCheck();
4445
config.loadConfig();
4546
String text = LoadFileResource.loadFile("combos.txt");
4647
if (!Objects.equals(text, "")) isCloudMode = true;
@@ -60,8 +61,8 @@ public static void main(String[] args) {
6061
log.fatal(config.proxyFile.getName() + " is not found. Please recheck your proxy file name!");
6162
System.exit(0);
6263
}
64+
System.out.println(ansi().render("@|green Successfully loaded " + Main.proxyList.size() + " proxies.|@"));
6365
}
64-
System.out.println(ansi().render("@|green Successfully loaded " + Main.proxyList.size() + " proxies.|@"));
6566

6667
// Load combos
6768
try {
@@ -71,7 +72,7 @@ public static void main(String[] args) {
7172
log.fatal(config.comboFile.getName() + " is not found. Please recheck your combo file name!");
7273
System.exit(0);
7374
}
74-
System.out.println(ansi().render("@|green Successfully loaded " + comboList.size() + " combos.|@\n"));
75+
log.warn(ansi().render("@|green Successfully loaded " + comboList.size() + " combos.|@\n"));
7576

7677
// Judge if there is no proxy/combo
7778
if (comboList.size() == 0) {

src/main/java/lau/ZBChecker/UpdateCheck.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ public static void updateCheck() {
1515
System.out.println("Version " + version);
1616
String remoteVersion;
1717
try {
18-
CloseableHttpResponse httpClient = HttpClients.createDefault().execute(new HttpGet("https://raw.githubusercontent.com/layou233/NovelDL/master/src/main/resources/version.txt"));
18+
CloseableHttpResponse httpClient = HttpClients.createDefault().execute(new HttpGet("https://raw.githubusercontent.com/layou233/ZBChecker/master/src/main/resources/version.txt"));
1919
remoteVersion = EntityUtils.toString(httpClient.getEntity(), "UTF-8");
2020
httpClient.close();
2121
} catch (IOException e) {
2222
System.out.println("FAILED TO CHECK FOR UPDATES.\n" +
23-
"You can check it yourself at https://github.com/layou233/NovelDL/releases\n");
23+
"You can check it yourself at https://github.com/layou233/ZBChecker/releases\n");
2424
return;
2525
}
2626
if (version.equals(remoteVersion))
2727
System.out.println("Nice! You are using the latest version!\n");
2828
else System.out.println("THE ZBChecker YOU ARE CURRENTLY USING HAS BEEN OUTDATED!\n" +
29-
"Check out newer versions at https://github.com/layou233/NovelDL/releases\n");
29+
"Check out newer versions at https://github.com/layou233/ZBChecker/releases\n");
3030
}
3131
}

src/main/java/lau/ZBChecker/threads/RefreshApiProxyThread.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@
99
import java.io.IOException;
1010
import java.util.Arrays;
1111

12+
import static org.fusesource.jansi.Ansi.ansi;
13+
1214
public class RefreshApiProxyThread extends Thread {
15+
protected transient static Log log = LogFactory.getLog("RefreshApiProxyThread");
1316
public static void loadProxyFromApi() {
14-
Log log = LogFactory.getLog("RefreshApiProxyThread");
1517
try {
1618
Main.proxyList = Arrays.asList(Get.get(Main.config.proxyApi, null, null).trim().replace("\r\n", "\n").replace("\r", "\n").split("\n"));
1719
} catch (IOException e) {
1820
e.printStackTrace();
19-
log.error("Fail to load proxies from API. Please restart.");
21+
log.error(ansi().render("@|red Fail to load proxies from API. Please restart.|@"));
2022
System.exit(0);
2123
}
22-
log.info("Successfully loaded " + Main.proxyList.size() + " proxies.\n");
24+
log.warn(ansi().render("@|green Successfully loaded " + Main.proxyList.size() + " proxies |@@|cyan from API.|@"));
2325
}
2426

2527
@Override

0 commit comments

Comments
 (0)