From a486f21fa2fc0760bfcc9c3478d6c5124cdcd06f Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:48:20 +0700 Subject: [PATCH 01/10] [ANY] Update dependencies --- props.gradle | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/props.gradle b/props.gradle index 3d5fc90f..99b9aa98 100644 --- a/props.gradle +++ b/props.gradle @@ -1,18 +1,18 @@ project.ext { - verAsm = '9.7' - verNetty = '4.1.111.Final' - verOshiCore = '6.6.4' - verJunit = '5.10.2' + verAsm = '9.7.1' + verNetty = '4.1.114.Final' + verOshiCore = '6.6.5' + verJunit = '5.11.2' verJansi = '2.4.1' verJline = '3.26.3' - verJwt = '0.12.5' + verJwt = '0.12.6' verGson = '2.11.0' verBcpkix = '1.78.1' - verSlf4j = '2.0.13' - verLog4j = '2.23.1' + verSlf4j = '2.0.16' + verLog4j = '2.24.1' verMySQLConn = '9.0.0' - verMariaDBConn = '3.4.0' + verMariaDBConn = '3.4.1' verPostgreSQLConn = '42.7.4' verH2Conn = '2.3.232' - verProguard = '7.5.0' + verProguard = '7.6.0' } From 81b16cb54e83d633ab4c51ef3713ef4c8fa071b0 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:53:03 +0700 Subject: [PATCH 02/10] [ANY] Update gradle --- gradle/wrapper/gradle-wrapper.jar | Bin 43504 -> 43583 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 2c3521197d7c4586c843d1d3e9090525f1898cde..a4b76b9530d66f5e68d973ea569d8e19de379189 100644 GIT binary patch delta 3990 zcmV;H4{7l5(*nQL0Kr1kzC=_KMxQY0|W5(lc#i zH*M1^P4B}|{x<+fkObwl)u#`$GxKKV&3pg*-y6R6txw)0qU|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H{s1p|eppv=x za(g_jLU|xjWMAn-V7th$f({|LG8zzIE0g?cyW;%Dmtv%C+0@xVxPE^ zyZzi9P%JAD6ynwHptuzP`Kox7*9h7XSMonCalv;Md0i9Vb-c*!f0ubfk?&T&T}AHh z4m8Bz{JllKcdNg?D^%a5MFQ;#1z|*}H^qHLzW)L}wp?2tY7RejtSh8<;Zw)QGJYUm z|MbTxyj*McKlStlT9I5XlSWtQGN&-LTr2XyNU+`490rg?LYLMRnz-@oKqT1hpCGqP zyRXt4=_Woj$%n5ee<3zhLF>5>`?m9a#xQH+Jk_+|RM8Vi;2*XbK- zEL6sCpaGPzP>k8f4Kh|##_imt#zJMB;ir|JrMPGW`rityK1vHXMLy18%qmMQAm4WZ zP)i30KR&5vs15)C+8dM66&$k~i|ZT;KR&5vs15)C+8dJ(sAmGPijyIz6_bsqKLSFH zlOd=TljEpH0>h4zA*dCTK&emy#FCRCs1=i^sZ9bFmXjf<6_X39E(XY)00000#N437 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index dedd5d1e..79eb9d00 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From a1af61a599c6f56dff0842f7549f1d78a4af2a79 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Tue, 22 Oct 2024 17:14:36 +0700 Subject: [PATCH 03/10] [ANY] Update modules --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index 65f882bd..0d8cef92 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit 65f882bd90623aa1581ad24cfa4f52563ea95bc0 +Subproject commit 0d8cef927b1fda3097dc88c3adcffc4d0e33dd69 From 926094076c79aff674edf07f08fe2689e3521196 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Tue, 5 Nov 2024 07:08:31 +0700 Subject: [PATCH 04/10] [FIX] Fix NPE with nativePath PR #719 --- .../src/main/java/pro/gravit/utils/launch/LegacyLaunch.java | 3 +++ .../src/main/java/pro/gravit/utils/launch/ModuleLaunch.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/LauncherCore/src/main/java/pro/gravit/utils/launch/LegacyLaunch.java b/LauncherCore/src/main/java/pro/gravit/utils/launch/LegacyLaunch.java index a7511ad9..7be6eda4 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/launch/LegacyLaunch.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/launch/LegacyLaunch.java @@ -123,6 +123,9 @@ protected Class findClass(String name) throws ClassNotFoundException { @Override public String findLibrary(String name) { + if(nativePath == null) { + return null; + } return nativePath.concat(IOHelper.PLATFORM_SEPARATOR).concat(JVMHelper.NATIVE_PREFIX).concat(name).concat(JVMHelper.NATIVE_EXTENSION); } diff --git a/LauncherCore/src/main/java/pro/gravit/utils/launch/ModuleLaunch.java b/LauncherCore/src/main/java/pro/gravit/utils/launch/ModuleLaunch.java index d83e3c44..ca1e8bb7 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/launch/ModuleLaunch.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/launch/ModuleLaunch.java @@ -262,6 +262,9 @@ protected Class findClass(String moduleName, String name) { @Override public String findLibrary(String name) { + if(nativePath == null) { + return null; + } return nativePath.concat(IOHelper.PLATFORM_SEPARATOR).concat(JVMHelper.NATIVE_PREFIX).concat(name).concat(JVMHelper.NATIVE_EXTENSION); } From 912caa6b8a1739615cfad3abf3b37a9cbe517013 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:52:59 +0700 Subject: [PATCH 05/10] [FIX] Add more logging to timestamp failed error --- .../pro/gravit/launcher/client/ClientLauncherEntryPoint.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LauncherClient/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java b/LauncherClient/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java index f767206f..6aad0739 100644 --- a/LauncherClient/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java +++ b/LauncherClient/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java @@ -88,7 +88,7 @@ private static void realMain(String[] args) throws Throwable { ClientParams params = readParams(new InetSocketAddress("127.0.0.1", Launcher.getConfig().clientPort)); ClientLauncherMethods.verifyNoAgent(); if(params.timestamp > System.currentTimeMillis() || params.timestamp + 30*1000 < System.currentTimeMillis() ) { - LogHelper.error("Timestamp failed. Exit"); + LogHelper.error("Timestamp failed: current %d | params %d | diff %d", System.currentTimeMillis(), params.timestamp, System.currentTimeMillis() - params.timestamp); ClientLauncherMethods.exitLauncher(-662); return; } From bb63aaa0abe29de4f1feb68bc3bcf7c426bd1726 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Fri, 13 Dec 2024 22:40:23 +0700 Subject: [PATCH 06/10] [ANY] Update modules --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index 0d8cef92..a7837f90 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit 0d8cef927b1fda3097dc88c3adcffc4d0e33dd69 +Subproject commit a7837f90a54c8e2c988d55005b6ab4e15ba99a36 From 4671dfe49d3042dfd63c08f83a085c1ac3e4c15c Mon Sep 17 00:00:00 2001 From: microwin7 Date: Tue, 31 Dec 2024 04:16:09 +0300 Subject: [PATCH 07/10] [ANY] Added proxy repository jitpack. Sync moduls --- LaunchServer/build.gradle | 7 +++++++ build.gradle | 7 +++++++ modules | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/LaunchServer/build.gradle b/LaunchServer/build.gradle index d03cc45d..f9d16e6c 100644 --- a/LaunchServer/build.gradle +++ b/LaunchServer/build.gradle @@ -13,6 +13,13 @@ maven { url "https://jitpack.io/" } + maven { + url 'https://maven.gravit-support.ru/repository/jitpack' + credentials { + username = 'gravitlauncher' + password = 'gravitlauncher' + } + } } sourceCompatibility = '21' diff --git a/build.gradle b/build.gradle index 1a1f5a77..6e5a6b23 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,13 @@ maven { url "https://jitpack.io/" } + maven { + url 'https://maven.gravit-support.ru/repository/jitpack' + credentials { + username = 'gravitlauncher' + password = 'gravitlauncher' + } + } } jar { diff --git a/modules b/modules index a7837f90..bf37c686 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit a7837f90a54c8e2c988d55005b6ab4e15ba99a36 +Subproject commit bf37c6860a80acfd516ee533494d64b226d89309 From 0111b2ca2b4b2cff953a91a055cb992ff7a05ef2 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Tue, 31 Dec 2024 14:19:24 +0700 Subject: [PATCH 08/10] [FEATURE] Add ControlFile and proxy command handlers --- .../pro/gravit/launchserver/LaunchServer.java | 10 +- .../socket/SocketCommandServer.java | 97 +++++++++++++++++++ .../gravit/utils/command/CommandHandler.java | 14 ++- .../utils/command/StdCommandHandler.java | 39 ++++++++ 4 files changed, 157 insertions(+), 3 deletions(-) create mode 100644 LaunchServer/src/main/java/pro/gravit/launchserver/socket/SocketCommandServer.java diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java index a117dd48..f0f7c790 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java @@ -21,6 +21,7 @@ import pro.gravit.launchserver.modules.events.*; import pro.gravit.launchserver.modules.impl.LaunchServerModulesManager; import pro.gravit.launchserver.socket.Client; +import pro.gravit.launchserver.socket.SocketCommandServer; import pro.gravit.launchserver.socket.handlers.NettyServerSocketHandler; import pro.gravit.launchserver.socket.response.auth.ProfilesResponse; import pro.gravit.launchserver.socket.response.auth.RestoreResponse; @@ -85,6 +86,7 @@ public final class LaunchServer implements Runnable, AutoCloseable, Reconfigurab public final Path modulesDir; public final Path launcherModulesDir; public final Path librariesDir; + public final Path controlFile; /** * This object contains runtime configuration */ @@ -113,6 +115,7 @@ public final class LaunchServer implements Runnable, AutoCloseable, Reconfigurab // Server public final CommandHandler commandHandler; public final NettyServerSocketHandler nettyServerSocketHandler; + public final SocketCommandServer socketCommandServer; public final ScheduledExecutorService service; public final AtomicBoolean started = new AtomicBoolean(false); public final LauncherModuleLoader launcherModuleLoader; @@ -139,6 +142,7 @@ public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, La modulesDir = directories.modules; launcherModulesDir = directories.launcherModules; librariesDir = directories.librariesDir; + controlFile = directories.controlFile; this.shardId = shardId; if(!Files.isDirectory(launcherPack)) { Files.createDirectories(launcherPack); @@ -190,6 +194,7 @@ public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, La } launcherModuleLoader.init(); nettyServerSocketHandler = new NettyServerSocketHandler(this); + socketCommandServer = new SocketCommandServer(commandHandler, controlFile); if(config.sign.checkCertificateExpired) { checkCertificateExpired(); service.scheduleAtFixedRate(this::checkCertificateExpired, 24, 24, TimeUnit.HOURS); @@ -353,6 +358,7 @@ public void run() { } })); CommonHelper.newThread("Command Thread", true, commandHandler).start(); + CommonHelper.newThread("Socket Command Thread", true, socketCommandServer).start(); // Sync updates dir CommonHelper.newThread("Profiles and updates sync", true, () -> { try { @@ -461,7 +467,7 @@ public interface LaunchServerConfigManager { public static class LaunchServerDirectories { public static final String UPDATES_NAME = "updates", TRUSTSTORE_NAME = "truststore", LAUNCHERLIBRARIES_NAME = "launcher-libraries", - LAUNCHERLIBRARIESCOMPILE_NAME = "launcher-libraries-compile", LAUNCHERPACK_NAME = "launcher-pack", KEY_NAME = ".keys", MODULES = "modules", LAUNCHER_MODULES = "launcher-modules", LIBRARIES = "libraries"; + LAUNCHERLIBRARIESCOMPILE_NAME = "launcher-libraries-compile", LAUNCHERPACK_NAME = "launcher-pack", KEY_NAME = ".keys", MODULES = "modules", LAUNCHER_MODULES = "launcher-modules", LIBRARIES = "libraries", CONTROL_FILE = "control-file"; public Path updatesDir; public Path librariesDir; public Path launcherLibrariesDir; @@ -473,6 +479,7 @@ public static class LaunchServerDirectories { public Path tmpDir; public Path modules; public Path launcherModules; + public Path controlFile; public void collect() { if (updatesDir == null) updatesDir = getPath(UPDATES_NAME); @@ -486,6 +493,7 @@ public void collect() { if (modules == null) modules = getPath(MODULES); if (launcherModules == null) launcherModules = getPath(LAUNCHER_MODULES); if (librariesDir == null) librariesDir = getPath(LIBRARIES); + if (controlFile == null) controlFile = getPath(CONTROL_FILE); if (tmpDir == null) tmpDir = Paths.get(System.getProperty("java.io.tmpdir")).resolve("launchserver-%s".formatted(SecurityHelper.randomStringToken())); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/SocketCommandServer.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/SocketCommandServer.java new file mode 100644 index 00000000..c2b06896 --- /dev/null +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/SocketCommandServer.java @@ -0,0 +1,97 @@ +package pro.gravit.launchserver.socket; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import pro.gravit.launchserver.config.log4j.LogAppender; +import pro.gravit.utils.command.CommandHandler; + +import java.io.IOException; +import java.net.StandardProtocolFamily; +import java.net.UnixDomainSocketAddress; +import java.nio.ByteBuffer; +import java.nio.channels.ServerSocketChannel; +import java.nio.channels.SocketChannel; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; + +public class SocketCommandServer implements Runnable { + private final Logger logger = LogManager.getLogger(SocketCommandServer.class); + private ServerSocketChannel channel; + private Path path; + private UnixDomainSocketAddress address; + private ServerSocketChannel serverChannel; + private CommandHandler commandHandler; + private transient SocketChannel clientChannel; + + public SocketCommandServer(CommandHandler commandHandler, Path path) { + this.commandHandler = commandHandler; + this.path = path; + } + + private void runCommand(SocketChannel channel, String command) { + logger.info("Command '{}' from socket", command); + clientChannel = channel; + try { + commandHandler.evalNative(command, false); + } catch (Throwable e) { + logger.error("Error when execute command", e); + } finally { + clientChannel = null; + + } + } + + @Override + public void run() { + try { + Files.deleteIfExists(path); + this.address = UnixDomainSocketAddress.of(path); + serverChannel = ServerSocketChannel.open(StandardProtocolFamily.UNIX); + serverChannel.configureBlocking(true); + serverChannel.bind(address); + LogAppender.getInstance().addListener((logEvent -> { + if(clientChannel != null && clientChannel.isOpen()) { + try { + String s = logEvent.getMessage().getFormattedMessage()+"\n"; + byte[] bytes = s.getBytes(StandardCharsets.UTF_8); + ByteBuffer buffer = ByteBuffer.wrap(bytes); + clientChannel.write(buffer); + } catch (Throwable ignored) { + } + } + })); + ByteBuffer buffer = ByteBuffer.allocate(1024); + while (true) { + SocketChannel channel = serverChannel.accept(); + channel.configureBlocking(true); + String command = null; + try { + mark: + while (true) { + int bytesRead = channel.read(buffer); + if (bytesRead < 0) { + break; + } + logger.info("DEBUG: readed {}", new String(buffer.array(), 0, buffer.limit())); + for (var i=0;i categories = new ArrayList<>(); - private final CommandCategory baseCategory = new BaseCommandCategory(); + protected final List categories; + protected final CommandCategory baseCategory; + + public CommandHandler() { + this.categories = new ArrayList<>(); + this.baseCategory = new BaseCommandCategory(); + } + + protected CommandHandler(List categories, CommandCategory baseCategory) { + this.categories = categories; + this.baseCategory = baseCategory; + } public void eval(String line, boolean bell) { LogHelper.info("Command '%s'", line); diff --git a/LauncherCore/src/main/java/pro/gravit/utils/command/StdCommandHandler.java b/LauncherCore/src/main/java/pro/gravit/utils/command/StdCommandHandler.java index 5bb297aa..257ceecb 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/command/StdCommandHandler.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/command/StdCommandHandler.java @@ -5,6 +5,8 @@ import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStream; +import java.util.List; public class StdCommandHandler extends CommandHandler { private final BufferedReader reader; @@ -14,6 +16,31 @@ public StdCommandHandler(boolean readCommands) { reader = readCommands ? IOHelper.newReader(System.in) : null; } + public StdCommandHandler(InputStream stream) { + super(); + this.reader = IOHelper.newReader(stream); + } + + public StdCommandHandler(BufferedReader reader) { + super(); + this.reader = reader; + } + + protected StdCommandHandler(List categories, CommandCategory baseCategory, boolean readCommands) { + super(categories, baseCategory); + this.reader = readCommands ? IOHelper.newReader(System.in) : null; + } + + protected StdCommandHandler(List categories, CommandCategory baseCategory, InputStream stream) { + super(categories, baseCategory); + this.reader = IOHelper.newReader(stream); + } + + protected StdCommandHandler(List categories, CommandCategory baseCategory, BufferedReader reader) { + super(categories, baseCategory); + this.reader = reader; + } + @Override public void bell() { } @@ -37,4 +64,16 @@ public void clear() throws IOException { public String readLine() throws IOException { return reader == null ? null : reader.readLine(); } + + public StdCommandHandler ofHandler(CommandHandler commandHandler, boolean readCommands) { + return new StdCommandHandler(commandHandler.categories, commandHandler.baseCategory, readCommands); + } + + public StdCommandHandler ofHandler(CommandHandler commandHandler, InputStream stream) { + return new StdCommandHandler(commandHandler.categories, commandHandler.baseCategory, stream); + } + + public StdCommandHandler ofHandler(CommandHandler commandHandler, BufferedReader reader) { + return new StdCommandHandler(commandHandler.categories, commandHandler.baseCategory, reader); + } } From d7a379383b1f76f144210541ec0cbca396eb7070 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Tue, 31 Dec 2024 14:35:42 +0700 Subject: [PATCH 09/10] [FIX] Remove socket command debug --- .../java/pro/gravit/launchserver/socket/SocketCommandServer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/SocketCommandServer.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/SocketCommandServer.java index c2b06896..d6a04a38 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/SocketCommandServer.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/SocketCommandServer.java @@ -73,7 +73,6 @@ public void run() { if (bytesRead < 0) { break; } - logger.info("DEBUG: readed {}", new String(buffer.array(), 0, buffer.limit())); for (var i=0;i Date: Fri, 3 Jan 2025 12:55:33 +0700 Subject: [PATCH 10/10] [ANY] 5.6.9 stable --- LauncherCore/src/main/java/pro/gravit/utils/Version.java | 2 +- build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LauncherCore/src/main/java/pro/gravit/utils/Version.java b/LauncherCore/src/main/java/pro/gravit/utils/Version.java index 65e30118..f5632187 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/Version.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/Version.java @@ -6,7 +6,7 @@ public final class Version implements Comparable { public static final int MAJOR = 5; public static final int MINOR = 6; - public static final int PATCH = 8; + public static final int PATCH = 9; public static final int BUILD = 1; public static final Version.Type RELEASE = Type.STABLE; public final int major; diff --git a/build.gradle b/build.gradle index 6e5a6b23..43de18a3 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ id 'org.openjfx.javafxplugin' version '0.1.0' apply false } group = 'pro.gravit.launcher' -version = '5.6.8' +version = '5.6.9' apply from: 'props.gradle'