From 2fa638d3c6e9d83e00f523bf76c9a4c6ed8db875 Mon Sep 17 00:00:00 2001 From: Gravit Date: Wed, 20 Feb 2019 17:20:00 +0700 Subject: [PATCH] [FEATURE] nettyAddress --- .../main/java/ru/gravit/launchserver/LaunchServer.java | 1 + .../ru/gravit/launchserver/binary/JAConfigurator.java | 10 ++++++++++ .../launchserver/binary/tasks/MainBuildTask.java | 5 +++++ .../main/java/ru/gravit/launcher/AutogenConfig.java | 2 ++ 4 files changed, 18 insertions(+) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index b0988ecb..717aac3f 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -188,6 +188,7 @@ public class NettyConfig public boolean clientEnabled; public String launcherURL; public String launcherEXEURL; + public String address; } public class GuardLicenseConf { diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JAConfigurator.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JAConfigurator.java index 70d40735..d6d683c0 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JAConfigurator.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JAConfigurator.java @@ -70,6 +70,11 @@ public void setAddress(String address) { body.append(address); body.append("\";"); } + public void setNettyAddress(String address) { + body.append("this.nettyAddress = \""); + body.append(address); + body.append("\";"); + } public void setProjectName(String name) { body.append("this.projectname = \""); @@ -134,6 +139,11 @@ public void setDownloadJava(boolean b) { body.append(b ? "true" : "false"); body.append(";"); } + public void setNettyEnabled(boolean b) { + body.append("this.isNettyEnabled = "); + body.append(b ? "true" : "false"); + body.append(";"); + } public void setWarningMissArchJava(boolean b) { body.append("this.isWarningMissArchJava = "); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java index 19004884..7c152f26 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java @@ -130,14 +130,19 @@ public Path process(Path inputJar) throws IOException { server.buildHookManager.hook(context); jaConfigurator.setAddress(server.config.getAddress()); jaConfigurator.setPort(server.config.port); + jaConfigurator.setNettyEnabled(server.config.netty.clientEnabled); if(server.config.netty.clientEnabled) + { jaConfigurator.setNettyPort(server.config.netty.port); + jaConfigurator.setNettyAddress(server.config.netty.address); + } if(server.config.guardLicense != null) jaConfigurator.setGuardLicense(server.config.guardLicense.name, server.config.guardLicense.key, server.config.guardLicense.encryptKey); jaConfigurator.setProjectName(server.config.projectName); jaConfigurator.setSecretKey(SecurityHelper.randomStringAESKey()); jaConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512)); jaConfigurator.setUsingWrapper(server.config.isUsingWrapper); + jaConfigurator.setWarningMissArchJava(server.config.isWarningMissArchJava); jaConfigurator.setDownloadJava(server.config.isDownloadJava); jaConfigurator.setEnv(server.config.env); server.buildHookManager.registerAllClientModuleClass(jaConfigurator); diff --git a/libLauncher/src/main/java/ru/gravit/launcher/AutogenConfig.java b/libLauncher/src/main/java/ru/gravit/launcher/AutogenConfig.java index 1845aaf5..508333fa 100644 --- a/libLauncher/src/main/java/ru/gravit/launcher/AutogenConfig.java +++ b/libLauncher/src/main/java/ru/gravit/launcher/AutogenConfig.java @@ -3,6 +3,7 @@ public class AutogenConfig { public String projectname; public String address; + public String nettyAddress; public int port; public int nettyPort; public int clientPort; @@ -10,6 +11,7 @@ public class AutogenConfig { private boolean isInitModules; public boolean isUsingWrapper; public boolean isDownloadJava; //Выставление этого флага требует модификации runtime части + public boolean isNettyEnabled; public String secretKeyClient; public String guardLicenseName; public String guardLicenseKey;