mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX] Удалил по максимому дупликаты кода в LauncherConfigurator.
This commit is contained in:
parent
0b316dff56
commit
ac55d0694b
2 changed files with 10 additions and 46 deletions
|
@ -35,35 +35,6 @@ public void addModuleClass(String fullName) {
|
|||
initModuleMethod.instructions.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, modulesManagerName, "loadModule", registerModDesc));
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
setStringField("address", address);
|
||||
}
|
||||
|
||||
public void setPasswordEncryptKey(String pass) {
|
||||
setStringField("passwordEncryptKey", pass);
|
||||
}
|
||||
|
||||
public void setProjectName(String name) {
|
||||
setStringField("projectname", name);
|
||||
}
|
||||
|
||||
public void setSecretKey(String key) {
|
||||
setStringField("secretKeyClient", key);
|
||||
}
|
||||
|
||||
public void setOemUnlockKey(String key) {
|
||||
setStringField("oemUnlockKey", key);
|
||||
}
|
||||
|
||||
public void setGuardType(String key) {
|
||||
setStringField("guardType", key);
|
||||
}
|
||||
|
||||
public void setSecureCheck(String hash, String salt) {
|
||||
setStringField("secureCheckHash", hash);
|
||||
setStringField("secureCheckSalt", salt);
|
||||
}
|
||||
|
||||
public void setEnv(LauncherConfig.LauncherEnvironment env) {
|
||||
int i = 2;
|
||||
switch (env) {
|
||||
|
@ -82,12 +53,4 @@ public void setEnv(LauncherConfig.LauncherEnvironment env) {
|
|||
}
|
||||
setIntegerField("env", i);
|
||||
}
|
||||
|
||||
public void setClientPort(int port) {
|
||||
setIntegerField("clientPort", port);
|
||||
}
|
||||
|
||||
public void setWarningMissArchJava(boolean b) {
|
||||
setBooleanField("isWarningMissArchJava", b);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,21 +123,22 @@ public Path process(Path inputJar) throws IOException {
|
|||
LauncherConfigurator launcherConfigurator = new LauncherConfigurator(cn);
|
||||
BuildContext context = new BuildContext(output, launcherConfigurator, this);
|
||||
server.buildHookManager.hook(context);
|
||||
launcherConfigurator.setAddress(server.config.netty.address);
|
||||
launcherConfigurator.setProjectName(server.config.projectName);
|
||||
launcherConfigurator.setSecretKey(SecurityHelper.randomStringAESKey());
|
||||
launcherConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512));
|
||||
launcherConfigurator.setGuardType(server.config.launcher.guardType);
|
||||
launcherConfigurator.setWarningMissArchJava(server.config.launcher.warningMissArchJava);
|
||||
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.setPasswordEncryptKey(server.runtime.passwordEncryptKey);
|
||||
launcherConfigurator.setStringField("passwordEncryptKey", server.runtime.passwordEncryptKey);
|
||||
String launcherSalt = SecurityHelper.randomStringToken();
|
||||
byte[] launcherSecureHash = SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA256,
|
||||
server.runtime.clientCheckSecret.concat(".").concat(launcherSalt));
|
||||
launcherConfigurator.setSecureCheck(Base64.getEncoder().encodeToString(launcherSecureHash), launcherSalt);
|
||||
launcherConfigurator.setStringField("secureCheckHash", Base64.getEncoder().encodeToString(launcherSecureHash));
|
||||
launcherConfigurator.setStringField("secureCheckSalt", launcherSalt);
|
||||
//LogHelper.debug("[checkSecure] %s: %s", launcherSalt, Arrays.toString(launcherSecureHash));
|
||||
if (server.runtime.oemUnlockKey == null) server.runtime.oemUnlockKey = SecurityHelper.randomStringToken();
|
||||
launcherConfigurator.setOemUnlockKey(server.runtime.oemUnlockKey);
|
||||
launcherConfigurator.setStringField("oemUnlockKey", server.runtime.oemUnlockKey);
|
||||
server.buildHookManager.registerAllClientModuleClass(launcherConfigurator);
|
||||
reader.getCp().add(new JarFile(inputJar.toFile()));
|
||||
server.launcherBinary.coreLibs.forEach(e -> {
|
||||
|
|
Loading…
Reference in a new issue