[FEATURE] GuardLicense

This commit is contained in:
Gravit 2019-02-06 15:46:58 +07:00
parent 5dc07290eb
commit d7a2d0733f
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
4 changed files with 25 additions and 0 deletions

View file

@ -88,6 +88,7 @@ public static final class Config {
public ExeConf launch4j; public ExeConf launch4j;
public NettyConfig netty; public NettyConfig netty;
public GuardLicenseConf guardLicense;
public boolean compress; public boolean compress;
@ -185,6 +186,12 @@ public class NettyConfig
public String bindAddress; public String bindAddress;
public int port; public int port;
} }
public class GuardLicenseConf
{
public String name;
public String key;
public String encryptKey;
}
private final class ProfilesFileVisitor extends SimpleFileVisitor<Path> { private final class ProfilesFileVisitor extends SimpleFileVisitor<Path> {
private final Collection<ClientProfile> result; private final Collection<ClientProfile> result;

View file

@ -141,6 +141,19 @@ public void setWarningMissArchJava(boolean b) {
body.append(";"); body.append(";");
} }
public void setGuardLicense(String name, String key, String encryptKey)
{
body.append("this.guardLicenseName = \"");
body.append(name);
body.append("\";");
body.append("this.guardLicenseKey = \"");
body.append(key);
body.append("\";");
body.append("this.guardLicenseEncryptKey = \"");
body.append(encryptKey);
body.append("\";");
}
public ClassPool getPool() { public ClassPool getPool() {
return pool; return pool;
} }

View file

@ -132,6 +132,8 @@ public Path process(Path inputJar) throws IOException {
jaConfigurator.setPort(server.config.port); jaConfigurator.setPort(server.config.port);
if(server.config.netty != null) if(server.config.netty != null)
jaConfigurator.setNettyPort(server.config.netty.port); jaConfigurator.setNettyPort(server.config.netty.port);
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.setProjectName(server.config.projectName);
jaConfigurator.setSecretKey(SecurityHelper.randomStringAESKey()); jaConfigurator.setSecretKey(SecurityHelper.randomStringAESKey());
jaConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512)); jaConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512));

View file

@ -11,6 +11,9 @@ public class AutogenConfig {
public boolean isUsingWrapper; public boolean isUsingWrapper;
public boolean isDownloadJava; //Выставление этого флага требует модификации runtime части public boolean isDownloadJava; //Выставление этого флага требует модификации runtime части
public String secretKeyClient; public String secretKeyClient;
public String guardLicenseName;
public String guardLicenseKey;
public String guardLicenseEncryptKey;
public int env; public int env;
public boolean isWarningMissArchJava; public boolean isWarningMissArchJava;
// 0 - Dev (дебаг включен по умолчанию, все сообщения) // 0 - Dev (дебаг включен по умолчанию, все сообщения)