[FEATURE] Новые параметры в GuardLicense

This commit is contained in:
Gravit 2019-02-06 16:21:17 +07:00
parent 2c8f3d4f5b
commit 4c6360b8af
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
3 changed files with 13 additions and 7 deletions

View file

@ -336,6 +336,9 @@ public static Process launch(
checkJVMBitsAndVersion(); checkJVMBitsAndVersion();
LogHelper.debug("Resolving JVM binary"); LogHelper.debug("Resolving JVM binary");
Path javaBin = LauncherGuardManager.getGuardJavaBinPath(); Path javaBin = LauncherGuardManager.getGuardJavaBinPath();
context.javaBin = javaBin;
context.clientProfile = profile;
context.playerProfile = params.pp;
context.args.add(javaBin.toString()); context.args.add(javaBin.toString());
context.args.add(MAGICAL_INTEL_OPTION); context.args.add(MAGICAL_INTEL_OPTION);
if (params.ram > 0 && params.ram <= JVMHelper.RAM) { if (params.ram > 0 && params.ram <= JVMHelper.RAM) {

View file

@ -1,5 +1,8 @@
package ru.gravit.launcher.client; package ru.gravit.launcher.client;
import ru.gravit.launcher.profiles.ClientProfile;
import ru.gravit.launcher.profiles.PlayerProfile;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -9,4 +12,6 @@ public class ClientLauncherContext {
public List<String> args = new LinkedList<>(); public List<String> args = new LinkedList<>();
public String pathLauncher; public String pathLauncher;
public ProcessBuilder builder; public ProcessBuilder builder;
public ClientProfile clientProfile;
public PlayerProfile playerProfile;
} }

View file

@ -56,16 +56,14 @@ public void addCustomEnv(ClientLauncherContext context) {
Map<String,String> env = context.builder.environment(); Map<String,String> env = context.builder.environment();
env.put("JAVA_HOME", System.getProperty("java.home")); env.put("JAVA_HOME", System.getProperty("java.home"));
LauncherConfig config = Launcher.getConfig(); LauncherConfig config = Launcher.getConfig();
env.put("GUARD_USERNAME", context.playerProfile.username);
env.put("GUARD_PUBLICKEY", config.publicKey.getModulus().toString(16));
env.put("GUARD_PROJECTNAME", config.projectname);
if(config.guardLicenseName != null) if(config.guardLicenseName != null)
env.put("GUARD_LICENSE_NAME", config.guardLicenseName); env.put("GUARD_LICENSE_NAME", config.guardLicenseName);
if(config.guardLicenseKey != null && config.guardLicenseEncryptKey != null) if(config.guardLicenseKey != null)
{ {
try { env.put("GUARD_LICENSE_KEY", config.guardLicenseKey);
byte[] encrypt = SecurityHelper.encrypt(config.guardLicenseEncryptKey,config.guardLicenseKey);
env.put("GUARD_LICENSE_NAME", Base64.getEncoder().encodeToString(encrypt));
} catch (Exception e) {
LogHelper.error(e);
}
} }
} }
} }