diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java index c84edf41..2f0bb97d 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java @@ -64,7 +64,6 @@ import pro.gravit.launchserver.components.Component; import pro.gravit.launchserver.components.RegLimiterComponent; import pro.gravit.launchserver.config.LaunchServerRuntimeConfig; -import pro.gravit.launchserver.dao.UserService; import pro.gravit.launchserver.dao.provider.DaoProvider; import pro.gravit.launchserver.manangers.*; import pro.gravit.launchserver.manangers.hook.AuthHookManager; @@ -152,7 +151,6 @@ public AuthProviderPair getAuthProviderPair() { public boolean isWarningMissArchJava; public boolean enabledProGuard; - public boolean enabledRadon; public boolean stripLineNumbers; public boolean deleteTempFiles; @@ -747,7 +745,6 @@ private void generateConfigIfNotExists(boolean testEnv) throws IOException { newConfig.launcher = new LauncherConf(); newConfig.launcher.guardType = "no"; - newConfig.enabledRadon = true; newConfig.genMappings = true; newConfig.enabledProGuard = true; newConfig.stripLineNumbers = true; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/JARLauncherBinary.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/JARLauncherBinary.java index 885c18d9..2e7b8de5 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/JARLauncherBinary.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/JARLauncherBinary.java @@ -15,7 +15,6 @@ import pro.gravit.launchserver.binary.tasks.MainBuildTask; import pro.gravit.launchserver.binary.tasks.PrepareBuildTask; import pro.gravit.launchserver.binary.tasks.ProGuardBuildTask; -import pro.gravit.launchserver.binary.tasks.RadonBuildTask; import pro.gravit.utils.helper.CommonHelper; import pro.gravit.utils.helper.IOHelper; import pro.gravit.utils.helper.LogHelper; @@ -51,7 +50,6 @@ public void init() { if (server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server)); tasks.add(new ProGuardBuildTask(server)); tasks.add(new AdditionalFixesApplyTask(server)); - tasks.add(new RadonBuildTask(server)); if (!server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server)); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/AdditionalFixesApplyTask.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/AdditionalFixesApplyTask.java index bae3a847..6502e3f3 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/AdditionalFixesApplyTask.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/AdditionalFixesApplyTask.java @@ -19,6 +19,7 @@ import pro.gravit.launchserver.asm.ClassMetadataReader; import pro.gravit.launchserver.asm.SafeClassWriter; import pro.gravit.utils.helper.IOHelper; +import pro.gravit.utils.helper.LogHelper; public class AdditionalFixesApplyTask implements LauncherBuildTask { private final LaunchServer server; @@ -73,7 +74,12 @@ public static void apply(Path inputFile, Path addFile, ZipOutputStream output, L IOHelper.transfer(input, outputStream); bytes = outputStream.toByteArray(); } - output.write(classFix(bytes, reader, srv.config.stripLineNumbers)); + try { + bytes = classFix(bytes, reader, srv.config.stripLineNumbers); + } catch (Throwable t) { + LogHelper.subWarning("Erorr on fixing class: " + t); + } + output.write(bytes); } else IOHelper.transfer(input, output); e = input.getNextEntry(); @@ -86,7 +92,6 @@ private static byte[] classFix(byte[] bytes, ClassMetadataReader reader, boolean ClassReader cr = new ClassReader(bytes); ClassNode cn = new ClassNode(); cr.accept(cn, stripNumbers ? (ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES) : ClassReader.SKIP_FRAMES); - ClassWriter cw = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); cn.accept(cw); return cw.toByteArray(); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/RadonBuildTask.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/RadonBuildTask.java deleted file mode 100644 index 54ce9f2a..00000000 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/RadonBuildTask.java +++ /dev/null @@ -1,57 +0,0 @@ -package pro.gravit.launchserver.binary.tasks; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.List; -import java.util.stream.Collectors; - -import me.itzsomebody.radon.Radon; -import me.itzsomebody.radon.SessionInfo; -import me.itzsomebody.radon.config.ConfigurationParser; -import pro.gravit.launchserver.LaunchServer; -import pro.gravit.utils.helper.IOHelper; -import pro.gravit.utils.helper.UnpackHelper; - -public class RadonBuildTask implements LauncherBuildTask { - private final LaunchServer srv; - public final Path config; - - public RadonBuildTask(LaunchServer srv) { - this.srv = srv; - config = this.srv.dir.resolve("radon.yml"); - System.setProperty("radon.useJVMCP", "true"); - } - - @Override - public String getName() { - return "Radon"; - } - - @Override - public Path process(Path inputFile) throws IOException { - Path outputFile = srv.launcherBinary.nextLowerPath(this); - Files.deleteIfExists(outputFile); - if (srv.config.enabledRadon) { - if (!IOHelper.isFile(config)) - UnpackHelper.unpack(IOHelper.getResourceURL("pro/gravit/launchserver/defaults/radon.cfg"), config); - ConfigurationParser p = new ConfigurationParser(IOHelper.newInput(config)); - SessionInfo info = p.createSessionFromConfig(); - info.setInput(inputFile.toFile()); - info.setOutput(outputFile.toFile()); - List libs = srv.launcherBinary.coreLibs.stream().map(Path::toFile).collect(Collectors.toList()); - libs.addAll(srv.launcherBinary.addonLibs.stream().map(Path::toFile).collect(Collectors.toList())); - info.setLibraries(libs); - Radon r = new Radon(info); - r.run(); - } else - IOHelper.copy(inputFile, outputFile); - return outputFile; - } - - @Override - public boolean allowDelete() { - return true; - } -}