From efe967587c48f71edb7bc677bf623e14523c4f79 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Sun, 14 Jan 2024 17:25:55 +0700 Subject: [PATCH] [FIX] Finally remove launch4j --- .../pro/gravit/launchserver/LaunchServer.java | 9 +---- .../binary/EXEL4JLauncherBinary.java | 17 --------- .../binary/tasks/exe/Launch4JTask.java | 38 ------------------- .../config/LaunchServerConfig.java | 34 ----------------- 4 files changed, 1 insertion(+), 97 deletions(-) delete mode 100644 LaunchServer/src/main/java/pro/gravit/launchserver/binary/EXEL4JLauncherBinary.java delete mode 100644 LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/exe/Launch4JTask.java diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java index 17264082..f1ffda57 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java @@ -9,7 +9,6 @@ import pro.gravit.launcher.base.profiles.ClientProfile; import pro.gravit.launchserver.auth.AuthProviderPair; import pro.gravit.launchserver.auth.core.RejectAuthCoreProvider; -import pro.gravit.launchserver.binary.EXEL4JLauncherBinary; import pro.gravit.launchserver.binary.EXELauncherBinary; import pro.gravit.launchserver.binary.JARLauncherBinary; import pro.gravit.launchserver.binary.LauncherBinary; @@ -299,12 +298,6 @@ private LauncherBinary binary() { if(event.binary != null) { return event.binary; } - try { - Class.forName("net.sf.launch4j.Builder"); - if (config.launch4j.enabled) return new EXEL4JLauncherBinary(this); - } catch (ClassNotFoundException ignored) { - logger.warn("Launch4J isn't in classpath."); - } return new EXELauncherBinary(this); } @@ -392,7 +385,7 @@ public void syncLauncherBinaries() throws IOException { // Syncing launcher EXE binary logger.info("Syncing launcher EXE binary file"); - if (!launcherEXEBinary.sync() && config.launch4j.enabled) + if (!launcherEXEBinary.sync()) logger.warn("Missing launcher EXE binary file"); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/EXEL4JLauncherBinary.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/EXEL4JLauncherBinary.java deleted file mode 100644 index 26a2b457..00000000 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/EXEL4JLauncherBinary.java +++ /dev/null @@ -1,17 +0,0 @@ -package pro.gravit.launchserver.binary; - -import pro.gravit.launchserver.LaunchServer; -import pro.gravit.launchserver.binary.tasks.exe.Launch4JTask; - -public final class EXEL4JLauncherBinary extends LauncherBinary { - - - public EXEL4JLauncherBinary(LaunchServer server) { - super(server, LauncherBinary.resolve(server, ".exe"), "Launcher-%s.exe"); - } - - @Override - public void init() { - tasks.add(new Launch4JTask(server)); - } -} diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/exe/Launch4JTask.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/exe/Launch4JTask.java deleted file mode 100644 index f9390719..00000000 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/exe/Launch4JTask.java +++ /dev/null @@ -1,38 +0,0 @@ -package pro.gravit.launchserver.binary.tasks.exe; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import pro.gravit.launchserver.LaunchServer; -import pro.gravit.launchserver.binary.tasks.LauncherBuildTask; -import pro.gravit.utils.Version; - -import java.io.IOException; -import java.nio.file.Path; - -public class Launch4JTask implements LauncherBuildTask, BuildExeMainTask { - public static final String DOWNLOAD_URL = "https://bell-sw.com/pages/downloads/?version=java-8-lts&os=Windows&package=jre-full"; // BellSoft - private static final String VERSION = Version.getVersion().getVersionString(); - private static final int BUILD = Version.getVersion().build; - private final Path faviconFile; - private final LaunchServer server; - private transient final Logger logger = LogManager.getLogger(); - - public Launch4JTask(LaunchServer launchServer) { - this.server = launchServer; - faviconFile = launchServer.dir.resolve("favicon.ico"); - } - - public static String formatVars(String mask) { - return mask.formatted(VERSION, BUILD); - } - - @Override - public String getName() { - return "launch4j"; - } - - @Override - public Path process(Path inputFile) throws IOException { - throw new UnsupportedOperationException("Launch4j not supported"); - } -} diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java index 7c23e551..f3fcfd8d 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java @@ -12,12 +12,10 @@ import pro.gravit.launchserver.auth.protect.ProtectHandler; import pro.gravit.launchserver.auth.protect.StdProtectHandler; import pro.gravit.launchserver.auth.texture.RequestTextureProvider; -import pro.gravit.launchserver.binary.tasks.exe.Launch4JTask; import pro.gravit.launchserver.components.AuthLimiterComponent; import pro.gravit.launchserver.components.Component; import pro.gravit.launchserver.components.ProGuardComponent; import pro.gravit.launchserver.components.RegLimiterComponent; -import pro.gravit.utils.Version; import pro.gravit.utils.helper.JVMHelper; import java.io.File; @@ -41,7 +39,6 @@ public final class LaunchServerConfig { // Handlers & Providers public ProtectHandler protectHandler; public Map components; - public ExeConf launch4j; public NettyConfig netty; public LauncherConf launcher; public JarSignerConf sign; @@ -52,18 +49,6 @@ public final class LaunchServerConfig { public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env) { LaunchServerConfig newConfig = new LaunchServerConfig(); newConfig.mirrors = new String[]{"https://mirror.gravitlauncher.com/5.6.x/", "https://gravit-launcher-mirror.storage.googleapis.com/"}; - newConfig.launch4j = new LaunchServerConfig.ExeConf(); - newConfig.launch4j.enabled = false; - newConfig.launch4j.copyright = "© GravitLauncher Team"; - newConfig.launch4j.fileDesc = "GravitLauncher ".concat(Version.getVersion().getVersionString()); - newConfig.launch4j.fileVer = Version.getVersion().getVersionString().concat(".").concat(String.valueOf(Version.getVersion().patch)); - newConfig.launch4j.internalName = "Launcher"; - newConfig.launch4j.trademarks = "This product is licensed under GPLv3"; - newConfig.launch4j.txtFileVersion = "%s, build %d"; - newConfig.launch4j.txtProductVersion = "%s, build %d"; - newConfig.launch4j.productName = "GravitLauncher"; - newConfig.launch4j.productVer = newConfig.launch4j.fileVer; - newConfig.launch4j.maxVersion = "99.0.0"; newConfig.env = LauncherConfig.LauncherEnvironment.STD; newConfig.startScript = JVMHelper.OS_TYPE.equals(JVMHelper.OS.MUSTDIE) ? "." + File.separator + "start.bat" : "." + File.separator + "start.sh"; newConfig.auth = new HashMap<>(); @@ -232,25 +217,6 @@ public void close(LaunchServer.ReloadType type) { } } - public static class ExeConf { - public boolean enabled; - public boolean setMaxVersion; - public String maxVersion; - public String minVersion = "17.0.0"; - public String supportURL = null; - public String downloadUrl = Launch4JTask.DOWNLOAD_URL; - public String productName; - public String productVer; - public String fileDesc; - public String fileVer; - public String internalName; - public String copyright; - public String trademarks; - - public String txtFileVersion; - public String txtProductVersion; - } - public static class JarSignerConf { public boolean enabled = false; public String keyStore = "pathToKey";