mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[REFACTOR] Удалён костыль с сериализацией LauncherEnvironment.
This commit is contained in:
parent
0e4502d38f
commit
b57ad71539
2 changed files with 4 additions and 27 deletions
|
@ -191,22 +191,7 @@ protected void initProps() {
|
||||||
properties.put("launcher.port", 32148 + SecurityHelper.newRandom().nextInt(512));
|
properties.put("launcher.port", 32148 + SecurityHelper.newRandom().nextInt(512));
|
||||||
properties.put("launcher.guardType", server.config.launcher.guardType);
|
properties.put("launcher.guardType", server.config.launcher.guardType);
|
||||||
properties.put("launcher.isWarningMissArchJava", server.config.launcher.warningMissArchJava);
|
properties.put("launcher.isWarningMissArchJava", server.config.launcher.warningMissArchJava);
|
||||||
int cenv = -1;
|
properties.put("launchercore.env", server.config.env);
|
||||||
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("runtimeconfig.passwordEncryptKey", server.runtime.passwordEncryptKey);
|
properties.put("runtimeconfig.passwordEncryptKey", server.runtime.passwordEncryptKey);
|
||||||
String launcherSalt = SecurityHelper.randomStringToken();
|
String launcherSalt = SecurityHelper.randomStringToken();
|
||||||
byte[] launcherSecureHash = SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA256,
|
byte[] launcherSecureHash = SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA256,
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public final class LauncherConfig extends StreamObject {
|
public final class LauncherConfig extends StreamObject {
|
||||||
@LauncherInject("launchercore.env")
|
|
||||||
private static final int cenv = -1;
|
|
||||||
@LauncherInject("launchercore.certificates")
|
@LauncherInject("launchercore.certificates")
|
||||||
private static final List<byte[]> secureConfigCertificates = null;
|
private static final List<byte[]> secureConfigCertificates = null;
|
||||||
@LauncherInject("launcher.modules")
|
@LauncherInject("launcher.modules")
|
||||||
|
@ -42,6 +40,7 @@ public final class LauncherConfig extends StreamObject {
|
||||||
public final Map<String, byte[]> runtime;
|
public final Map<String, byte[]> runtime;
|
||||||
@LauncherInject("launcher.isWarningMissArchJava")
|
@LauncherInject("launcher.isWarningMissArchJava")
|
||||||
public final boolean isWarningMissArchJava;
|
public final boolean isWarningMissArchJava;
|
||||||
|
@LauncherInject("launchercore.env")
|
||||||
public LauncherEnvironment environment;
|
public LauncherEnvironment environment;
|
||||||
@LauncherInject("launcher.guardType")
|
@LauncherInject("launcher.guardType")
|
||||||
public final String guardType;
|
public final String guardType;
|
||||||
|
@ -52,7 +51,6 @@ public final class LauncherConfig extends StreamObject {
|
||||||
@LauncherInject("runtimeconfig.passwordEncryptKey")
|
@LauncherInject("runtimeconfig.passwordEncryptKey")
|
||||||
public final String passwordEncryptKey;
|
public final String passwordEncryptKey;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
@LauncherInjectionConstructor
|
@LauncherInjectionConstructor
|
||||||
public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException {
|
public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException {
|
||||||
publicKey = SecurityHelper.toPublicECKey(input.readByteArray(SecurityHelper.CRYPTO_MAX_LENGTH));
|
publicKey = SecurityHelper.toPublicECKey(input.readByteArray(SecurityHelper.CRYPTO_MAX_LENGTH));
|
||||||
|
@ -72,14 +70,8 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
||||||
isWarningMissArchJava = false;
|
isWarningMissArchJava = false;
|
||||||
guardType = null;
|
guardType = null;
|
||||||
address = null;
|
address = null;
|
||||||
LauncherEnvironment env;
|
environment = LauncherEnvironment.STD;
|
||||||
if (cenv == 0) env = LauncherEnvironment.DEV;
|
Launcher.applyLauncherEnv(environment);
|
||||||
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;
|
|
||||||
// Read signed runtime
|
// Read signed runtime
|
||||||
int count = input.readLength(0);
|
int count = input.readLength(0);
|
||||||
Map<String, byte[]> localResources = new HashMap<>(count);
|
Map<String, byte[]> localResources = new HashMap<>(count);
|
||||||
|
|
Loading…
Reference in a new issue