mirror of
https://github.com/octopusYan/alist-gui.git
synced 2024-11-21 11:46:43 +08:00
chore: 手动代理修改配置
This commit is contained in:
parent
17d21fdc03
commit
b468b9774d
@ -65,8 +65,14 @@ public class SetupViewModel extends BaseViewModel {
|
||||
proxySetup.addListener((_, _, newValue) -> ConfigManager.proxySetup(newValue));
|
||||
proxyTestUrl.addListener((_, _, newValue) -> ConfigManager.proxyTestUrl(newValue));
|
||||
proxyHost.addListener((_, _, newValue) -> ConfigManager.proxyHost(newValue));
|
||||
proxyPort.addListener((_, _, newValue) -> ConfigManager.proxyPort(newValue));
|
||||
language.addListener((_, _, newValue) -> Context.setLanguage(newValue));
|
||||
proxyHost.addListener((_, _, newValue) -> {
|
||||
ConfigManager.proxyHost(newValue);
|
||||
setProxy();
|
||||
});
|
||||
proxyPort.addListener((_, _, newValue) -> {
|
||||
ConfigManager.proxyPort(newValue);
|
||||
setProxy();
|
||||
});
|
||||
}
|
||||
|
||||
public ObjectProperty<Theme> themeProperty() {
|
||||
@ -123,6 +129,14 @@ public class SetupViewModel extends BaseViewModel {
|
||||
});
|
||||
}
|
||||
|
||||
private void setProxy() {
|
||||
ConfigManager.checkProxy((success, _) -> {
|
||||
if (!success) return;
|
||||
|
||||
HttpUtil.getInstance().proxy(ConfigManager.proxySetup(), ConfigManager.getProxyInfo());
|
||||
});
|
||||
}
|
||||
|
||||
private static ProxyCheckTask getProxyCheckTask(String checkUrl) {
|
||||
var task = new ProxyCheckTask(checkUrl);
|
||||
task.onListen(new TaskListener(task) {
|
||||
|
Loading…
Reference in New Issue
Block a user