fix API借口地址更新
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>icu.namophice</groupId>
|
||||
<artifactId>ink-photo-album</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<version>1.0</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
|
||||
@@ -5,13 +5,8 @@ import icu.namophice.inkphotoalbum.driver.EPaper;
|
||||
import icu.namophice.inkphotoalbum.utils.CommonUtil;
|
||||
import icu.namophice.inkphotoalbum.utils.ImageUtil;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
@@ -84,32 +79,14 @@ public class MasterService {
|
||||
DefaultConfig.imageIndex = 0;
|
||||
}
|
||||
|
||||
final StringBuilder imageUrlStr = new StringBuilder();
|
||||
try {
|
||||
final URL url = new URL(DefaultConfig.imageUrlArr[new Random().nextInt(DefaultConfig.imageUrlArr.length)]);
|
||||
BufferedImage targetImage = ImageUtil.getImageToScreen(
|
||||
DefaultConfig.imageUrlArr[new Random().nextInt(DefaultConfig.imageUrlArr.length)],
|
||||
true
|
||||
);
|
||||
|
||||
trustAllHttpsCertificates();
|
||||
HostnameVerifier hv = (urlHostName, session) -> {
|
||||
System.out.println("Warning: URL Host: " + urlHostName + " vs. " + session.getPeerHost());
|
||||
return true;
|
||||
};
|
||||
HttpsURLConnection.setDefaultHostnameVerifier(hv);
|
||||
|
||||
final HttpURLConnection conn = (HttpURLConnection) (url.openConnection());
|
||||
final URL imageUrl = conn.getURL();
|
||||
imageUrlStr.append(imageUrl.getProtocol()).append("://").append(imageUrl.getHost()).append(imageUrl.getPath());
|
||||
} catch (IOException e) {
|
||||
DefaultConfig.imageIndex = 0;
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (imageUrlStr.length() > 0) {
|
||||
BufferedImage targetImage = ImageUtil.getImageToScreen(imageUrlStr.toString(), true);
|
||||
|
||||
CommonUtil.printLogToConsole("Print images to screen ...");
|
||||
ePaper.drawImage(targetImage);
|
||||
DefaultConfig.imageIndex++;
|
||||
}
|
||||
CommonUtil.printLogToConsole("Print images to screen ...");
|
||||
ePaper.drawImage(targetImage);
|
||||
DefaultConfig.imageIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,12 +14,11 @@ import java.io.FileReader;
|
||||
public class DefaultConfig {
|
||||
|
||||
public static final String[] imageUrlArr = {
|
||||
"https://api.ixiaowai.cn/api/api.php",
|
||||
"https://api.ixiaowai.cn/api/api2.php",
|
||||
"https://api.ixiaowai.cn/mcapi/mcapi.php",
|
||||
"https://api.ixiaowai.cn/mcapi/mcapi2.php",
|
||||
"https://api.ixiaowai.cn/gqapi/gqapi.php",
|
||||
"https://api.ixiaowai.cn/gqapi/gqapi2.php"
|
||||
"https://www.dmoe.cc/random.php",
|
||||
"https://cdn.seovx.com/d/?mom=302",
|
||||
"https://api.paugram.com/wallpaper/",
|
||||
"https://api.yimian.xyz/img",
|
||||
"https://img.xjh.me/random_img.php"
|
||||
};
|
||||
|
||||
public static final String configFileName = "conf.json";
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 6.8 MiB |
Reference in New Issue
Block a user