Compare commits

...

30 commits

Author SHA1 Message Date
Metall
24f6b34e5a
Merge 05530b6664 into 911ca1e69f 2025-05-06 04:45:59 +00:00
Gravita
911ca1e69f [FIX] Duplicate classpath and modulepath entities 2025-05-04 22:03:28 +07:00
Gravita
90f74aaf25 [FEATURE] Build ServerWrapper inline jar 2025-05-04 21:54:51 +07:00
Gravita
880957fa9b [FEATURE] Support inline initialization in DebugMain 2025-05-04 21:18:03 +07:00
Gravita
2fea94071b [FEATURE] Support runCompatClasses in ServerWrapperInlineInitializer 2025-05-04 21:12:57 +07:00
Gravita
b41e8db336 [FEATURE] Add ServerWrapperInlineInitializer 2025-05-04 19:38:34 +07:00
Gravita
76570ddbe5 [FEATURE] Support directories in classpath in ServerWrapper 2025-05-04 19:02:46 +07:00
Gravita
3a160b8124 Merge tag 'v5.6.14' into dev
5.6.14 stable
2025-05-04 17:58:08 +07:00
Gravita
8fb1dc275c Merge branch 'release/5.6.14' 2025-05-04 17:57:55 +07:00
Gravita
95aed151e7 [ANY] 5.6.14 2025-05-04 17:57:46 +07:00
Gravita
6934c37a33 [FIX] Wrong if in clientType 2025-05-04 05:35:35 +07:00
Gravita
5155c470c6 Merge tag 'v5.6.13' into dev
5.6.13 stable release
2025-05-03 23:59:13 +07:00
Gravita
533dcfce14 Merge branch 'release/5.6.13' 2025-05-03 23:58:58 +07:00
Gravita
d2f83d81eb [ANY] 5.6.13 stable 2025-05-03 23:58:41 +07:00
Gravita
2379398c30 [ANY] Update gradle to 8.14 2025-05-03 23:26:34 +07:00
Gravita
f53c48a5ae [ANY] Update gradle 2025-05-03 23:24:30 +07:00
Gravita
394b64e22d Merge tag 'v5.6.12' into dev
5.6.12 stable release
2025-05-03 23:11:55 +07:00
Gravita
7c15742478 Merge branch 'release/5.6.12' 2025-05-03 23:11:40 +07:00
Gravita
d65fffade9 [ANY] 5.6.12 release 2025-05-03 23:11:33 +07:00
Gravita
bb6c95ca12 [FEATURE] Support multiple lwjgl3 versions 2025-05-03 22:43:06 +07:00
Gravita
9027987b29 [FEATURE] Support multiple client types 2025-05-03 22:31:04 +07:00
Gravita
d410533c8d [FEATURE][EXPERIMENTAL] Add javaargs.txt and java24args.txt 2025-04-25 18:04:16 +07:00
Gravita
af2c5c33e8 [FEATURE][EXPERIMENTAL] Usage Java modular system for start, change proguard libraries 2025-04-25 17:54:00 +07:00
Gravita
e67bb6a12f [FEATURE] Support /webapi/status endpoint for Docker 2025-04-25 14:58:02 +07:00
Gravita
e2e0ef6ea4 [FEATURE] Support enableNativeAccess, fix libraries modularity 2025-04-25 14:49:51 +07:00
Metall
05530b6664
Merge branch 'GravitLauncher:master' into master 2024-07-23 20:33:25 +05:00
Metall
8f20cbe104
Merge branch 'GravitLauncher:master' into master 2023-03-27 20:27:50 +05:00
Metall
66d8b9d9ca
Update PasswordVerifier.java
Убрал исключения для совместимости
2022-09-21 09:29:13 +05:00
Metall
90ee90973e
Update PasswordVerifier.java
Добавил:
1. Способ верификации "django", для осуществления авторизации с помощью PBKDF2 с SHA256.
2. Исключение на отсутствующий алгоритм(NoSuchAlgorithmException)
3. Исключение на неверные ключи(InvalidKeySpecException)
2022-09-21 08:40:40 +05:00
Metall
8bf58cff18
Create DjangoPasswordVerifier.java
Верификация PBKDF2_SHA256
2022-09-21 08:32:53 +05:00
28 changed files with 320 additions and 80 deletions

View file

@ -39,9 +39,12 @@ jobs:
cp LaunchServer.jar ../../../artifacts/LaunchServer.jar cp LaunchServer.jar ../../../artifacts/LaunchServer.jar
cd ../../.. cd ../../..
cp ServerWrapper/build/libs/ServerWrapper.jar artifacts/ServerWrapper.jar cp ServerWrapper/build/libs/ServerWrapper.jar artifacts/ServerWrapper.jar
cp ServerWrapper/build/libs/ServerWrapper-inline.jar artifacts/ServerWrapperInline.jar
cp LauncherAuthlib/build/libs/LauncherAuthlib.jar artifacts/LauncherAuthlib.jar || true cp LauncherAuthlib/build/libs/LauncherAuthlib.jar artifacts/LauncherAuthlib.jar || true
cp modules/*_module/build/libs/*.jar artifacts/modules || true cp modules/*_module/build/libs/*.jar artifacts/modules || true
cp modules/*_lmodule/build/libs/*.jar artifacts/modules || true cp modules/*_lmodule/build/libs/*.jar artifacts/modules || true
cp javaargs.txt artifacts/javaargs.txt || true
cp java24args.txt artifacts/java24args.txt || true
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4

View file

@ -29,6 +29,7 @@
bundleOnly bundleOnly
bundle bundle
pack pack
proguardPack
bundleOnly.extendsFrom bundle bundleOnly.extendsFrom bundle
api.extendsFrom bundle, pack api.extendsFrom bundle, pack
} }
@ -36,11 +37,13 @@
jar { jar {
dependsOn parent.childProjects.Launcher.tasks.assemble dependsOn parent.childProjects.Launcher.tasks.assemble
from { configurations.pack.collect { it.isDirectory() ? it : zipTree(it) } } from { configurations.pack.collect { it.isDirectory() ? it : zipTree(it) } }
exclude("module-info.class")
from(parent.childProjects.Launcher.tasks.shadowJar) from(parent.childProjects.Launcher.tasks.shadowJar)
from(parent.childProjects.Launcher.tasks.genRuntimeJS) from(parent.childProjects.Launcher.tasks.genRuntimeJS)
manifest.attributes("Main-Class": mainClassName, manifest.attributes("Main-Class": mainClassName,
"Premain-Class": mainAgentName, "Premain-Class": mainAgentName,
"Multi-Release": "true", "Multi-Release": "true",
"Automatic-Module-Name": "launchserver"
) )
} }
@ -72,22 +75,25 @@
dependencies { dependencies {
pack project(':LauncherAPI') pack(project(':LauncherAPI')) {
exclude group: "com.google.code.gson"
}
bundle group: 'com.google.code.gson', name: 'gson', version: rootProject['verGson']
bundle group: 'me.tongfei', name: 'progressbar', version: '0.10.1' bundle group: 'me.tongfei', name: 'progressbar', version: '0.10.1'
bundle group: 'org.fusesource.jansi', name: 'jansi', version: rootProject['verJansi'] bundle group: 'org.fusesource.jansi', name: 'jansi', version: rootProject['verJansi']
bundle group: 'org.jline', name: 'jline', version: rootProject['verJline'] bundle group: 'org.jline', name: 'jline-native', version: rootProject['verJline']
bundle group: 'org.jline', name: 'jline-reader', version: rootProject['verJline'] bundle group: 'org.jline', name: 'jline-reader', version: rootProject['verJline']
bundle group: 'org.jline', name: 'jline-terminal', version: rootProject['verJline'] bundle group: 'org.jline', name: 'jline-terminal-ffm', version: rootProject['verJline']
bundle group: 'org.bouncycastle', name: 'bcprov-jdk18on', version: rootProject['verBcpkix'] bundle group: 'org.bouncycastle', name: 'bcprov-jdk18on', version: rootProject['verBcpkix']
bundle group: 'org.bouncycastle', name: 'bcpkix-jdk18on', version: rootProject['verBcpkix'] bundle group: 'org.bouncycastle', name: 'bcpkix-jdk18on', version: rootProject['verBcpkix']
bundle group: 'org.ow2.asm', name: 'asm-commons', version: rootProject['verAsm'] bundle group: 'org.ow2.asm', name: 'asm-commons', version: rootProject['verAsm']
bundle group: 'io.netty', name: 'netty-codec-http', version: rootProject['verNetty'] bundle group: 'io.netty', name: 'netty-codec-http', version: rootProject['verNetty']
bundle group: 'io.netty', name: 'netty-transport-classes-epoll', version: rootProject['verNetty'] bundle group: 'io.netty', name: 'netty-transport-classes-epoll', version: rootProject['verNetty']
bundle group: 'io.netty', name: 'netty-transport-native-epoll', version: rootProject['verNetty'], classifier: 'linux-x86_64' bundle group: 'io.netty', name: 'netty-transport-native-epoll', version: rootProject['verNetty'], classifier: 'linux-x86_64'
bundle group: 'io.netty', name: 'netty-transport-native-epoll', version: rootProject['verNetty'], classifier: 'linux-aarch_64' //bundle group: 'io.netty', name: 'netty-transport-native-epoll', version: rootProject['verNetty'], classifier: 'linux-aarch_64'
bundle group: 'io.netty', name: 'netty-transport-classes-io_uring', version: rootProject['verNetty'] bundle group: 'io.netty', name: 'netty-transport-classes-io_uring', version: rootProject['verNetty']
bundle group: 'io.netty', name: 'netty-transport-native-io_uring', version: rootProject['verNetty'], classifier: 'linux-x86_64' bundle group: 'io.netty', name: 'netty-transport-native-io_uring', version: rootProject['verNetty'], classifier: 'linux-x86_64'
bundle group: 'io.netty', name: 'netty-transport-native-io_uring', version: rootProject['verNetty'], classifier: 'linux-aarch_64' //bundle group: 'io.netty', name: 'netty-transport-native-io_uring', version: rootProject['verNetty'], classifier: 'linux-aarch_64'
// Netty // Netty
bundle 'org.jboss.marshalling:jboss-marshalling:1.4.11.Final' bundle 'org.jboss.marshalling:jboss-marshalling:1.4.11.Final'
bundle 'com.google.protobuf.nano:protobuf-javanano:3.1.0' bundle 'com.google.protobuf.nano:protobuf-javanano:3.1.0'
@ -97,7 +103,7 @@ pack project(':LauncherAPI')
bundle group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: rootProject['verMariaDBConn'] bundle group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: rootProject['verMariaDBConn']
bundle group: 'org.postgresql', name: 'postgresql', version: rootProject['verPostgreSQLConn'] bundle group: 'org.postgresql', name: 'postgresql', version: rootProject['verPostgreSQLConn']
bundle group: 'com.h2database', name: 'h2', version: rootProject['verH2Conn'] bundle group: 'com.h2database', name: 'h2', version: rootProject['verH2Conn']
bundle group: 'com.guardsquare', name: 'proguard-base', version: rootProject['verProguard'] proguardPack group: 'com.guardsquare', name: 'proguard-base', version: rootProject['verProguard']
bundle group: 'org.apache.logging.log4j', name: 'log4j-core', version: rootProject['verLog4j'] bundle group: 'org.apache.logging.log4j', name: 'log4j-core', version: rootProject['verLog4j']
bundle group: 'org.apache.logging.log4j', name: 'log4j-slf4j2-impl', version: rootProject['verLog4j'] bundle group: 'org.apache.logging.log4j', name: 'log4j-slf4j2-impl', version: rootProject['verLog4j']
bundle group: 'io.jsonwebtoken', name: 'jjwt-api', version: rootProject['verJwt'] bundle group: 'io.jsonwebtoken', name: 'jjwt-api', version: rootProject['verJwt']
@ -121,6 +127,12 @@ pack project(':LauncherAPI')
from configurations.bundleOnly from configurations.bundleOnly
} }
tasks.register('dumpProguard', Copy) {
duplicatesStrategy = 'EXCLUDE'
into "$buildDir/libs/proguard"
from configurations.proguardPack
}
tasks.register('bundle', Zip) { tasks.register('bundle', Zip) {
duplicatesStrategy = 'EXCLUDE' duplicatesStrategy = 'EXCLUDE'
dependsOn parent.childProjects.Launcher.tasks.build, tasks.dumpLibs, tasks.jar dependsOn parent.childProjects.Launcher.tasks.build, tasks.dumpLibs, tasks.jar
@ -137,7 +149,7 @@ pack project(':LauncherAPI')
from parent.childProjects.Launcher.tasks.dumpLibs from parent.childProjects.Launcher.tasks.dumpLibs
} }
assemble.dependsOn tasks.dumpLibs, tasks.dumpClientLibs, tasks.bundle, tasks.cleanjar assemble.dependsOn tasks.dumpLibs, tasks.dumpClientLibs, tasks.bundle, tasks.cleanjar, tasks.dumpProguard
publishing { publishing {

View file

@ -82,6 +82,7 @@ public final class LaunchServer implements Runnable, AutoCloseable, Reconfigurab
public final Path launcherModulesDir; public final Path launcherModulesDir;
public final Path librariesDir; public final Path librariesDir;
public final Path controlFile; public final Path controlFile;
public final Path proguardDir;
/** /**
* This object contains runtime configuration * This object contains runtime configuration
*/ */
@ -138,6 +139,7 @@ public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, La
launcherModulesDir = directories.launcherModules; launcherModulesDir = directories.launcherModules;
librariesDir = directories.librariesDir; librariesDir = directories.librariesDir;
controlFile = directories.controlFile; controlFile = directories.controlFile;
proguardDir = directories.proguardDir;
this.shardId = shardId; this.shardId = shardId;
if(!Files.isDirectory(launcherPack)) { if(!Files.isDirectory(launcherPack)) {
Files.createDirectories(launcherPack); Files.createDirectories(launcherPack);
@ -462,13 +464,16 @@ public interface LaunchServerConfigManager {
public static class LaunchServerDirectories { public static class LaunchServerDirectories {
public static final String UPDATES_NAME = "updates", public static final String UPDATES_NAME = "updates",
TRUSTSTORE_NAME = "truststore", LAUNCHERLIBRARIES_NAME = "launcher-libraries", 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", CONTROL_FILE = "control-file"; LAUNCHERLIBRARIESCOMPILE_NAME = "launcher-libraries-compile", LAUNCHERPACK_NAME = "launcher-pack",
KEY_NAME = ".keys", MODULES = "modules", LAUNCHER_MODULES = "launcher-modules",
LIBRARIES = "libraries", CONTROL_FILE = "control-file", PROGUARD_DIR = "proguard-libraries";
public Path updatesDir; public Path updatesDir;
public Path librariesDir; public Path librariesDir;
public Path launcherLibrariesDir; public Path launcherLibrariesDir;
public Path launcherLibrariesCompileDir; public Path launcherLibrariesCompileDir;
public Path launcherPackDir; public Path launcherPackDir;
public Path keyDirectory; public Path keyDirectory;
public Path proguardDir;
public Path dir; public Path dir;
public Path trustStore; public Path trustStore;
public Path tmpDir; public Path tmpDir;
@ -489,6 +494,7 @@ public void collect() {
if (launcherModules == null) launcherModules = getPath(LAUNCHER_MODULES); if (launcherModules == null) launcherModules = getPath(LAUNCHER_MODULES);
if (librariesDir == null) librariesDir = getPath(LIBRARIES); if (librariesDir == null) librariesDir = getPath(LIBRARIES);
if (controlFile == null) controlFile = getPath(CONTROL_FILE); if (controlFile == null) controlFile = getPath(CONTROL_FILE);
if (proguardDir == null) proguardDir = getPath(PROGUARD_DIR);
if (tmpDir == null) if (tmpDir == null)
tmpDir = Paths.get(System.getProperty("java.io.tmpdir")).resolve("launchserver-%s".formatted(SecurityHelper.randomStringToken())); tmpDir = Paths.get(System.getProperty("java.io.tmpdir")).resolve("launchserver-%s".formatted(SecurityHelper.randomStringToken()));
} }

View file

@ -18,7 +18,7 @@
import java.util.stream.Stream; import java.util.stream.Stream;
public class Main { public class Main {
private static final List<String> classpathOnly = List.of("proguard", "jline", "progressbar", "kotlin"); private static final List<String> classpathOnly = List.of("proguard", "progressbar", "kotlin");
private static final String LOG4J_PROPERTY = "log4j2.configurationFile"; private static final String LOG4J_PROPERTY = "log4j2.configurationFile";
private static final String DEBUG_PROPERTY = "launchserver.main.debug"; private static final String DEBUG_PROPERTY = "launchserver.main.debug";
private static final String LIBRARIES_PROPERTY = "launchserver.dir.libraries"; private static final String LIBRARIES_PROPERTY = "launchserver.dir.libraries";
@ -74,6 +74,8 @@ public static void main(String[] args) throws Throwable {
classpath.add(IOHelper.getCodeSource(LaunchServerStarter.class)); classpath.add(IOHelper.getCodeSource(LaunchServerStarter.class));
options.moduleConf.modulePath.addAll(modulepath); options.moduleConf.modulePath.addAll(modulepath);
options.moduleConf.modules.add("ALL-MODULE-PATH"); options.moduleConf.modules.add("ALL-MODULE-PATH");
options.moduleConf.enableNativeAccess.add("org.fusesource.jansi");
options.moduleConf.enableNativeAccess.add("io.netty.common");
ClassLoaderControl control = launch.init(classpath, "natives", options); ClassLoaderControl control = launch.init(classpath, "natives", options);
control.clearLauncherPackages(); control.clearLauncherPackages();
control.addLauncherPackage("pro.gravit.utils.launch"); control.addLauncherPackage("pro.gravit.utils.launch");

View file

@ -1,16 +1,17 @@
package pro.gravit.launchserver.asm; package pro.gravit.launchserver.asm;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.Opcodes; import org.objectweb.asm.Opcodes;
import pro.gravit.utils.helper.IOHelper; import pro.gravit.utils.helper.IOHelper;
import java.io.Closeable; import java.io.Closeable;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.*;
import java.util.Collections;
import java.util.List;
import java.util.jar.JarFile; import java.util.jar.JarFile;
/** /**
@ -18,14 +19,32 @@
* чего угодно. Работает через поиск class-файлов в classpath. * чего угодно. Работает через поиск class-файлов в classpath.
*/ */
public class ClassMetadataReader implements Closeable { public class ClassMetadataReader implements Closeable {
private final Logger logger = LogManager.getLogger(ClassMetadataReader.class);
private final List<JarFile> cp; private final List<JarFile> cp;
private final Map<String, Module> moduleClassFinder;
public ClassMetadataReader(List<JarFile> cp) { public ClassMetadataReader(List<JarFile> cp) {
this.cp = cp; this.cp = cp;
//var moduleLayer = ClassMetadataReader.class.getModule().getLayer() == null ? ModuleLayer.boot() : ClassMetadataReader.class.getModule().getLayer();
var moduleLayer = ModuleLayer.boot();
moduleClassFinder = collectModulePackages(moduleLayer);
} }
public ClassMetadataReader() { public ClassMetadataReader() {
this.cp = new ArrayList<>(); this.cp = new ArrayList<>();
//var moduleLayer = ClassMetadataReader.class.getModule().getLayer() == null ? ModuleLayer.boot() : ClassMetadataReader.class.getModule().getLayer();
var moduleLayer = ModuleLayer.boot();
moduleClassFinder = collectModulePackages(moduleLayer);
}
private Map<String, Module> collectModulePackages(ModuleLayer layer) {
var map = new HashMap<String, Module>();
for(var m : layer.modules()) {
for(var p : m.getPackages()) {
map.put(p, m);
}
}
return map;
} }
public List<JarFile> getCp() { public List<JarFile> getCp() {
@ -58,7 +77,42 @@ public byte[] getClassData(String className) throws IOException {
return bytes; return bytes;
} }
} }
return IOHelper.read(IOHelper.getResourceURL(className + ".class")); if(ClassMetadataReader.class.getModule().isNamed()) {
String pkg = getClassPackage(className).replace('/', '.');
var module = moduleClassFinder.get(pkg);
if(module != null) {
var cl = module.getClassLoader();
if(cl == null) {
cl = ClassLoader.getPlatformClassLoader();
}
var stream = cl.getResourceAsStream(className+".class");
if(stream != null) {
try(stream) {
return IOHelper.read(stream);
}
} else {
throw new FileNotFoundException("Class "+className + ".class");
}
} else {
throw new FileNotFoundException("Package "+pkg);
}
}
var stream = ClassLoader.getSystemClassLoader().getResourceAsStream(className+".class");
if(stream != null) {
try(stream) {
return IOHelper.read(stream);
}
} else {
throw new FileNotFoundException(className + ".class");
}
}
private String getClassPackage(String type) {
int idx = type.lastIndexOf("/");
if(idx <= 0) {
return type;
}
return type.substring(0, idx);
} }
public String getSuperClass(String type) { public String getSuperClass(String type) {
@ -66,6 +120,7 @@ public String getSuperClass(String type) {
try { try {
return getSuperClassASM(type); return getSuperClassASM(type);
} catch (Exception e) { } catch (Exception e) {
logger.warn("getSuperClass: type {} not found ({}: {})", type, e.getClass().getName(), e.getMessage());
return "java/lang/Object"; return "java/lang/Object";
} }
} }
@ -100,7 +155,7 @@ private static class CheckSuperClassVisitor extends ClassVisitor {
String superClassName; String superClassName;
public CheckSuperClassVisitor() { public CheckSuperClassVisitor() {
super(Opcodes.ASM7); super(Opcodes.ASM9);
} }
@Override @Override

View file

@ -0,0 +1,42 @@
package pro.gravit.launchserver.auth.password;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator;
import org.bouncycastle.crypto.params.KeyParameter;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
public class DjangoPasswordVerifier extends PasswordVerifier {
public final Integer DEFAULT_ITERATIONS = 10000;
private static final Logger logger = LogManager.getLogger();
private static final String algorithm = "pbkdf2_sha256";
public String getEncodedHash(String password, String salt, int iterations) {
PKCS5S2ParametersGenerator generator = new PKCS5S2ParametersGenerator(new SHA256Digest());
generator.init(password.getBytes(StandardCharsets.UTF_8), salt.getBytes(), iterations);
byte[] dk = ((KeyParameter) generator.generateDerivedParameters(256)).getKey();
byte[] hashBase64 = Base64.getEncoder().encode(dk);
return new String(hashBase64);
}
public String encode(String password, String salt, int iterations) {
String hash = getEncodedHash(password, salt, iterations);
return String.format("%s$%d$%s$%s", algorithm, iterations, salt, hash);
}
@Override
public boolean check(String encryptedPassword, String password) {
String[] params = encryptedPassword.split("\\$");
if (params.length != 4) {
logger.warn(" end 1 " + params.length);
return false;
}
int iterations = Integer.parseInt(params[1]);
String salt = params[2];
String hash = encode(password, salt, iterations);
return hash.equals(encryptedPassword);
}
}

View file

@ -15,6 +15,7 @@ public static void registerProviders() {
providers.register("bcrypt", BCryptPasswordVerifier.class); providers.register("bcrypt", BCryptPasswordVerifier.class);
providers.register("accept", AcceptPasswordVerifier.class); providers.register("accept", AcceptPasswordVerifier.class);
providers.register("reject", RejectPasswordVerifier.class); providers.register("reject", RejectPasswordVerifier.class);
providers.register("django", DjangoPasswordVerifier.class);
registeredProviders = true; registeredProviders = true;
} }
} }

View file

@ -54,7 +54,7 @@ public static void apply(Path inputFile, Path addFile, ZipOutputStream output, L
private static byte[] classFix(InputStream input, ClassMetadataReader reader, boolean stripNumbers) throws IOException { private static byte[] classFix(InputStream input, ClassMetadataReader reader, boolean stripNumbers) throws IOException {
ClassReader cr = new ClassReader(input); ClassReader cr = new ClassReader(input);
ClassNode cn = new ClassNode(); ClassNode cn = new ClassNode();
cr.accept(cn, stripNumbers ? (ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES) : ClassReader.SKIP_FRAMES); cr.accept(cn, stripNumbers ? (ClassReader.SKIP_DEBUG) : 0);
ClassWriter cw = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); ClassWriter cw = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
cn.accept(cw); cn.accept(cw);
return cw.toByteArray(); return cw.toByteArray();

View file

@ -146,7 +146,7 @@ public byte[] transformClass(byte[] bytes, String classname, BuildContext contex
asmTransformer.transform(cn, classname, context); asmTransformer.transform(cn, classname, context);
continue; continue;
} else if (cn != null) { } else if (cn != null) {
writer = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); writer = new SafeClassWriter(reader, 0);
cn.accept(writer); cn.accept(writer);
result = writer.toByteArray(); result = writer.toByteArray();
} }
@ -157,7 +157,7 @@ public byte[] transformClass(byte[] bytes, String classname, BuildContext contex
} }
} }
if (cn != null) { if (cn != null) {
writer = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); writer = new SafeClassWriter(reader, 0);
cn.accept(writer); cn.accept(writer);
result = writer.toByteArray(); result = writer.toByteArray();
} }
@ -175,7 +175,7 @@ default byte[] transform(byte[] input, String classname, BuildContext context) {
ClassNode cn = new ClassNode(); ClassNode cn = new ClassNode();
reader.accept(cn, 0); reader.accept(cn, 0);
transform(cn, classname, context); transform(cn, classname, context);
SafeClassWriter writer = new SafeClassWriter(context.task.reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); SafeClassWriter writer = new SafeClassWriter(context.task.reader, 0);
cn.accept(writer); cn.accept(writer);
return writer.toByteArray(); return writer.toByteArray();
} }

View file

@ -213,7 +213,7 @@ public Path process(Path inputFile) throws IOException {
args.add(IOHelper.resolveJavaBin(IOHelper.JVM_DIR).toAbsolutePath().toString()); args.add(IOHelper.resolveJavaBin(IOHelper.JVM_DIR).toAbsolutePath().toString());
args.addAll(component.jvmArgs); args.addAll(component.jvmArgs);
args.add("-cp"); args.add("-cp");
try(Stream<Path> files = Files.walk(server.librariesDir, FileVisitOption.FOLLOW_LINKS)) { try(Stream<Path> files = Files.walk(server.proguardDir, FileVisitOption.FOLLOW_LINKS)) {
args.add(files args.add(files
.filter(e -> e.getFileName().toString().endsWith(".jar")) .filter(e -> e.getFileName().toString().endsWith(".jar"))
.map(path -> path.toAbsolutePath().toString()) .map(path -> path.toAbsolutePath().toString())

View file

@ -9,6 +9,7 @@
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import pro.gravit.launcher.base.Launcher; import pro.gravit.launcher.base.Launcher;
import pro.gravit.launchserver.socket.NettyConnectContext; import pro.gravit.launchserver.socket.NettyConnectContext;
import pro.gravit.launchserver.socket.severlet.StatusSeverlet;
import pro.gravit.utils.helper.IOHelper; import pro.gravit.utils.helper.IOHelper;
import java.net.URLDecoder; import java.net.URLDecoder;
@ -34,6 +35,7 @@ public class NettyWebAPIHandler extends SimpleChannelInboundHandler<FullHttpRequ
public NettyWebAPIHandler(NettyConnectContext context) { public NettyWebAPIHandler(NettyConnectContext context) {
super(); super();
this.context = context; this.context = context;
addNewSeverlet("status", new StatusSeverlet());
} }
public static void addNewSeverlet(String path, SimpleSeverletHandler callback) { public static void addNewSeverlet(String path, SimpleSeverletHandler callback) {

View file

@ -0,0 +1,15 @@
package pro.gravit.launchserver.socket.severlet;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpResponseStatus;
import pro.gravit.launchserver.socket.NettyConnectContext;
import pro.gravit.launchserver.socket.handlers.NettyWebAPIHandler;
public class StatusSeverlet implements NettyWebAPIHandler.SimpleSeverletHandler {
@Override
public void handle(ChannelHandlerContext ctx, FullHttpRequest msg, NettyConnectContext context) {
sendHttpResponse(ctx, new DefaultFullHttpResponse(msg.protocolVersion(), HttpResponseStatus.OK));
}
}

View file

@ -28,6 +28,7 @@ public class DebugMain {
public static String webSocketURL = System.getProperty("launcherdebug.websocket", "ws://localhost:9274/api"); public static String webSocketURL = System.getProperty("launcherdebug.websocket", "ws://localhost:9274/api");
public static String projectName = System.getProperty("launcherdebug.projectname", "Minecraft"); public static String projectName = System.getProperty("launcherdebug.projectname", "Minecraft");
public static String unlockSecret = System.getProperty("launcherdebug.unlocksecret", ""); public static String unlockSecret = System.getProperty("launcherdebug.unlocksecret", "");
public static boolean disableConsole = Boolean.getBoolean("launcherdebug.disableConsole");
public static boolean offlineMode = Boolean.getBoolean("launcherdebug.offlinemode"); public static boolean offlineMode = Boolean.getBoolean("launcherdebug.offlinemode");
public static boolean disableAutoRefresh = Boolean.getBoolean("launcherdebug.disableautorefresh"); public static boolean disableAutoRefresh = Boolean.getBoolean("launcherdebug.disableautorefresh");
public static String[] moduleClasses = System.getProperty("launcherdebug.modules", "").split(","); public static String[] moduleClasses = System.getProperty("launcherdebug.modules", "").split(",");
@ -37,6 +38,14 @@ public class DebugMain {
public static void main(String[] args) throws Throwable { public static void main(String[] args) throws Throwable {
LogHelper.printVersion("Launcher"); LogHelper.printVersion("Launcher");
LogHelper.printLicense("Launcher"); LogHelper.printLicense("Launcher");
initialize();
LogHelper.debug("Initialization LauncherEngine");
LauncherEngine instance = LauncherEngine.newInstance(false, ClientRuntimeProvider.class);
instance.start(args);
LauncherEngine.exitLauncher(0);
}
public static void initialize() throws Exception {
IS_DEBUG.set(true); IS_DEBUG.set(true);
LogHelper.info("Launcher start in DEBUG mode (Only for developers)"); LogHelper.info("Launcher start in DEBUG mode (Only for developers)");
LogHelper.debug("Initialization LauncherConfig"); LogHelper.debug("Initialization LauncherConfig");
@ -56,7 +65,9 @@ public static void main(String[] args) throws Throwable {
} }
LauncherEngine.modulesManager.initModules(null); LauncherEngine.modulesManager.initModules(null);
LauncherEngine.initGson(LauncherEngine.modulesManager); LauncherEngine.initGson(LauncherEngine.modulesManager);
ConsoleManager.initConsole(); if(!disableConsole) {
ConsoleManager.initConsole();
}
LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase()); LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase());
RequestService service; RequestService service;
if (offlineMode) { if (offlineMode) {
@ -72,10 +83,6 @@ public static void main(String[] args) throws Throwable {
if(!disableAutoRefresh) { if(!disableAutoRefresh) {
Request.startAutoRefresh(); Request.startAutoRefresh();
} }
LogHelper.debug("Initialization LauncherEngine");
LauncherEngine instance = LauncherEngine.newInstance(false, ClientRuntimeProvider.class);
instance.start(args);
LauncherEngine.exitLauncher(0);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View file

@ -0,0 +1,7 @@
package pro.gravit.launcher.runtime.debug;
public class DebugMainInlineInitializer {
public static void run() throws Exception {
DebugMain.initialize();
}
}

View file

@ -116,15 +116,6 @@ private static void realMain(String[] args) throws Throwable {
// Verify ClientLauncher sign and classpath // Verify ClientLauncher sign and classpath
LogHelper.debug("Verifying ClientLauncher sign and classpath"); LogHelper.debug("Verifying ClientLauncher sign and classpath");
Set<Path> ignoredPath = new HashSet<>();
List<Path> classpath = resolveClassPath(ignoredPath, clientDir, params.actions, params.profile)
.collect(Collectors.toCollection(ArrayList::new));
if(LogHelper.isDevEnabled()) {
for(var e : classpath) {
LogHelper.dev("Classpath entry %s", e);
}
}
List<URL> classpathURLs = classpath.stream().map(IOHelper::toURL).toList();
// Start client with WatchService monitoring // Start client with WatchService monitoring
RequestService service; RequestService service;
if (params.offlineMode) { if (params.offlineMode) {
@ -158,6 +149,18 @@ private static void realMain(String[] args) throws Throwable {
System.load(Paths.get(params.nativesDir).resolve(ClientService.findLibrary(e)).toAbsolutePath().toString()); System.load(Paths.get(params.nativesDir).resolve(ClientService.findLibrary(e)).toAbsolutePath().toString());
} }
} }
Set<Path> ignoredPath = new HashSet<>();
if(options.moduleConf != null && options.moduleConf.modulePath != null) {
List<Path> resolvedModulePath = resolveClassPath(ignoredPath, clientDir, null, params.profile).toList();
}
List<Path> classpath = resolveClassPath(ignoredPath, clientDir, params.actions, params.profile)
.collect(Collectors.toCollection(ArrayList::new));
if(LogHelper.isDevEnabled()) {
for(var e : classpath) {
LogHelper.dev("Classpath entry %s", e);
}
}
List<URL> classpathURLs = classpath.stream().map(IOHelper::toURL).toList();
if (classLoaderConfig == ClientProfile.ClassLoaderConfig.LAUNCHER || classLoaderConfig == ClientProfile.ClassLoaderConfig.MODULE) { if (classLoaderConfig == ClientProfile.ClassLoaderConfig.LAUNCHER || classLoaderConfig == ClientProfile.ClassLoaderConfig.MODULE) {
if(JVMHelper.JVM_VERSION <= 11) { if(JVMHelper.JVM_VERSION <= 11) {
launch = new LegacyLaunch(); launch = new LegacyLaunch();
@ -274,9 +277,11 @@ private static Stream<Path> resolveClassPathStream(Set<Path> ignorePaths, Path c
public static Stream<Path> resolveClassPath(Set<Path> ignorePaths, Path clientDir, Set<OptionalAction> actions, ClientProfile profile) throws IOException { public static Stream<Path> resolveClassPath(Set<Path> ignorePaths, Path clientDir, Set<OptionalAction> actions, ClientProfile profile) throws IOException {
Stream<Path> result = resolveClassPathStream(ignorePaths, clientDir, profile.getClassPath()); Stream<Path> result = resolveClassPathStream(ignorePaths, clientDir, profile.getClassPath());
for (OptionalAction a : actions) { if(actions != null) {
if (a instanceof OptionalActionClassPath) for (OptionalAction a : actions) {
result = Stream.concat(result, resolveClassPathStream(ignorePaths, clientDir, ((OptionalActionClassPath) a).args)); if (a instanceof OptionalActionClassPath)
result = Stream.concat(result, resolveClassPathStream(ignorePaths, clientDir, ((OptionalActionClassPath) a).args));
}
} }
return result; return result;
} }

View file

@ -6,7 +6,7 @@ public final class Version implements Comparable<Version> {
public static final int MAJOR = 5; public static final int MAJOR = 5;
public static final int MINOR = 6; public static final int MINOR = 6;
public static final int PATCH = 11; public static final int PATCH = 14;
public static final int BUILD = 1; public static final int BUILD = 1;
public static final Version.Type RELEASE = Type.STABLE; public static final Version.Type RELEASE = Type.STABLE;
public final int major; public final int major;

View file

@ -14,5 +14,6 @@ public static final class ModuleConf {
public Map<String, String> exports = new HashMap<>(); public Map<String, String> exports = new HashMap<>();
public Map<String, String> opens = new HashMap<>(); public Map<String, String> opens = new HashMap<>();
public Map<String, String> reads = new HashMap<>(); public Map<String, String> reads = new HashMap<>();
public List<String> enableNativeAccess = new ArrayList<>();
} }
} }

View file

@ -29,6 +29,18 @@ public class ModuleLaunch implements Launch {
private ModuleLayer layer; private ModuleLayer layer;
private MethodHandles.Lookup hackLookup; private MethodHandles.Lookup hackLookup;
private boolean disablePackageDelegateSupport; private boolean disablePackageDelegateSupport;
private static final MethodHandle ENABLE_NATIVE_ACCESS;
static {
MethodHandle mh;
try {
mh = MethodHandles.lookup().findVirtual(ModuleLayer.Controller.class, "enableNativeAccess", MethodType.methodType(ModuleLayer.Controller.class, Module.class));
} catch (NoSuchMethodException | IllegalAccessException e) {
mh = null;
}
ENABLE_NATIVE_ACCESS = mh;
}
@Override @Override
public ClassLoaderControl init(List<Path> files, String nativePath, LaunchOptions options) { public ClassLoaderControl init(List<Path> files, String nativePath, LaunchOptions options) {
this.disablePackageDelegateSupport = options.disablePackageDelegateSupport; this.disablePackageDelegateSupport = options.disablePackageDelegateSupport;
@ -120,6 +132,20 @@ public ClassLoaderControl init(List<Path> files, String nativePath, LaunchOption
controller.addReads(source, target); controller.addReads(source, target);
} }
} }
for(var e : options.moduleConf.enableNativeAccess) {
LogHelper.dev("Enable Native Access %s", e);
Module source = layer.findModule(e).orElse(null);
if(source == null) {
throw new RuntimeException(String.format("Module %s not found", e));
}
if(ENABLE_NATIVE_ACCESS != null) {
try {
ENABLE_NATIVE_ACCESS.invoke(controller, source);
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
}
}
moduleClassLoader.initializeWithLayer(layer); moduleClassLoader.initializeWithLayer(layer);
} }
} }

View file

@ -48,6 +48,21 @@ pack project(':LauncherAPI')
exclude 'module-info.class' exclude 'module-info.class'
} }
tasks.register('inlinejar', Jar) {
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.filter {! (it.name =~ /gson.*\.jar/ || it.name =~ /error_prone_annotations.*\.jar/)}.collect { it.isDirectory() ? it : zipTree(it) }
}
from {
sourceSets.main.output
}
archiveClassifier.set('inline')
manifest.attributes("Main-Class": mainClassName,
"Automatic-Module-Name": "ServerWrapper"
)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
publishing { publishing {
publications { publications {
serverwrapperapi(MavenPublication) { serverwrapperapi(MavenPublication) {
@ -94,4 +109,4 @@ pack project(':LauncherAPI')
sign publishing.publications.serverwrapperapi sign publishing.publications.serverwrapperapi
} }
assemble.dependsOn tasks.shadowJar assemble.dependsOn tasks.shadowJar, tasks.inlinejar

View file

@ -25,15 +25,18 @@
import pro.gravit.utils.launch.*; import pro.gravit.utils.launch.*;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType; import java.lang.invoke.MethodType;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
public class ServerWrapper extends JsonConfigurable<ServerWrapper.Config> { public class ServerWrapper extends JsonConfigurable<ServerWrapper.Config> {
public static final Path configFile = Paths.get(System.getProperty("serverwrapper.configFile", "ServerWrapperConfig.json")); public static final Path configFile = Paths.get(System.getProperty("serverwrapper.configFile", "ServerWrapperConfig.json"));
@ -100,31 +103,20 @@ public void getProfiles() throws Exception {
} }
} }
public void run(String... args) throws Throwable {
public void initialize() throws Exception {
initGson(); initGson();
AuthRequest.registerProviders(); AuthRequest.registerProviders();
GetAvailabilityAuthRequest.registerProviders(); GetAvailabilityAuthRequest.registerProviders();
OptionalAction.registerProviders(); OptionalAction.registerProviders();
OptionalTrigger.registerProviders(); OptionalTrigger.registerProviders();
if (args.length > 0 && args[0].equalsIgnoreCase("setup") && !disableSetup) {
LogHelper.debug("Read ServerWrapperConfig.json");
loadConfig();
ServerWrapperSetup setup = new ServerWrapperSetup();
setup.run();
System.exit(0);
}
if (args.length > 1 && args[0].equalsIgnoreCase("installAuthlib") && !disableSetup) {
LogHelper.debug("Read ServerWrapperConfig.json");
loadConfig();
InstallAuthlib command = new InstallAuthlib();
command. run(args[1]);
System.exit(0);
}
LogHelper.debug("Read ServerWrapperConfig.json"); LogHelper.debug("Read ServerWrapperConfig.json");
loadConfig(); loadConfig();
}
public void connect() throws Exception {
config.applyEnv(); config.applyEnv();
updateLauncherConfig(); updateLauncherConfig();
Launcher.applyLauncherEnv(Objects.requireNonNullElse(config.env, LauncherConfig.LauncherEnvironment.STD));
StdWebSocketService service = StdWebSocketService.initWebSockets(config.address).get(); StdWebSocketService service = StdWebSocketService.initWebSockets(config.address).get();
service.reconnectCallback = () -> service.reconnectCallback = () ->
{ {
@ -136,11 +128,6 @@ public void run(String... args) throws Throwable {
LogHelper.error(e); LogHelper.error(e);
} }
}; };
if(config.properties != null) {
for(Map.Entry<String, String> e : config.properties.entrySet()) {
System.setProperty(e.getKey(), e.getValue());
}
}
Request.setRequestService(service); Request.setRequestService(service);
if (config.logFile != null) LogHelper.addOutput(IOHelper.newWriter(Paths.get(config.logFile), true)); if (config.logFile != null) LogHelper.addOutput(IOHelper.newWriter(Paths.get(config.logFile), true));
{ {
@ -153,6 +140,47 @@ public void run(String... args) throws Throwable {
if(config.encodedServerEcPublicKey != null) { if(config.encodedServerEcPublicKey != null) {
KeyService.serverEcPublicKey = SecurityHelper.toPublicECDSAKey(config.encodedServerEcPublicKey); KeyService.serverEcPublicKey = SecurityHelper.toPublicECDSAKey(config.encodedServerEcPublicKey);
} }
ClientService.nativePath = config.nativesDir;
ConfigService.serverName = config.serverName;
if(config.configServiceSettings != null) {
config.configServiceSettings.apply();
}
}
public void runCompatClasses() throws Throwable {
if(config.compatClasses != null) {
for (String e : config.compatClasses) {
Class<?> clazz = classLoaderControl == null ? Class.forName(e) : classLoaderControl.getClass(e);
MethodHandle runMethod = MethodHandles.lookup().findStatic(clazz, "run", MethodType.methodType(void.class, ClassLoaderControl.class));
runMethod.invoke(classLoaderControl);
}
}
}
public void run(String... args) throws Throwable {
initialize();
if (args.length > 0 && args[0].equalsIgnoreCase("setup") && !disableSetup) {
ServerWrapperSetup setup = new ServerWrapperSetup();
setup.run();
System.exit(0);
}
if (args.length > 1 && args[0].equalsIgnoreCase("installAuthlib") && !disableSetup) {
InstallAuthlib command = new InstallAuthlib();
command. run(args[1]);
System.exit(0);
}
connect();
if(config.properties != null) {
for(Map.Entry<String, String> e : config.properties.entrySet()) {
System.setProperty(e.getKey(), e.getValue());
}
}
if(config.encodedServerRsaPublicKey != null) {
KeyService.serverRsaPublicKey = SecurityHelper.toPublicRSAKey(config.encodedServerRsaPublicKey);
}
if(config.encodedServerEcPublicKey != null) {
KeyService.serverEcPublicKey = SecurityHelper.toPublicECDSAKey(config.encodedServerEcPublicKey);
}
String classname = (config.mainclass == null || config.mainclass.isEmpty()) ? args[0] : config.mainclass; String classname = (config.mainclass == null || config.mainclass.isEmpty()) ? args[0] : config.mainclass;
if (classname.isEmpty()) { if (classname.isEmpty()) {
LogHelper.error("MainClass not found. Please set MainClass for ServerWrapper.json or first commandline argument"); LogHelper.error("MainClass not found. Please set MainClass for ServerWrapper.json or first commandline argument");
@ -182,8 +210,6 @@ public void run(String... args) throws Throwable {
System.arraycopy(args, 1, real_args, 0, args.length - 1); System.arraycopy(args, 1, real_args, 0, args.length - 1);
} else real_args = args; } else real_args = args;
Launch launch; Launch launch;
ClientService.nativePath = config.nativesDir;
ConfigService.serverName = config.serverName;
if(config.loadNatives != null) { if(config.loadNatives != null) {
for(String e : config.loadNatives) { for(String e : config.loadNatives) {
System.load(Paths.get(config.nativesDir).resolve(ClientService.findLibrary(e)).toAbsolutePath().toString()); System.load(Paths.get(config.nativesDir).resolve(ClientService.findLibrary(e)).toAbsolutePath().toString());
@ -209,24 +235,27 @@ public void run(String... args) throws Throwable {
LaunchOptions options = new LaunchOptions(); LaunchOptions options = new LaunchOptions();
options.enableHacks = config.enableHacks; options.enableHacks = config.enableHacks;
options.moduleConf = config.moduleConf; options.moduleConf = config.moduleConf;
classLoaderControl = launch.init(config.classpath.stream().map(Paths::get).collect(Collectors.toCollection(ArrayList::new)), config.nativesDir, options); classLoaderControl = launch.init(config.classpath.stream()
.map(Paths::get)
.flatMap(p -> {
if(!Files.isDirectory(p)) {
return Stream.of(p);
}
try {
return Files.walk(p).filter(e -> e.getFileName().toString().endsWith(".jar"));
} catch (IOException e) {
throw new RuntimeException(e);
}
})
.collect(Collectors.toCollection(ArrayList::new)), config.nativesDir, options);
if(ServerAgent.isAgentStarted()) { if(ServerAgent.isAgentStarted()) {
ClientService.instrumentation = ServerAgent.inst; ClientService.instrumentation = ServerAgent.inst;
} }
ClientService.classLoaderControl = classLoaderControl; ClientService.classLoaderControl = classLoaderControl;
ClientService.baseURLs = classLoaderControl.getURLs(); ClientService.baseURLs = classLoaderControl.getURLs();
if(config.configServiceSettings != null) {
config.configServiceSettings.apply();
}
LogHelper.info("Start Minecraft Server"); LogHelper.info("Start Minecraft Server");
try { try {
if(config.compatClasses != null) { runCompatClasses();
for (String e : config.compatClasses) {
Class<?> clazz = classLoaderControl.getClass(e);
MethodHandle runMethod = MethodHandles.lookup().findStatic(clazz, "run", MethodType.methodType(void.class, ClassLoaderControl.class));
runMethod.invoke(classLoaderControl);
}
}
LogHelper.debug("Invoke main method %s with %s", classname, launch.getClass().getName()); LogHelper.debug("Invoke main method %s with %s", classname, launch.getClass().getName());
launch.launch(config.mainclass, config.mainmodule, Arrays.asList(real_args)); launch.launch(config.mainclass, config.mainmodule, Arrays.asList(real_args));
} catch (Throwable e) { } catch (Throwable e) {

View file

@ -0,0 +1,10 @@
package pro.gravit.launcher.server;
public class ServerWrapperInlineInitializer {
public static void run() throws Throwable {
ServerWrapper.wrapper = new ServerWrapper(ServerWrapper.Config.class, ServerWrapper.configFile);
ServerWrapper.wrapper.initialize();
ServerWrapper.wrapper.connect();
ServerWrapper.wrapper.runCompatClasses();
}
}

View file

@ -5,7 +5,7 @@
id 'org.openjfx.javafxplugin' version '0.1.0' apply false id 'org.openjfx.javafxplugin' version '0.1.0' apply false
} }
group = 'pro.gravit.launcher' group = 'pro.gravit.launcher'
version = '5.6.11' version = '5.6.14'
apply from: 'props.gradle' apply from: 'props.gradle'
@ -71,10 +71,6 @@
repositories { repositories {
maven { maven {
url = version.endsWith('SNAPSHOT') ? getProperty('mavenSnapshotRepository') : getProperty('mavenReleaseRepository') url = version.endsWith('SNAPSHOT') ? getProperty('mavenSnapshotRepository') : getProperty('mavenReleaseRepository')
credentials {
username getProperty('mavenUsername')
password getProperty('mavenPassword')
}
} }
} }
} }

Binary file not shown.

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

2
gradlew vendored
View file

@ -205,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command: # Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped. # and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line. # treated as '${Hostname}' itself on the command line.

2
java24args.txt Normal file
View file

@ -0,0 +1,2 @@
--enable-native-access=org.fusesource.jansi
--enable-native-access=io.netty.common

4
javaargs.txt Normal file
View file

@ -0,0 +1,4 @@
--add-opens java.base/java.lang.invoke=launchserver
--add-modules java.net.http
-Dlauncher.useSlf4j=true
-Dio.netty.noUnsafe=true

@ -1 +1 @@
Subproject commit eeea07098281c5cc98feffaae9b5a01677ca2eb7 Subproject commit a2c3ccecadb7f864039b88e6269583c4b77fba13