[FIX] Finally remove launch4j

This commit is contained in:
Gravita 2024-01-14 17:25:55 +07:00
parent f2b92c2bbd
commit efe967587c
4 changed files with 1 additions and 97 deletions

View file

@ -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");
}

View file

@ -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));
}
}

View file

@ -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");
}
}

View file

@ -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<String, Component> 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";