From 79a288108927f02302cc3ab5279f8910132ced45 Mon Sep 17 00:00:00 2001 From: Gravit Date: Wed, 28 Aug 2019 17:12:03 +0700 Subject: [PATCH] =?UTF-8?q?[ANY]=20=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20JAConfigurat?= =?UTF-8?q?or?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../launchserver/binary/BuildContext.java | 4 +-- ...gurator.java => LauncherConfigurator.java} | 4 +-- .../binary/tasks/MainBuildTask.java | 32 +++++++++---------- .../manangers/hook/BuildHookManager.java | 4 +-- 4 files changed, 22 insertions(+), 22 deletions(-) rename LaunchServer/src/main/java/pro/gravit/launchserver/binary/{JAConfigurator.java => LauncherConfigurator.java} (98%) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/BuildContext.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/BuildContext.java index 1f7cd962..7ede8a64 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/BuildContext.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/BuildContext.java @@ -13,12 +13,12 @@ public class BuildContext { public final ZipOutputStream output; - public final JAConfigurator config; + public final LauncherConfigurator config; public final MainBuildTask data; public final HashSet fileList; - public BuildContext(ZipOutputStream output, JAConfigurator config, MainBuildTask data) { + public BuildContext(ZipOutputStream output, LauncherConfigurator config, MainBuildTask data) { this.output = output; this.config = config; this.data = data; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/JAConfigurator.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/LauncherConfigurator.java similarity index 98% rename from LaunchServer/src/main/java/pro/gravit/launchserver/binary/JAConfigurator.java rename to LaunchServer/src/main/java/pro/gravit/launchserver/binary/LauncherConfigurator.java index f54359d2..352112b8 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/JAConfigurator.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/LauncherConfigurator.java @@ -24,7 +24,7 @@ import pro.gravit.launchserver.asm.ClassMetadataReader; import pro.gravit.launchserver.asm.SafeClassWriter; -public class JAConfigurator { +public class LauncherConfigurator { 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/ClientModulesManager;"; @@ -35,7 +35,7 @@ public class JAConfigurator { private final MethodNode constructor; private final MethodNode initModuleMethod; - public JAConfigurator(ClassNode configclass) { + public LauncherConfigurator(ClassNode configclass) { this.configclass = configclass; constructor = configclass.methods.stream().filter(e -> "".equals(e.name)).findFirst().get(); constructor.instructions = new InsnList(); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java index e8dff601..0975bff7 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java @@ -26,7 +26,7 @@ import pro.gravit.launchserver.LaunchServer; import pro.gravit.launchserver.asm.ClassMetadataReader; import pro.gravit.launchserver.binary.BuildContext; -import pro.gravit.launchserver.binary.JAConfigurator; +import pro.gravit.launchserver.binary.LauncherConfigurator; import pro.gravit.utils.helper.IOHelper; import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.SecurityHelper; @@ -119,23 +119,23 @@ public Path process(Path inputJar) throws IOException { try (ZipOutputStream output = new ZipOutputStream(IOHelper.newOutput(outputJar))) { ClassNode cn = new ClassNode(); new ClassReader(IOHelper.getResourceBytes(AutogenConfig.class.getName().replace('.', '/').concat(".class"))).accept(cn, 0); - JAConfigurator jaConfigurator = new JAConfigurator(cn); - BuildContext context = new BuildContext(output, jaConfigurator, this); + LauncherConfigurator launcherConfigurator = new LauncherConfigurator(cn); + BuildContext context = new BuildContext(output, launcherConfigurator, this); server.buildHookManager.hook(context); - jaConfigurator.setAddress(server.config.netty.address); + launcherConfigurator.setAddress(server.config.netty.address); if (server.config.guardLicense != null) - jaConfigurator.setGuardLicense(server.config.guardLicense.name, server.config.guardLicense.key, server.config.guardLicense.encryptKey); + launcherConfigurator.setGuardLicense(server.config.guardLicense.name, server.config.guardLicense.key, server.config.guardLicense.encryptKey); else - jaConfigurator.nullGuardLicense(); - jaConfigurator.setProjectName(server.config.projectName); - jaConfigurator.setSecretKey(SecurityHelper.randomStringAESKey()); - jaConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512)); - jaConfigurator.setGuardType(server.config.launcher.guardType); - jaConfigurator.setWarningMissArchJava(server.config.launcher.warningMissArchJava); - jaConfigurator.setEnv(server.config.env); + launcherConfigurator.nullGuardLicense(); + 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.setEnv(server.config.env); if (server.runtime.oemUnlockKey == null) server.runtime.oemUnlockKey = SecurityHelper.randomStringToken(); - jaConfigurator.setOemUnlockKey(server.runtime.oemUnlockKey); - server.buildHookManager.registerAllClientModuleClass(jaConfigurator); + launcherConfigurator.setOemUnlockKey(server.runtime.oemUnlockKey); + server.buildHookManager.registerAllClientModuleClass(launcherConfigurator); reader.getCp().add(new JarFile(inputJar.toFile())); server.launcherBinary.coreLibs.forEach(e -> { try { @@ -144,7 +144,7 @@ public Path process(Path inputJar) throws IOException { LogHelper.error(e1); } }); - String zPath = jaConfigurator.getZipEntryPath(); + String zPath = launcherConfigurator.getZipEntryPath(); try (ZipInputStream input = new ZipInputStream(IOHelper.newInput(inputJar))) { ZipEntry e = input.getNextEntry(); while (e != null) { @@ -203,7 +203,7 @@ public Path process(Path inputJar) throws IOException { output.write(launcherConfigBytes); ZipEntry e = newZipEntry(zPath); output.putNextEntry(e); - output.write(jaConfigurator.getBytecode(reader)); + output.write(launcherConfigurator.getBytecode(reader)); } reader.close(); return outputJar; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/hook/BuildHookManager.java b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/hook/BuildHookManager.java index 50264e3a..22306726 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/hook/BuildHookManager.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/hook/BuildHookManager.java @@ -7,7 +7,7 @@ import pro.gravit.launcher.AutogenConfig; import pro.gravit.launchserver.binary.BuildContext; -import pro.gravit.launchserver.binary.JAConfigurator; +import pro.gravit.launchserver.binary.LauncherConfigurator; import pro.gravit.launchserver.binary.tasks.MainBuildTask; public class BuildHookManager { @@ -75,7 +75,7 @@ public void hook(BuildContext context) { for (BuildHook hook : HOOKS) hook.build(context); } - public void registerAllClientModuleClass(JAConfigurator cfg) { + public void registerAllClientModuleClass(LauncherConfigurator cfg) { for (String clazz : MODULE_CLASS) cfg.addModuleClass(clazz); }