[REFACTOR] Удалён костыль с сериализацией LauncherEnvironment.

This commit is contained in:
Zaxar163 2020-02-10 19:12:47 +01:00
parent 0e4502d38f
commit b57ad71539
No known key found for this signature in database
GPG key ID: 1FE4F2E1F053831B
2 changed files with 4 additions and 27 deletions

View file

@ -191,22 +191,7 @@ protected void initProps() {
properties.put("launcher.port", 32148 + SecurityHelper.newRandom().nextInt(512));
properties.put("launcher.guardType", server.config.launcher.guardType);
properties.put("launcher.isWarningMissArchJava", server.config.launcher.warningMissArchJava);
int cenv = -1;
switch (server.config.env) {
case DEV:
cenv = 0;
break;
case DEBUG:
cenv = 1;
break;
case STD:
cenv = 2;
break;
case PROD:
cenv = 3;
break;
}
properties.put("launchercore.env", cenv);
properties.put("launchercore.env", server.config.env);
properties.put("runtimeconfig.passwordEncryptKey", server.runtime.passwordEncryptKey);
String launcherSalt = SecurityHelper.randomStringToken();
byte[] launcherSecureHash = SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA256,

View file

@ -18,8 +18,6 @@
import java.util.*;
public final class LauncherConfig extends StreamObject {
@LauncherInject("launchercore.env")
private static final int cenv = -1;
@LauncherInject("launchercore.certificates")
private static final List<byte[]> secureConfigCertificates = null;
@LauncherInject("launcher.modules")
@ -42,6 +40,7 @@ public final class LauncherConfig extends StreamObject {
public final Map<String, byte[]> runtime;
@LauncherInject("launcher.isWarningMissArchJava")
public final boolean isWarningMissArchJava;
@LauncherInject("launchercore.env")
public LauncherEnvironment environment;
@LauncherInject("launcher.guardType")
public final String guardType;
@ -52,7 +51,6 @@ public final class LauncherConfig extends StreamObject {
@LauncherInject("runtimeconfig.passwordEncryptKey")
public final String passwordEncryptKey;
@SuppressWarnings("unused")
@LauncherInjectionConstructor
public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException {
publicKey = SecurityHelper.toPublicECKey(input.readByteArray(SecurityHelper.CRYPTO_MAX_LENGTH));
@ -72,14 +70,8 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
isWarningMissArchJava = false;
guardType = null;
address = null;
LauncherEnvironment env;
if (cenv == 0) env = LauncherEnvironment.DEV;
else if (cenv == 1) env = LauncherEnvironment.DEBUG;
else if (cenv == 2) env = LauncherEnvironment.STD;
else if (cenv == 3) env = LauncherEnvironment.PROD;
else env = LauncherEnvironment.STD;
Launcher.applyLauncherEnv(env);
environment = env;
environment = LauncherEnvironment.STD;
Launcher.applyLauncherEnv(environment);
// Read signed runtime
int count = input.readLength(0);
Map<String, byte[]> localResources = new HashMap<>(count);