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