mirror of
https://github.com/octopusYan/alist-gui.git
synced 2025-12-08 17:21:56 +08:00
Compare commits
2 Commits
alpha/v1.0
...
17d21fdc03
| Author | SHA1 | Date | |
|---|---|---|---|
| 17d21fdc03 | |||
| 894439de6f |
19
gui/pom.xml
19
gui/pom.xml
@ -105,21 +105,6 @@
|
|||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<pluginRepositories>
|
|
||||||
<pluginRepository>
|
|
||||||
<id>nexus</id>
|
|
||||||
<name>nexus-snapshot-repository</name>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
<updatePolicy>always</updatePolicy>
|
|
||||||
</snapshots>
|
|
||||||
<releases>
|
|
||||||
<enabled>false</enabled>
|
|
||||||
</releases>
|
|
||||||
</pluginRepository>
|
|
||||||
</pluginRepositories>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
@ -136,7 +121,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>21</source>
|
<source>21</source>
|
||||||
<target>21</target>
|
<target>21</target>
|
||||||
@ -156,7 +140,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>us.hebi.sass</groupId>
|
<groupId>us.hebi.sass</groupId>
|
||||||
<artifactId>sass-cli-maven-plugin</artifactId>
|
<artifactId>sass-cli-maven-plugin</artifactId>
|
||||||
<version>1.0.3</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<sassVersion>1.78.0</sassVersion>
|
<sassVersion>1.78.0</sassVersion>
|
||||||
<args> <!-- Any argument that should be forwarded to the sass cli -->
|
<args> <!-- Any argument that should be forwarded to the sass cli -->
|
||||||
@ -183,7 +166,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-maven-plugin</artifactId>
|
<artifactId>javafx-maven-plugin</artifactId>
|
||||||
<version>0.0.8</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<stripDebug>true</stripDebug>
|
<stripDebug>true</stripDebug>
|
||||||
<compress>2</compress>
|
<compress>2</compress>
|
||||||
@ -220,7 +202,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.github.fvarrui</groupId>
|
<groupId>io.github.fvarrui</groupId>
|
||||||
<artifactId>javapackager</artifactId>
|
<artifactId>javapackager</artifactId>
|
||||||
<version>1.7.7-SNAPSHOT</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<mainClass>${exec.mainClass}</mainClass>
|
<mainClass>${exec.mainClass}</mainClass>
|
||||||
<bundleJre>true</bundleJre>
|
<bundleJre>true</bundleJre>
|
||||||
|
|||||||
@ -19,9 +19,10 @@ import org.apache.commons.lang3.time.DateFormatUtils;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +34,7 @@ public class ConsoleLog {
|
|||||||
public static final String format = "yyyy/MM/dd hh:mm:ss";
|
public static final String format = "yyyy/MM/dd hh:mm:ss";
|
||||||
private volatile static ConsoleLog log;
|
private volatile static ConsoleLog log;
|
||||||
private final VBox textArea;
|
private final VBox textArea;
|
||||||
private final static String CONSOLE_COLOR_PREFIX = "^\033[";
|
private final static String CONSOLE_COLOR_PREFIX = "\033[";
|
||||||
private final static String CONSOLE_MSG_REX = "^\033\\[(\\d+)m(.*)\033\\[0m(.*)$";
|
private final static String CONSOLE_MSG_REX = "^\033\\[(\\d+)m(.*)\033\\[0m(.*)$";
|
||||||
private final static String URL_IP_REX = "^((ht|f)tps?:\\/\\/)?[\\w-+&@#/%?=~_|!:,.;]*[\\w-+&@#/%=~_|]+(:\\d{1,5})?\\/?$";
|
private final static String URL_IP_REX = "^((ht|f)tps?:\\/\\/)?[\\w-+&@#/%?=~_|!:,.;]*[\\w-+&@#/%=~_|]+(:\\d{1,5})?\\/?$";
|
||||||
|
|
||||||
@ -88,16 +89,6 @@ public class ConsoleLog {
|
|||||||
if (StringUtils.isEmpty(message) || !isInit()) return;
|
if (StringUtils.isEmpty(message) || !isInit()) return;
|
||||||
message = message.strip();
|
message = message.strip();
|
||||||
message = StrUtil.format(message, param);
|
message = StrUtil.format(message, param);
|
||||||
|
|
||||||
// 多颜色消息处理
|
|
||||||
if (StringUtils.countMatches(message, CONSOLE_COLOR_PREFIX) > 1) {
|
|
||||||
String[] split = message.replace(CONSOLE_MSG_REX, "\n%s".formatted(CONSOLE_COLOR_PREFIX)).split("\n");
|
|
||||||
List<String> msgs = Arrays.stream(split).toList();
|
|
||||||
for (String msg : msgs) {
|
|
||||||
msg(msg);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
message = setPwdText(message);
|
message = setPwdText(message);
|
||||||
message = resetConsoleColor(message);
|
message = resetConsoleColor(message);
|
||||||
|
|
||||||
@ -187,17 +178,35 @@ public class ConsoleLog {
|
|||||||
/**
|
/**
|
||||||
* 控制台输出颜色
|
* 控制台输出颜色
|
||||||
*
|
*
|
||||||
* @param msg alist 输出消息
|
* @param msg 输出消息
|
||||||
* @return bbcode 颜色文本
|
* @return bbcode 颜色文本
|
||||||
*/
|
*/
|
||||||
private static String resetConsoleColor(String msg) {
|
private static String resetConsoleColor(String msg) {
|
||||||
if (!msg.contains("\033[")) return msg;
|
if (!msg.contains(CONSOLE_COLOR_PREFIX) || !Pattern.matches(CONSOLE_MSG_REX, msg)) return msg;
|
||||||
|
|
||||||
String colorCode = ReUtil.get(CONSOLE_MSG_REX, msg, 1);
|
// 多颜色处理
|
||||||
String color = StringUtils.lowerCase(Color.valueOf(Integer.parseInt(colorCode)).getColor());
|
String[] split = Pattern.compile("\\033\\[(\\d;)?(\\d+)m")
|
||||||
String colorMsg = ReUtil.get(CONSOLE_MSG_REX, msg, 2);
|
.matcher(msg)
|
||||||
msg = ReUtil.get(CONSOLE_MSG_REX, msg, 3);
|
.replaceAll(matchResult -> "\n" + matchResult.group())
|
||||||
return color(color, colorMsg) + msg;
|
.replaceFirst("\n", "")
|
||||||
|
.split("\n");
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
Pattern pattern = Pattern.compile("\\033\\[(\\d;)?(\\d+)m(.*)");
|
||||||
|
Matcher matcher;
|
||||||
|
for (int i = 0; i < split.length; i++) {
|
||||||
|
matcher = pattern.matcher(split[i]);
|
||||||
|
if(!matcher.matches()) continue;
|
||||||
|
|
||||||
|
if (i % 2 == 0) {
|
||||||
|
String color = StringUtils.lowerCase(Color.valueOf(Integer.parseInt(matcher.group(2))).getColor());
|
||||||
|
sb.append(color(color, matcher.group(3)));
|
||||||
|
} else {
|
||||||
|
sb.append(matcher.group(3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
48
pom.xml
48
pom.xml
@ -141,4 +141,52 @@
|
|||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>nexus</id>
|
||||||
|
<name>nexus-snapshot-repository</name>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
<updatePolicy>always</updatePolicy>
|
||||||
|
</snapshots>
|
||||||
|
<releases>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</releases>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.13.0</version>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- https://github.com/HebiRobotics/sass-cli-maven-plugin -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>us.hebi.sass</groupId>
|
||||||
|
<artifactId>sass-cli-maven-plugin</artifactId>
|
||||||
|
<version>1.0.3</version>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-maven-plugin</artifactId>
|
||||||
|
<version>0.0.8</version>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- https://github.com/fvarrui/JavaPackager -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.github.fvarrui</groupId>
|
||||||
|
<artifactId>javapackager</artifactId>
|
||||||
|
<version>1.7.7-SNAPSHOT</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
@ -61,7 +61,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>21</source>
|
<source>21</source>
|
||||||
<target>21</target>
|
<target>21</target>
|
||||||
@ -79,7 +78,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-maven-plugin</artifactId>
|
<artifactId>javafx-maven-plugin</artifactId>
|
||||||
<version>0.0.8</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<stripDebug>true</stripDebug>
|
<stripDebug>true</stripDebug>
|
||||||
<compress>2</compress>
|
<compress>2</compress>
|
||||||
@ -112,7 +110,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.github.fvarrui</groupId>
|
<groupId>io.github.fvarrui</groupId>
|
||||||
<artifactId>javapackager</artifactId>
|
<artifactId>javapackager</artifactId>
|
||||||
<version>1.7.7-SNAPSHOT</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<mainClass>${exec.mainClass}</mainClass>
|
<mainClass>${exec.mainClass}</mainClass>
|
||||||
<bundleJre>true</bundleJre>
|
<bundleJre>true</bundleJre>
|
||||||
|
|||||||
Reference in New Issue
Block a user