Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit 0e633f5

Browse files
committed
兼容windows xp
1 parent 6d9bb37 commit 0e633f5

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

main/src/main/java/org/pdown/gui/DownApplication.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class DownApplication extends Application {
6262

6363
private static final String OS = OsUtil.isWindows() ? "windows"
6464
: (OsUtil.isMac() ? "mac" : "linux");
65-
private static final String ICON_NAME = OS + "/logo.png";
65+
private static final String ICON_PATH = OS + (OsUtil.isWindowsXP() ? "/logo_xp.png" : "/logo.png");
6666

6767
public static DownApplication INSTANCE;
6868

@@ -91,8 +91,11 @@ public void start(Stage primaryStage) throws Exception {
9191
initEmbedHttpServer();
9292
initExtension();
9393
initTray();
94-
initWindow();
95-
initBrowser();
94+
//xp不支持webview
95+
if (!OsUtil.isWindowsXP()) {
96+
initWindow();
97+
initBrowser();
98+
}
9699
loadUri(null, true, true);
97100
}
98101

@@ -217,7 +220,7 @@ private void initTray() throws AWTException {
217220
// 获得系统托盘对象
218221
SystemTray systemTray = SystemTray.getSystemTray();
219222
// 获取图片所在的URL
220-
URL url = Thread.currentThread().getContextClassLoader().getResource(ICON_NAME);
223+
URL url = Thread.currentThread().getContextClassLoader().getResource(ICON_PATH);
221224
// 为系统托盘加托盘图标
222225
Image trayImage = Toolkit.getDefaultToolkit().getImage(url);
223226
Dimension trayIconSize = systemTray.getTrayIconSize();
@@ -280,7 +283,7 @@ private void initWindow() {
280283
stage.setY((bounds.getHeight() - height) / 2);
281284
stage.setMinWidth(width);
282285
stage.setMinHeight(height);
283-
stage.getIcons().add(new javafx.scene.image.Image(Thread.currentThread().getContextClassLoader().getResourceAsStream(ICON_NAME)));
286+
stage.getIcons().add(new javafx.scene.image.Image(Thread.currentThread().getContextClassLoader().getResourceAsStream(ICON_PATH)));
284287
stage.setResizable(true);
285288
//关闭窗口监听
286289
stage.setOnCloseRequest(event -> {
@@ -319,7 +322,7 @@ public void show(boolean isTray) {
319322
public void loadUri(String uri, boolean isTray, boolean isStartup) {
320323
String url = "http://127.0.0.1:" + FRONT_PORT + (uri == null ? "" : uri);
321324
boolean autoOpen = PDownConfigContent.getInstance().get().isAutoOpen();
322-
if (PDownConfigContent.getInstance().get().getUiMode() == 0) {
325+
if (OsUtil.isWindowsXP() || PDownConfigContent.getInstance().get().getUiMode() == 0) {
323326
if (!isStartup || autoOpen) {
324327
try {
325328
Desktop.getDesktop().browse(URI.create(url));

main/src/main/java/org/pdown/gui/http/controller/NativeController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public FullHttpResponse checkCert(Channel channel, FullHttpRequest request) thro
371371
public FullHttpResponse installCert(Channel channel, FullHttpRequest request) throws Exception {
372372
Map<String, Object> data = new HashMap<>();
373373
boolean status;
374-
if (OsUtil.isUnix()) {
374+
if (OsUtil.isUnix() || OsUtil.isWindowsXP()) {
375375
if (!AppUtil.checkIsInstalledCert()) {
376376
ExtensionCertUtil.buildCert(AppUtil.SSL_PATH, AppUtil.SUBJECT);
377377
}

main/src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 3.3
1+
version: 3.31
22
spring:
33
profiles:
44
active: @environment@
20 KB
Loading

0 commit comments

Comments
 (0)