修复新节点切换类型、复制服务名称有误的问题
This commit is contained in:
parent
9bd945f02b
commit
db9a3c2272
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>top.octopusyan</groupId>
|
||||
<artifactId>YanFrp</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.1.2</version>
|
||||
<name>YanFrp</name>
|
||||
|
||||
<properties>
|
||||
|
@ -263,7 +263,9 @@ public class MainController extends BaseController<StackPane> implements Initial
|
||||
proxySetupModel.proxyTypeProperty().addListener((observable, oldValue, newValue) -> {
|
||||
String newType = StringUtils.lowerCase(newValue);
|
||||
String port, host;
|
||||
if (!newType.equals(StringUtils.upperCase(userProxy.get(proxySetupModel.getId()).getProxy_type()))) {
|
||||
if (proxySetupModel.getId() == null ||
|
||||
!newType.equals(StringUtils.upperCase(userProxy.get(proxySetupModel.getId()).getProxy_type()))
|
||||
) {
|
||||
host = "127.0.0.1";
|
||||
port = ProxyConfig.getTypePort(newType).toString();
|
||||
} else {
|
||||
@ -321,7 +323,7 @@ public class MainController extends BaseController<StackPane> implements Initial
|
||||
p2pValid.add(TextValidate.p2pPwdRequired);
|
||||
p2pValid.add(TextValidate.p2pServerNameRequired);
|
||||
}
|
||||
|
||||
serverNameTextField.textProperty().set("提供者");
|
||||
domainTextField.getValidators().clear();
|
||||
} else {
|
||||
// tcp / udp
|
||||
@ -467,7 +469,7 @@ public class MainController extends BaseController<StackPane> implements Initial
|
||||
// 日志清理
|
||||
clearLogBtn.setOnMouseClicked(event -> {
|
||||
ProxySetup proxySetup = userProxy.get(proxySetupModel.getId());
|
||||
if (frpUtilMap.get(proxySetup.getId().toString()) != null)
|
||||
if (proxySetup != null && frpUtilMap.get(proxySetup.getId().toString()) != null)
|
||||
frpUtilMap.get(proxySetup.getId().toString()).clearLog();
|
||||
});
|
||||
|
||||
@ -543,7 +545,13 @@ public class MainController extends BaseController<StackPane> implements Initial
|
||||
return;
|
||||
|
||||
ProxySetup setup = proxySetupModel.get();
|
||||
setup.setServer_name(EncryptionUtil.MD5_16(ApplicatonStore.getAccount() + "_" + setup.getSort()));
|
||||
|
||||
String serverName = getAccount() + "_" + setup.getSort();
|
||||
setup.setServer_name(EncryptionUtil.MD5_16(serverName));
|
||||
setup.setId(null);
|
||||
setup.setRuning(false);
|
||||
setup.setSort(null);
|
||||
setup.setStatus(null);
|
||||
JSONObject json = JSON.parseObject(JSON.toJSONString(setup));
|
||||
|
||||
try {
|
||||
@ -565,7 +573,12 @@ public class MainController extends BaseController<StackPane> implements Initial
|
||||
clipData = clipData.replace(FrpManager.serverConfigHeader, "");
|
||||
String jsonStr = EncryptionUtil.DESdecode(clipData, EncryptionUtil.getDefaultPassword());
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
proxySetupModel.set(jsonObject.toJavaObject(ProxySetup.class));
|
||||
ProxySetup setup = jsonObject.toJavaObject(ProxySetup.class);
|
||||
setup.setId(proxySetupModel.getId() == null ? null : Integer.parseInt(proxySetupModel.getId()));
|
||||
setup.setSort(proxySetupModel.getSort());
|
||||
setup.setRuning(proxySetupModel.isRunning());
|
||||
setup.setStatus(proxySetupModel.getStatus());
|
||||
proxySetupModel.set(setup);
|
||||
AlertUtil.info("导入成功").show();
|
||||
} catch (Exception e) {
|
||||
AlertUtil.error("导入失败,请重新复制服务设置").show();
|
||||
|
@ -161,12 +161,12 @@ public class FrpManager {
|
||||
// 基础配置
|
||||
StringBuilder stringBuilder = new StringBuilder("[");
|
||||
// 服务名称
|
||||
StringBuilder serverName = new StringBuilder();
|
||||
StringBuilder serverName = new StringBuilder(ApplicatonStore.getAccount()+"_"+setup.getSort());
|
||||
// p2p 服务名
|
||||
if (isp2p) {
|
||||
if (setup.isProvider()) {
|
||||
// 提供者
|
||||
serverName.append(EncryptionUtil.MD5_16(serverName.toString()));
|
||||
serverName = new StringBuilder(EncryptionUtil.MD5_16(serverName.toString()));
|
||||
} else {
|
||||
// 访问者
|
||||
serverName.append(setup.getServerName()).append("_visitor");
|
||||
|
Loading…
Reference in New Issue
Block a user