mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[ANY] Чистка LauncherConfig
This commit is contained in:
parent
176430e442
commit
b9761637db
7 changed files with 13 additions and 55 deletions
|
@ -195,7 +195,7 @@ public Path process(Path inputJar) throws IOException {
|
||||||
byte[] launcherConfigBytes;
|
byte[] launcherConfigBytes;
|
||||||
try (ByteArrayOutputStream configArray = IOHelper.newByteArrayOutput()) {
|
try (ByteArrayOutputStream configArray = IOHelper.newByteArrayOutput()) {
|
||||||
try (HOutput configOutput = new HOutput(configArray)) {
|
try (HOutput configOutput = new HOutput(configArray)) {
|
||||||
new LauncherConfig(server.config.netty.address, server.publicKey, runtime)
|
new LauncherConfig(server.config.netty.address, server.publicKey, runtime, server.config.projectName)
|
||||||
.write(configOutput);
|
.write(configOutput);
|
||||||
}
|
}
|
||||||
launcherConfigBytes = configArray.toByteArray();
|
launcherConfigBytes = configArray.toByteArray();
|
||||||
|
|
|
@ -33,7 +33,7 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
|
||||||
LauncherEngine.modulesManager = new ClientModuleManager();
|
LauncherEngine.modulesManager = new ClientModuleManager();
|
||||||
LauncherConfig.getAutogenConfig().initModules();
|
LauncherConfig.getAutogenConfig().initModules();
|
||||||
|
|
||||||
LogHelper.info("Launcher for project %s", config.projectname);
|
LogHelper.info("Launcher for project %s", config.projectName);
|
||||||
if (config.environment.equals(LauncherConfig.LauncherEnvironment.PROD)) {
|
if (config.environment.equals(LauncherConfig.LauncherEnvironment.PROD)) {
|
||||||
if (System.getProperty(LogHelper.DEBUG_PROPERTY) != null) {
|
if (System.getProperty(LogHelper.DEBUG_PROPERTY) != null) {
|
||||||
LogHelper.warning("Found -Dlauncher.debug=true");
|
LogHelper.warning("Found -Dlauncher.debug=true");
|
||||||
|
|
|
@ -102,7 +102,7 @@ public static void setUseLegacyDir(boolean b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
String projectName = Launcher.getConfig().projectname;
|
String projectName = Launcher.getConfig().projectName;
|
||||||
try {
|
try {
|
||||||
DirBridge.dir = getLauncherDir(projectName);
|
DirBridge.dir = getLauncherDir(projectName);
|
||||||
if (!IOHelper.exists(DirBridge.dir)) Files.createDirectories(DirBridge.dir);
|
if (!IOHelper.exists(DirBridge.dir)) Files.createDirectories(DirBridge.dir);
|
||||||
|
|
|
@ -29,7 +29,7 @@ public String getName() {
|
||||||
public Path getJavaBinPath() {
|
public Path getJavaBinPath() {
|
||||||
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) {
|
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) {
|
||||||
javaBinPath = ClientLauncher.getJavaBinPath();
|
javaBinPath = ClientLauncher.getJavaBinPath();
|
||||||
String projectName = Launcher.getConfig().projectname;
|
String projectName = Launcher.getConfig().projectName;
|
||||||
String wrapperUnpackName = (javaBinPath == null ? JVMHelper.JVM_BITS : JVMHelper.OS_BITS) == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe");
|
String wrapperUnpackName = (javaBinPath == null ? JVMHelper.JVM_BITS : JVMHelper.OS_BITS) == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe");
|
||||||
return DirBridge.getGuardDir().resolve(wrapperUnpackName);
|
return DirBridge.getGuardDir().resolve(wrapperUnpackName);
|
||||||
} else
|
} else
|
||||||
|
@ -48,7 +48,7 @@ public int getClientJVMBits() {
|
||||||
@Override
|
@Override
|
||||||
public void init(boolean clientInstance) {
|
public void init(boolean clientInstance) {
|
||||||
try {
|
try {
|
||||||
String projectName = Launcher.getConfig().projectname;
|
String projectName = Launcher.getConfig().projectName;
|
||||||
UnpackHelper.unpack(Launcher.getResourceURL("wrapper64.exe", "guard"), DirBridge.getGuardDir().resolve(projectName.concat("64.exe")));
|
UnpackHelper.unpack(Launcher.getResourceURL("wrapper64.exe", "guard"), DirBridge.getGuardDir().resolve(projectName.concat("64.exe")));
|
||||||
UnpackHelper.unpack(Launcher.getResourceURL("AntiInject64.dll", "guard"), DirBridge.getGuardDir().resolve("AntiInject64.dll"));
|
UnpackHelper.unpack(Launcher.getResourceURL("AntiInject64.dll", "guard"), DirBridge.getGuardDir().resolve("AntiInject64.dll"));
|
||||||
|
|
||||||
|
@ -73,14 +73,9 @@ public void addCustomEnv(ClientLauncherContext context) {
|
||||||
env.put("JAVA_HOME", javaBinPath.toAbsolutePath().toString());
|
env.put("JAVA_HOME", javaBinPath.toAbsolutePath().toString());
|
||||||
LauncherConfig config = Launcher.getConfig();
|
LauncherConfig config = Launcher.getConfig();
|
||||||
env.put("GUARD_USERNAME", context.playerProfile.username);
|
env.put("GUARD_USERNAME", context.playerProfile.username);
|
||||||
env.put("GUARD_PROJECTNAME", config.projectname);
|
env.put("GUARD_PROJECTNAME", config.projectName);
|
||||||
if (protectToken != null)
|
if (protectToken != null)
|
||||||
env.put("GUARD_TOKEN", protectToken);
|
env.put("GUARD_TOKEN", protectToken);
|
||||||
if (config.guardLicenseName != null)
|
|
||||||
env.put("GUARD_LICENSE_NAME", config.guardLicenseName);
|
|
||||||
if (config.guardLicenseKey != null) {
|
|
||||||
env.put("GUARD_LICENSE_KEY", config.guardLicenseKey);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,7 +26,7 @@ public String getName() {
|
||||||
@Override
|
@Override
|
||||||
public Path getJavaBinPath() {
|
public Path getJavaBinPath() {
|
||||||
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) {
|
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) {
|
||||||
String projectName = Launcher.getConfig().projectname;
|
String projectName = Launcher.getConfig().projectName;
|
||||||
String wrapperUnpackName = JVMHelper.JVM_BITS == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe");
|
String wrapperUnpackName = JVMHelper.JVM_BITS == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe");
|
||||||
return DirBridge.getGuardDir().resolve(wrapperUnpackName);
|
return DirBridge.getGuardDir().resolve(wrapperUnpackName);
|
||||||
} else
|
} else
|
||||||
|
@ -42,7 +42,7 @@ public int getClientJVMBits() {
|
||||||
public void init(boolean clientInstance) {
|
public void init(boolean clientInstance) {
|
||||||
try {
|
try {
|
||||||
String wrapperName = JVMHelper.JVM_BITS == 64 ? "wrapper64.exe" : "wrapper32.exe";
|
String wrapperName = JVMHelper.JVM_BITS == 64 ? "wrapper64.exe" : "wrapper32.exe";
|
||||||
String projectName = Launcher.getConfig().projectname;
|
String projectName = Launcher.getConfig().projectName;
|
||||||
String wrapperUnpackName = JVMHelper.JVM_BITS == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe");
|
String wrapperUnpackName = JVMHelper.JVM_BITS == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe");
|
||||||
String antiInjectName = JVMHelper.JVM_BITS == 64 ? "AntiInject64.dll" : "AntiInject32.dll";
|
String antiInjectName = JVMHelper.JVM_BITS == 64 ? "AntiInject64.dll" : "AntiInject32.dll";
|
||||||
UnpackHelper.unpack(Launcher.getResourceURL(wrapperName, "guard"), DirBridge.getGuardDir().resolve(wrapperUnpackName));
|
UnpackHelper.unpack(Launcher.getResourceURL(wrapperName, "guard"), DirBridge.getGuardDir().resolve(wrapperUnpackName));
|
||||||
|
@ -63,14 +63,9 @@ public void addCustomEnv(ClientLauncherContext context) {
|
||||||
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_USERNAME", context.playerProfile.username);
|
||||||
env.put("GUARD_PROJECTNAME", config.projectname);
|
env.put("GUARD_PROJECTNAME", config.projectName);
|
||||||
if (protectToken != null)
|
if (protectToken != null)
|
||||||
env.put("GUARD_TOKEN", protectToken);
|
env.put("GUARD_TOKEN", protectToken);
|
||||||
if (config.guardLicenseName != null)
|
|
||||||
env.put("GUARD_LICENSE_NAME", config.guardLicenseName);
|
|
||||||
if (config.guardLicenseKey != null) {
|
|
||||||
env.put("GUARD_LICENSE_KEY", config.guardLicenseKey);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,9 +7,6 @@ public class AutogenConfig {
|
||||||
public String guardType;
|
public String guardType;
|
||||||
public String secretKeyClient;
|
public String secretKeyClient;
|
||||||
public String oemUnlockKey;
|
public String oemUnlockKey;
|
||||||
public String guardLicenseName;
|
|
||||||
public String guardLicenseKey;
|
|
||||||
public String guardLicenseEncryptKey;
|
|
||||||
public String secureCheckHash;
|
public String secureCheckHash;
|
||||||
public String secureCheckSalt;
|
public String secureCheckSalt;
|
||||||
public String passwordEncryptKey;
|
public String passwordEncryptKey;
|
||||||
|
|
|
@ -25,7 +25,7 @@ public static AutogenConfig getAutogenConfig() {
|
||||||
// Instance
|
// Instance
|
||||||
public String address;
|
public String address;
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public final String projectname;
|
public final String projectName;
|
||||||
public final int clientPort;
|
public final int clientPort;
|
||||||
public String secretKeyClient;
|
public String secretKeyClient;
|
||||||
public String oemUnlockKey;
|
public String oemUnlockKey;
|
||||||
|
@ -39,9 +39,6 @@ public static AutogenConfig getAutogenConfig() {
|
||||||
public boolean isNettyEnabled;
|
public boolean isNettyEnabled;
|
||||||
public LauncherEnvironment environment;
|
public LauncherEnvironment environment;
|
||||||
|
|
||||||
public final String guardLicenseName;
|
|
||||||
public final String guardLicenseKey;
|
|
||||||
public final String guardLicenseEncryptKey;
|
|
||||||
public final String guardType;
|
public final String guardType;
|
||||||
|
|
||||||
public final String secureCheckHash;
|
public final String secureCheckHash;
|
||||||
|
@ -54,7 +51,7 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
||||||
secureCheckHash = config.secureCheckHash;
|
secureCheckHash = config.secureCheckHash;
|
||||||
secureCheckSalt = config.secureCheckSalt;
|
secureCheckSalt = config.secureCheckSalt;
|
||||||
passwordEncryptKey = config.passwordEncryptKey;
|
passwordEncryptKey = config.passwordEncryptKey;
|
||||||
projectname = config.projectname;
|
projectName = config.projectname;
|
||||||
clientPort = config.clientPort;
|
clientPort = config.clientPort;
|
||||||
secretKeyClient = config.secretKeyClient;
|
secretKeyClient = config.secretKeyClient;
|
||||||
oemUnlockKey = config.oemUnlockKey;
|
oemUnlockKey = config.oemUnlockKey;
|
||||||
|
@ -65,10 +62,7 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
||||||
}
|
}
|
||||||
|
|
||||||
isWarningMissArchJava = config.isWarningMissArchJava;
|
isWarningMissArchJava = config.isWarningMissArchJava;
|
||||||
guardLicenseEncryptKey = config.guardLicenseEncryptKey;
|
|
||||||
guardLicenseKey = config.guardLicenseKey;
|
|
||||||
guardType = config.guardType;
|
guardType = config.guardType;
|
||||||
guardLicenseName = config.guardLicenseName;
|
|
||||||
address = config.address;
|
address = config.address;
|
||||||
LauncherEnvironment env;
|
LauncherEnvironment env;
|
||||||
if (config.env == 0) env = LauncherEnvironment.DEV;
|
if (config.env == 0) env = LauncherEnvironment.DEV;
|
||||||
|
@ -91,34 +85,11 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public LauncherConfig(String address, ECPublicKey publicKey, Map<String, byte[]> runtime, String projectname) {
|
public LauncherConfig(String address, ECPublicKey publicKey, Map<String, byte[]> runtime, String projectName) {
|
||||||
this.address = address;
|
this.address = address;
|
||||||
this.publicKey = Objects.requireNonNull(publicKey, "publicKey");
|
this.publicKey = Objects.requireNonNull(publicKey, "publicKey");
|
||||||
this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime));
|
this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime));
|
||||||
this.projectname = projectname;
|
this.projectName = projectName;
|
||||||
this.clientPort = 32148;
|
|
||||||
this.guardLicenseName = "FREE";
|
|
||||||
this.guardLicenseKey = "AAAA-BBBB-CCCC-DDDD";
|
|
||||||
this.guardLicenseEncryptKey = "12345";
|
|
||||||
guardType = "no";
|
|
||||||
isWarningMissArchJava = true;
|
|
||||||
isNettyEnabled = false;
|
|
||||||
environment = LauncherEnvironment.STD;
|
|
||||||
secureCheckSalt = null;
|
|
||||||
secureCheckHash = null;
|
|
||||||
passwordEncryptKey = null;
|
|
||||||
trustManager = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public LauncherConfig(String address, ECPublicKey publicKey, Map<String, byte[]> runtime) {
|
|
||||||
this.address = address;
|
|
||||||
this.publicKey = Objects.requireNonNull(publicKey, "publicKey");
|
|
||||||
this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime));
|
|
||||||
this.projectname = "Minecraft";
|
|
||||||
this.guardLicenseName = "FREE";
|
|
||||||
this.guardLicenseKey = "AAAA-BBBB-CCCC-DDDD";
|
|
||||||
this.guardLicenseEncryptKey = "12345";
|
|
||||||
this.clientPort = 32148;
|
this.clientPort = 32148;
|
||||||
guardType = "no";
|
guardType = "no";
|
||||||
isWarningMissArchJava = true;
|
isWarningMissArchJava = true;
|
||||||
|
|
Loading…
Reference in a new issue