mirror of
https://github.com/octopusYan/alist-gui.git
synced 2024-11-22 03:56:42 +08:00
chore: 代理设置、删除依赖
This commit is contained in:
parent
f18ff10c92
commit
8588ad8c47
22
pom.xml
22
pom.xml
@ -122,7 +122,7 @@
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.kordamp.ikonli/ikonli-javafx -->
|
||||
<!-- https://kordamp.org/ikonli/ -->
|
||||
<dependency>
|
||||
<groupId>org.kordamp.ikonli</groupId>
|
||||
<artifactId>ikonli-javafx</artifactId>
|
||||
@ -133,11 +133,6 @@
|
||||
<artifactId>ikonli-fontawesome-pack</artifactId>
|
||||
<version>${ikonli.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kordamp.ikonli</groupId>
|
||||
<artifactId>ikonli-coreui-pack</artifactId>
|
||||
<version>${ikonli.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gluonhq</groupId>
|
||||
<artifactId>emoji</artifactId>
|
||||
@ -173,6 +168,7 @@
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
@ -192,6 +188,15 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<configuration>
|
||||
<argLine>--enable-preview</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
@ -247,8 +252,11 @@
|
||||
<!-- Default configuration for running with: mvn clean javafx:run -->
|
||||
<id>default-cli</id>
|
||||
<configuration>
|
||||
<mainClass>cn.octopusyan.alistgui/cn.octopusyan.alistgui.AppLauncher</mainClass>
|
||||
<launcher>launcher</launcher>
|
||||
<mainClass>cn.octopusyan.alistgui/cn.octopusyan.alistgui.AppLauncher</mainClass>
|
||||
<options>
|
||||
<option>--enable-preview</option>
|
||||
</options>
|
||||
<jlinkZipName>app</jlinkZipName>
|
||||
<jlinkImageName>app</jlinkImageName>
|
||||
<noManPages>true</noManPages>
|
||||
|
@ -20,6 +20,7 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.ProxySelector;
|
||||
import java.net.http.HttpClient;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Application extends javafx.application.Application {
|
||||
@ -36,18 +37,17 @@ public class Application extends javafx.application.Application {
|
||||
// http请求工具初始化
|
||||
HttpConfig httpConfig = new HttpConfig();
|
||||
// 加载代理设置
|
||||
if (!ProxySetup.NO_PROXY.equals(ConfigManager.proxySetup())) {
|
||||
// 系统代理
|
||||
if (ProxySetup.SYSTEM.equals(ConfigManager.proxySetup())) {
|
||||
httpConfig.setProxySelector(ProxySelector.getDefault());
|
||||
}
|
||||
// 自定义代理
|
||||
if (ProxySetup.MANUAL.equals(ConfigManager.proxySetup()) && ConfigManager.hasProxy()) {
|
||||
InetSocketAddress unresolved = InetSocketAddress.createUnresolved(
|
||||
Objects.requireNonNull(ConfigManager.proxyHost()),
|
||||
ConfigManager.getProxyPort()
|
||||
);
|
||||
httpConfig.setProxySelector(ProxySelector.of(unresolved));
|
||||
switch (ConfigManager.proxySetup()) {
|
||||
case NO_PROXY -> httpConfig.setProxySelector(HttpClient.Builder.NO_PROXY);
|
||||
case SYSTEM -> httpConfig.setProxySelector(ProxySelector.getDefault());
|
||||
case MANUAL -> {
|
||||
if(ConfigManager.hasProxy()) {
|
||||
InetSocketAddress unresolved = InetSocketAddress.createUnresolved(
|
||||
Objects.requireNonNull(ConfigManager.proxyHost()),
|
||||
ConfigManager.getProxyPort()
|
||||
);
|
||||
httpConfig.setProxySelector(ProxySelector.of(unresolved));
|
||||
}
|
||||
}
|
||||
}
|
||||
httpConfig.setConnectTimeout(10);
|
||||
|
Loading…
Reference in New Issue
Block a user