mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FEATURE] Переход на новую систему props часть 1 (будет ещё часть 2).
This commit is contained in:
parent
002477445c
commit
554ca54c4a
12 changed files with 69 additions and 278 deletions
|
@ -1,84 +0,0 @@
|
|||
package pro.gravit.launchserver.asm;
|
||||
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.*;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigGenerator {
|
||||
protected static final String stringDesc = Type.getDescriptor(String.class);
|
||||
protected static final String byteArrDesc = Type.getDescriptor(byte[].class);
|
||||
protected static final String base64DecDesc = "(" + stringDesc + ")" + byteArrDesc;
|
||||
protected final ClassNode configclass;
|
||||
protected final MethodNode constructor;
|
||||
|
||||
public ConfigGenerator(ClassNode configclass) {
|
||||
this.configclass = configclass;
|
||||
constructor = this.configclass.methods.stream().filter(e -> "<init>".equals(e.name)).findFirst().get();
|
||||
constructor.instructions = new InsnList();
|
||||
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
constructor.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, Type.getInternalName(Object.class), "<init>", "()V"));
|
||||
}
|
||||
|
||||
public byte[] getBytecode(ClassMetadataReader reader) {
|
||||
constructor.instructions.add(new InsnNode(Opcodes.RETURN));
|
||||
ClassWriter cw = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES);
|
||||
configclass.accept(cw);
|
||||
return cw.toByteArray();
|
||||
}
|
||||
|
||||
public String getZipEntryPath() {
|
||||
return configclass.name.concat(".class");
|
||||
}
|
||||
|
||||
public void setStringField(String name, String value) {
|
||||
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
constructor.instructions.add(NodeUtils.getSafeStringInsnList(value));
|
||||
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, configclass.name, name, stringDesc));
|
||||
}
|
||||
|
||||
public void setByteArrayField(String name, byte[] value) {
|
||||
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
constructor.instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/util/Base64", "getDecoder", "()Ljava/util/Base64$Decoder;", false));
|
||||
constructor.instructions.add(NodeUtils.getSafeStringInsnList(Base64.getEncoder().encodeToString(value)));
|
||||
constructor.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "java/util/Base64$Decoder", "decode", base64DecDesc, false));
|
||||
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, configclass.name, name, stringDesc));
|
||||
}
|
||||
|
||||
public void setByteArrayListField(String name, List<byte[]> b) {
|
||||
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
constructor.instructions.add(new TypeInsnNode(Opcodes.NEW, "java/util/ArrayList"));
|
||||
constructor.instructions.add(new InsnNode(Opcodes.DUP)); // +1
|
||||
constructor.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "java/util/ArrayList", "<init>", "()V"));
|
||||
for (byte[] value : b) {
|
||||
constructor.instructions.add(new InsnNode(Opcodes.DUP)); // +1-1
|
||||
constructor.instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/util/Base64", "getDecoder", "()Ljava/util/Base64$Decoder;", false));
|
||||
constructor.instructions.add(NodeUtils.getSafeStringInsnList(Base64.getEncoder().encodeToString(value)));
|
||||
constructor.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "java/util/Base64$Decoder", "decode", base64DecDesc, false));
|
||||
constructor.instructions.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, "java/util/List", "add", "(Ljava/lang/Object;)Z", true));
|
||||
constructor.instructions.add(new InsnNode(Opcodes.POP));
|
||||
}
|
||||
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, configclass.name, name, "Ljava/util/List;"));
|
||||
}
|
||||
|
||||
public void setIntegerField(String name, int value) {
|
||||
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
constructor.instructions.add(NodeUtils.push(value));
|
||||
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, configclass.name, name, Type.INT_TYPE.getInternalName()));
|
||||
}
|
||||
|
||||
public void setLongField(String name, long value) {
|
||||
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
constructor.instructions.add(new LdcInsnNode(value));
|
||||
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, configclass.name, name, Type.INT_TYPE.getInternalName()));
|
||||
}
|
||||
|
||||
public void setBooleanField(String name, boolean b) {
|
||||
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
constructor.instructions.add(new InsnNode(b ? Opcodes.ICONST_1 : Opcodes.ICONST_0));
|
||||
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, configclass.name, name, Type.BOOLEAN_TYPE.getInternalName()));
|
||||
}
|
||||
}
|
|
@ -123,6 +123,11 @@ public void visit(final String name, final Object value) {
|
|||
serializers.put(byte[].class, new ByteArraySerializer());
|
||||
serializers.put(Short.class, serializerClass(Opcodes.I2S));
|
||||
serializers.put(Byte.class, serializerClass(Opcodes.I2B));
|
||||
serializers.put(Type.class, (Serializer<Type>) e -> { // ow.Type == java.lang.Class in LDC
|
||||
InsnList ret = new InsnList();
|
||||
ret.add(new LdcInsnNode(e));
|
||||
return ret;
|
||||
});
|
||||
serializers.put(Boolean.class, (Serializer<Boolean>) e -> {
|
||||
InsnList ret = new InsnList();
|
||||
ret.add(new InsnNode(e ? Opcodes.ICONST_1 : Opcodes.ICONST_0));
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
public class BuildContext {
|
||||
public final ZipOutputStream output;
|
||||
public final LauncherConfigurator config;
|
||||
public final List<JarFile> readerClassPath;
|
||||
public final MainBuildTask task;
|
||||
public final HashSet<String> fileList;
|
||||
|
@ -78,9 +77,8 @@ private ZipEntry newEntry(String fileName) {
|
|||
}
|
||||
|
||||
|
||||
public BuildContext(ZipOutputStream output, LauncherConfigurator config, List<JarFile> readerClassPath, MainBuildTask task) {
|
||||
public BuildContext(ZipOutputStream output, List<JarFile> readerClassPath, MainBuildTask task) {
|
||||
this.output = output;
|
||||
this.config = config;
|
||||
this.readerClassPath = readerClassPath;
|
||||
this.task = task;
|
||||
fileList = new HashSet<>(1024);
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
package pro.gravit.launchserver.binary;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.*;
|
||||
import pro.gravit.launcher.LauncherConfig;
|
||||
import pro.gravit.launcher.modules.LauncherModule;
|
||||
import pro.gravit.launchserver.asm.ClassMetadataReader;
|
||||
import pro.gravit.launchserver.asm.ConfigGenerator;
|
||||
|
||||
public class LauncherConfigurator extends ConfigGenerator {
|
||||
private static final String modulesManagerName = "pro/gravit/launcher/modules/LauncherModulesManager";
|
||||
private static final String launcherName = "pro/gravit/launcher/LauncherEngine";
|
||||
private static final String modulesManagerDesc = "Lpro/gravit/launcher/client/ClientModuleManager;";
|
||||
private static final String registerModDesc = Type.getMethodDescriptor(Type.getType(LauncherModule.class), Type.getType(LauncherModule.class));
|
||||
private final MethodNode initModuleMethod;
|
||||
|
||||
public LauncherConfigurator(ClassNode configclass) {
|
||||
super(configclass);
|
||||
initModuleMethod = configclass.methods.stream().filter(e -> "initModules".equals(e.name)).findFirst().get();
|
||||
initModuleMethod.instructions = new InsnList();
|
||||
}
|
||||
|
||||
public void addModuleClass(String fullName) {
|
||||
initModuleMethod.instructions.add(new FieldInsnNode(Opcodes.GETSTATIC, launcherName, "modulesManager", modulesManagerDesc));
|
||||
initModuleMethod.instructions.add(new TypeInsnNode(Opcodes.NEW, fullName.replace('.', '/')));
|
||||
initModuleMethod.instructions.add(new InsnNode(Opcodes.DUP));
|
||||
initModuleMethod.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, fullName.replace('.', '/'), "<init>", "()V"));
|
||||
initModuleMethod.instructions.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, modulesManagerName, "loadModule", registerModDesc));
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytecode(ClassMetadataReader reader) {
|
||||
initModuleMethod.instructions.add(new InsnNode(Opcodes.RETURN));
|
||||
return super.getBytecode(reader);
|
||||
}
|
||||
|
||||
public void setEnv(LauncherConfig.LauncherEnvironment env) {
|
||||
int i = 2;
|
||||
switch (env) {
|
||||
case DEV:
|
||||
i = 0;
|
||||
break;
|
||||
case DEBUG:
|
||||
i = 1;
|
||||
break;
|
||||
case STD:
|
||||
i = 2;
|
||||
break;
|
||||
case PROD:
|
||||
i = 3;
|
||||
break;
|
||||
}
|
||||
setIntegerField("env", i);
|
||||
}
|
||||
}
|
|
@ -5,17 +5,13 @@
|
|||
import org.objectweb.asm.tree.AnnotationNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import pro.gravit.launcher.AutogenConfig;
|
||||
import pro.gravit.launcher.Launcher;
|
||||
import pro.gravit.launcher.LauncherConfig;
|
||||
import pro.gravit.launcher.SecureAutogenConfig;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.asm.ClassMetadataReader;
|
||||
import pro.gravit.launchserver.asm.ConfigGenerator;
|
||||
import pro.gravit.launchserver.asm.InjectClassAcceptor;
|
||||
import pro.gravit.launchserver.asm.SafeClassWriter;
|
||||
import pro.gravit.launchserver.binary.BuildContext;
|
||||
import pro.gravit.launchserver.binary.LauncherConfigurator;
|
||||
import pro.gravit.utils.HookException;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.JarHelper;
|
||||
|
@ -137,22 +133,17 @@ public String getName() {
|
|||
public Path process(Path inputJar) throws IOException {
|
||||
Path outputJar = server.launcherBinary.nextPath("main");
|
||||
try (ZipOutputStream output = new ZipOutputStream(IOHelper.newOutput(outputJar))) {
|
||||
ClassNode cn = new ClassNode();
|
||||
new ClassReader(JarHelper.getClassBytes(AutogenConfig.class)).accept(cn, 0);
|
||||
LauncherConfigurator launcherConfigurator = new LauncherConfigurator(cn);
|
||||
ClassNode cn1 = new ClassNode();
|
||||
new ClassReader(JarHelper.getClassBytes(SecureAutogenConfig.class)).accept(cn1, 0);
|
||||
ConfigGenerator secureConfigurator = new ConfigGenerator(cn1);
|
||||
BuildContext context = new BuildContext(output, launcherConfigurator, reader.getCp(), this);
|
||||
BuildContext context = new BuildContext(output, reader.getCp(), this);
|
||||
preBuildHook.hook(context);
|
||||
launcherConfigurator.setStringField("address", server.config.netty.address);
|
||||
launcherConfigurator.setStringField("projectname", server.config.projectName);
|
||||
launcherConfigurator.setStringField("secretKeyClient", SecurityHelper.randomStringAESKey());
|
||||
launcherConfigurator.setIntegerField("clientPort", 32148 + SecurityHelper.newRandom().nextInt(512));
|
||||
launcherConfigurator.setStringField("guardType", server.config.launcher.guardType);
|
||||
launcherConfigurator.setBooleanField("isWarningMissArchJava", server.config.launcher.warningMissArchJava);
|
||||
launcherConfigurator.setEnv(server.config.env);
|
||||
launcherConfigurator.setStringField("passwordEncryptKey", server.runtime.passwordEncryptKey);
|
||||
properties.clear();
|
||||
properties.put("launcher.address", server.config.netty.address);
|
||||
properties.put("launcher.projectName", server.config.projectName);
|
||||
properties.put("runtimeconfig.secretKeyClient", SecurityHelper.randomStringAESKey());
|
||||
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);
|
||||
properties.put("launchercore.env" ,server.config.env);
|
||||
properties.put("runtimeconfig.passwordEncryptKey", server.runtime.passwordEncryptKey);
|
||||
List<byte[]> certificates = Arrays.stream(server.certificateManager.trustManager.getTrusted()).map(e -> {
|
||||
try {
|
||||
return e.getEncoded();
|
||||
|
@ -170,15 +161,15 @@ public Path process(Path inputJar) throws IOException {
|
|||
throw new InternalError(e);
|
||||
}
|
||||
}
|
||||
secureConfigurator.setByteArrayListField("certificates", certificates);
|
||||
properties.put("launchercore.certificates", certificates);
|
||||
String launcherSalt = SecurityHelper.randomStringToken();
|
||||
byte[] launcherSecureHash = SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA256,
|
||||
server.runtime.clientCheckSecret.concat(".").concat(launcherSalt));
|
||||
launcherConfigurator.setStringField("secureCheckHash", Base64.getEncoder().encodeToString(launcherSecureHash));
|
||||
launcherConfigurator.setStringField("secureCheckSalt", launcherSalt);
|
||||
properties.put("runtimeconfig.secureCheckHash", Base64.getEncoder().encodeToString(launcherSecureHash));
|
||||
properties.put("runtimeconfig.secureCheckSalt", launcherSalt);
|
||||
//LogHelper.debug("[checkSecure] %s: %s", launcherSalt, Arrays.toString(launcherSecureHash));
|
||||
if (server.runtime.oemUnlockKey == null) server.runtime.oemUnlockKey = SecurityHelper.randomStringToken();
|
||||
launcherConfigurator.setStringField("oemUnlockKey", server.runtime.oemUnlockKey);
|
||||
properties.put("runtimeconfig.oemUnlockKey", server.runtime.oemUnlockKey);
|
||||
context.clientModules.forEach(launcherConfigurator::addModuleClass);
|
||||
reader.getCp().add(new JarFile(inputJar.toFile()));
|
||||
server.launcherBinary.coreLibs.forEach(e -> {
|
||||
|
@ -188,9 +179,6 @@ public Path process(Path inputJar) throws IOException {
|
|||
LogHelper.error(e1);
|
||||
}
|
||||
});
|
||||
context.pushBytes(launcherConfigurator.getZipEntryPath(), launcherConfigurator.getBytecode(reader));
|
||||
context.pushBytes(secureConfigurator.getZipEntryPath(), secureConfigurator.getBytecode(reader));
|
||||
|
||||
context.pushJarFile(inputJar, (e) -> blacklist.contains(e.getName()), (e) -> true);
|
||||
|
||||
// map for guard
|
||||
|
|
|
@ -31,7 +31,7 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
|
|||
EnvHelper.checkDangerousParams();
|
||||
LauncherConfig config = Launcher.getConfig();
|
||||
LauncherEngine.modulesManager = new ClientModuleManager();
|
||||
LauncherConfig.getAutogenConfig().initModules();
|
||||
LauncherConfig.initModules();
|
||||
|
||||
LogHelper.info("Launcher for project %s", config.projectName);
|
||||
if (config.environment.equals(LauncherConfig.LauncherEnvironment.PROD)) {
|
||||
|
|
|
@ -80,7 +80,7 @@ public static void main(String... args) throws Throwable {
|
|||
LauncherEngine.checkClass(LauncherAgent.class);
|
||||
LauncherEngine.checkClass(ClientLauncher.class);
|
||||
LauncherEngine.modulesManager = new ClientModuleManager();
|
||||
LauncherConfig.getAutogenConfig().initModules();
|
||||
LauncherConfig.initModules();
|
||||
LauncherEngine.modulesManager.initModules(null);
|
||||
// Start Launcher
|
||||
initGson(LauncherEngine.modulesManager);
|
||||
|
|
|
@ -443,7 +443,7 @@ public static void main(String... args) throws Throwable {
|
|||
LauncherEngine.checkClass(LauncherAgent.class);
|
||||
LauncherEngine.checkClass(ClientLauncher.class);
|
||||
LauncherEngine.modulesManager = new ClientModuleManager();
|
||||
LauncherConfig.getAutogenConfig().initModules(); //INIT
|
||||
LauncherConfig.initModules(); //INIT
|
||||
LauncherEngine.modulesManager.initModules(null);
|
||||
initGson(LauncherEngine.modulesManager);
|
||||
LauncherEngine.verifyNoAgent();
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
package pro.gravit.launcher;
|
||||
|
||||
public class AutogenConfig {
|
||||
public String projectname;
|
||||
public String address;
|
||||
public int clientPort;
|
||||
public String guardType;
|
||||
public String secretKeyClient;
|
||||
public String oemUnlockKey;
|
||||
public String secureCheckHash;
|
||||
public String secureCheckSalt;
|
||||
public String passwordEncryptKey;
|
||||
public int env;
|
||||
public boolean isWarningMissArchJava;
|
||||
// 0 - Dev (дебаг включен по умолчанию, все сообщения)
|
||||
// 1 - Debug (дебаг включен по умолчанию, основные сообщения)
|
||||
// 2 - Std (дебаг выключен по умолчанию, основные сообщения)
|
||||
// 3 - Production (дебаг выключен, минимальный объем сообщений, stacktrace не выводится)
|
||||
|
||||
AutogenConfig() {
|
||||
}
|
||||
|
||||
public void initModules() {
|
||||
|
||||
}
|
||||
}
|
|
@ -13,20 +13,19 @@
|
|||
import java.util.*;
|
||||
|
||||
public final class LauncherConfig extends StreamObject {
|
||||
private static final AutogenConfig config = new AutogenConfig();
|
||||
private static final SecureAutogenConfig secureConfig = new SecureAutogenConfig();
|
||||
|
||||
|
||||
public static AutogenConfig getAutogenConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
// Instance
|
||||
public String address;
|
||||
|
||||
@LauncherInject("launchercore.env")
|
||||
private static final int cenv = -1;
|
||||
@LauncherInject("launchercore.certificates")
|
||||
private static final List<byte[]> secureConfigCertificates = null;
|
||||
@LauncherInject("launcher.address")
|
||||
public String address;
|
||||
@LauncherInject("launcher.projectName")
|
||||
public final String projectName;
|
||||
@LauncherInject("launcher.port")
|
||||
public final int clientPort;
|
||||
@LauncherInject("runtimeconfig.secretKeyClient")
|
||||
public String secretKeyClient;
|
||||
@LauncherInject("runtimeconfig.oemUnlockKey")
|
||||
public String oemUnlockKey;
|
||||
public final LauncherTrustManager trustManager;
|
||||
|
||||
|
@ -34,40 +33,43 @@ public static AutogenConfig getAutogenConfig() {
|
|||
|
||||
|
||||
public final Map<String, byte[]> runtime;
|
||||
@LauncherInject("launcher.isWarningMissArchJava")
|
||||
public final boolean isWarningMissArchJava;
|
||||
public boolean isNettyEnabled;
|
||||
public LauncherEnvironment environment;
|
||||
|
||||
@LauncherInject("launcher.guardType")
|
||||
public final String guardType;
|
||||
|
||||
@LauncherInject("runtimeconfig.secureCheckHash")
|
||||
public final String secureCheckHash;
|
||||
@LauncherInject("runtimeconfig.secureCheckSalt")
|
||||
public final String secureCheckSalt;
|
||||
@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));
|
||||
secureCheckHash = config.secureCheckHash;
|
||||
secureCheckSalt = config.secureCheckSalt;
|
||||
passwordEncryptKey = config.passwordEncryptKey;
|
||||
projectName = config.projectname;
|
||||
clientPort = config.clientPort;
|
||||
secretKeyClient = config.secretKeyClient;
|
||||
oemUnlockKey = config.oemUnlockKey;
|
||||
secureCheckHash = null;
|
||||
secureCheckSalt = null;
|
||||
passwordEncryptKey = null;
|
||||
projectName = null;
|
||||
clientPort = -1;
|
||||
secretKeyClient = null;
|
||||
oemUnlockKey = null;
|
||||
try {
|
||||
trustManager = new LauncherTrustManager(secureConfig.certificates);
|
||||
trustManager = new LauncherTrustManager(secureConfigCertificates);
|
||||
} catch (CertificateException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
||||
isWarningMissArchJava = config.isWarningMissArchJava;
|
||||
guardType = config.guardType;
|
||||
address = config.address;
|
||||
isWarningMissArchJava = false;
|
||||
guardType = null;
|
||||
address = null;
|
||||
LauncherEnvironment env;
|
||||
if (config.env == 0) env = LauncherEnvironment.DEV;
|
||||
else if (config.env == 1) env = LauncherEnvironment.DEBUG;
|
||||
else if (config.env == 2) env = LauncherEnvironment.STD;
|
||||
else if (config.env == 3) env = LauncherEnvironment.PROD;
|
||||
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;
|
||||
|
@ -92,7 +94,6 @@ public LauncherConfig(String address, ECPublicKey publicKey, Map<String, byte[]>
|
|||
this.clientPort = 32148;
|
||||
guardType = "no";
|
||||
isWarningMissArchJava = true;
|
||||
isNettyEnabled = false;
|
||||
environment = LauncherEnvironment.STD;
|
||||
secureCheckSalt = null;
|
||||
secureCheckHash = null;
|
||||
|
@ -116,4 +117,18 @@ public void write(HOutput output) throws IOException {
|
|||
public enum LauncherEnvironment {
|
||||
DEV, DEBUG, STD, PROD
|
||||
}
|
||||
|
||||
public static void initModules() {
|
||||
// TODO Fill
|
||||
/*
|
||||
* Old filler
|
||||
public void addModuleClass(String fullName) {
|
||||
initModuleMethod.instructions.add(new FieldInsnNode(Opcodes.GETSTATIC, launcherName, "modulesManager", modulesManagerDesc));
|
||||
initModuleMethod.instructions.add(new TypeInsnNode(Opcodes.NEW, fullName.replace('.', '/')));
|
||||
initModuleMethod.instructions.add(new InsnNode(Opcodes.DUP));
|
||||
initModuleMethod.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, fullName.replace('.', '/'), "<init>", "()V"));
|
||||
initModuleMethod.instructions.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, modulesManagerName, "loadModule", registerModDesc));
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
package pro.gravit.launcher;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
public class SecureAutogenConfig {
|
||||
public static final Charset KEY_CHARSET = StandardCharsets.US_ASCII; // ? Какая из них, но выбрать надо однозачно проверить методом тыка!!!
|
||||
public final List<byte[]> certificates;
|
||||
|
||||
public SecureAutogenConfig() {
|
||||
//Пока не реализован SecureLauncherConfigurator
|
||||
certificates = null;/*Arrays.asList(
|
||||
("-----BEGIN CERTIFICATE-----\n" +
|
||||
"MIIFyjCCA7KgAwIBAgIRALnsjNjfvOTXfla3fX1fNEUwDQYJKoZIhvcNAQELBQAw\n" +
|
||||
"WTELMAkGA1UEBhMCUlUxFzAVBgNVBAoTDkdyYXZpdFRydXN0IENBMRAwDgYDVQQL\n" +
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6mW/4xKYzhXk5BTSolnqMVylxHgWXuBwdDDQQVnQ==\n" +
|
||||
"-----END CERTIFICATE-----").getBytes(KEY_CHARSET));*/
|
||||
}
|
||||
}
|
|
@ -196,7 +196,6 @@ public void updateLauncherConfig() {
|
|||
if(IOHelper.isFile(publicKeyFile))
|
||||
publicKey = SecurityHelper.toPublicECKey(IOHelper.read(publicKeyFile));
|
||||
cfg = new LauncherConfig(config.address, publicKey, new HashMap<>(), config.projectname);
|
||||
cfg.isNettyEnabled = true;
|
||||
cfg.address = config.address;
|
||||
} catch (InvalidKeySpecException | IOException e) {
|
||||
LogHelper.error(e);
|
||||
|
|
Loading…
Reference in a new issue