mirror of
https://github.com/octopusYan/alist-gui.git
synced 2024-11-21 19:56:41 +08:00
Compare commits
3 Commits
96274f6952
...
a8db7cbf88
Author | SHA1 | Date | |
---|---|---|---|
|
a8db7cbf88 | ||
6a4e425f8a | |||
09f515025c |
@ -7,11 +7,11 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cn.octopusyan</groupId>
|
<groupId>cn.octopusyan</groupId>
|
||||||
<artifactId>alist-gui</artifactId>
|
<artifactId>alist-gui</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>${gui.version}</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>gui</artifactId>
|
<artifactId>gui</artifactId>
|
||||||
<version>${parent.version}</version>
|
<version>${gui.version}</version>
|
||||||
<name>alist-gui</name>
|
<name>alist-gui</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -21,6 +21,8 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
|
||||||
|
<parent.version>${gui.version}</parent.version>
|
||||||
|
|
||||||
<exec.mainClass>cn.octopusyan.alistgui.AppLauncher</exec.mainClass>
|
<exec.mainClass>cn.octopusyan.alistgui.AppLauncher</exec.mainClass>
|
||||||
<cssSrcPath>${project.basedir}/src/main/resources/css</cssSrcPath>
|
<cssSrcPath>${project.basedir}/src/main/resources/css</cssSrcPath>
|
||||||
<cssTargetPath>${project.basedir}/target/classes/css</cssTargetPath>
|
<cssTargetPath>${project.basedir}/target/classes/css</cssTargetPath>
|
||||||
@ -191,7 +193,7 @@
|
|||||||
<mainClass>cn.octopusyan.alistgui/${exec.mainClass}</mainClass>
|
<mainClass>cn.octopusyan.alistgui/${exec.mainClass}</mainClass>
|
||||||
<options>
|
<options>
|
||||||
<option>--enable-preview</option>
|
<option>--enable-preview</option>
|
||||||
<!-- <option>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005</option>-->
|
<!-- <option>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005</option>-->
|
||||||
</options>
|
</options>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
@ -41,7 +41,7 @@ public class Application extends javafx.application.Application {
|
|||||||
long delay = 0L;
|
long delay = 0L;
|
||||||
// 更新重启检查
|
// 更新重启检查
|
||||||
File upgradeFile = new File(Constants.DATA_DIR_PATH + File.separator + new Gui().getReleaseFile());
|
File upgradeFile = new File(Constants.DATA_DIR_PATH + File.separator + new Gui().getReleaseFile());
|
||||||
logger.error("{}{}{}", Constants.DATA_DIR_PATH, File.separator, new Gui().getReleaseFile());
|
// logger.error("{}{}{}", Constants.DATA_DIR_PATH, File.separator, new Gui().getReleaseFile());
|
||||||
if (upgradeFile.exists()) {
|
if (upgradeFile.exists()) {
|
||||||
logger.error("upgradeFile.exists");
|
logger.error("upgradeFile.exists");
|
||||||
FileUtil.del(upgradeFile);
|
FileUtil.del(upgradeFile);
|
||||||
@ -165,7 +165,7 @@ public class Application extends javafx.application.Application {
|
|||||||
instanceCheckLatch.countDown();
|
instanceCheckLatch.countDown();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
logger.error(STR."====\{instanceId}====");
|
logger.debug(STR."====\{instanceId}====");
|
||||||
try (
|
try (
|
||||||
Socket clientSocket = serverSocket.accept();
|
Socket clientSocket = serverSocket.accept();
|
||||||
BufferedReader in = new BufferedReader(
|
BufferedReader in = new BufferedReader(
|
||||||
|
@ -143,24 +143,21 @@ public class AListManager {
|
|||||||
ConsoleLog.info(getText("alist.status.stop"));
|
ConsoleLog.info(getText("alist.status.stop"));
|
||||||
if (!running.get()) {
|
if (!running.get()) {
|
||||||
ConsoleLog.warning(getText("alist.status.stop.stopped"));
|
ConsoleLog.warning(getText("alist.status.stop.stopped"));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
util.destroy();
|
util.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
static ChangeListener<Boolean> restartListener;
|
static ChangeListener<Boolean> restartListener = (_, _, run) -> {
|
||||||
|
if (run) return;
|
||||||
|
running.removeListener(AListManager.restartListener);
|
||||||
|
start();
|
||||||
|
};
|
||||||
|
|
||||||
public static void restart() {
|
public static void restart() {
|
||||||
if (!running.get()) {
|
if (!running.get()) {
|
||||||
start();
|
start();
|
||||||
} else {
|
} else {
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
restartListener = (_, _, run) -> {
|
|
||||||
if (run) return;
|
|
||||||
running.removeListener(restartListener);
|
|
||||||
start();
|
|
||||||
};
|
|
||||||
running.addListener(restartListener);
|
running.addListener(restartListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,7 +191,7 @@ public class AListManager {
|
|||||||
//============================={ private }====================================
|
//============================={ private }====================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO 点击开始时检查 aList 执行文件
|
* 点击开始时检查 aList 执行文件
|
||||||
*/
|
*/
|
||||||
private static boolean checkAList() {
|
private static boolean checkAList() {
|
||||||
if (new File(Constants.ALIST_FILE).exists()) return true;
|
if (new File(Constants.ALIST_FILE).exists()) return true;
|
||||||
@ -216,6 +213,11 @@ public class AListManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始下载AList
|
||||||
|
*
|
||||||
|
* @param version 下载版本号
|
||||||
|
*/
|
||||||
private static void showDownload(String version) {
|
private static void showDownload(String version) {
|
||||||
String content = STR."""
|
String content = STR."""
|
||||||
\{getText("msg.alist.download.notfile")}
|
\{getText("msg.alist.download.notfile")}
|
||||||
|
@ -17,6 +17,7 @@ import cn.octopusyan.alistgui.view.alert.AlertUtil;
|
|||||||
import cn.octopusyan.alistgui.view.alert.builder.AlertBuilder;
|
import cn.octopusyan.alistgui.view.alert.builder.AlertBuilder;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.property.*;
|
import javafx.beans.property.*;
|
||||||
|
import javafx.beans.value.ChangeListener;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,8 +145,13 @@ public class AboutViewModule extends BaseViewModel {
|
|||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
switch (app) {
|
switch (app) {
|
||||||
case AList _ -> {
|
case AList _ -> {
|
||||||
// 下载完成后,解压并删除文件
|
if(AListManager.isRunning()) {
|
||||||
DownloadUtil.unzip(app);
|
AListManager.stop();
|
||||||
|
AListManager.runningProperty().addListener(updateListener);
|
||||||
|
} else {
|
||||||
|
// 下载完成后,解压并删除文件
|
||||||
|
DownloadUtil.unzip(app);
|
||||||
|
}
|
||||||
// 设置应用版本
|
// 设置应用版本
|
||||||
aListVersion.setValue(aListNewVersion.getValue());
|
aListVersion.setValue(aListNewVersion.getValue());
|
||||||
AListManager.restart();
|
AListManager.restart();
|
||||||
@ -163,4 +169,12 @@ public class AboutViewModule extends BaseViewModel {
|
|||||||
}).execute();
|
}).execute();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static final ChangeListener<Boolean> updateListener = (_, _, run) -> {
|
||||||
|
if (!run) {
|
||||||
|
// 下载完成后,解压并删除文件
|
||||||
|
DownloadUtil.unzip(ConfigManager.aList());
|
||||||
|
}
|
||||||
|
AListManager.runningProperty().removeListener(AboutViewModule.updateListener);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>cn.octopusyan</groupId>
|
<groupId>cn.octopusyan</groupId>
|
||||||
<artifactId>alist-gui</artifactId>
|
<artifactId>alist-gui</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>${gui.version}</version>
|
||||||
<name>alist-gui</name>
|
<name>alist-gui</name>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
|
||||||
<project.version>1.0.1</project.version>
|
<gui.version>1.0.3</gui.version>
|
||||||
|
|
||||||
<junit.version>5.10.0</junit.version>
|
<junit.version>5.10.0</junit.version>
|
||||||
<javafx.version>21.0.4</javafx.version>
|
<javafx.version>21.0.4</javafx.version>
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cn.octopusyan</groupId>
|
<groupId>cn.octopusyan</groupId>
|
||||||
<artifactId>alist-gui</artifactId>
|
<artifactId>alist-gui</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>${gui.version}</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>upgrade</artifactId>
|
<artifactId>upgrade</artifactId>
|
||||||
<version>${parent.version}</version>
|
<version>${gui.version}</version>
|
||||||
<name>upgrade</name>
|
<name>upgrade</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
Loading…
Reference in New Issue
Block a user