mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-06-30 21:18:18 +03:00
Compare commits
56 commits
Author | SHA1 | Date | |
---|---|---|---|
|
e1ee1099cc | ||
|
b0e840a040 | ||
|
c76aae76a5 | ||
|
261e16cecb | ||
|
3c9e009433 | ||
|
2379fe5798 | ||
|
911ca1e69f | ||
|
90f74aaf25 | ||
|
880957fa9b | ||
|
2fea94071b | ||
|
b41e8db336 | ||
|
76570ddbe5 | ||
|
3a160b8124 | ||
|
8fb1dc275c | ||
|
95aed151e7 | ||
|
6934c37a33 | ||
|
5155c470c6 | ||
|
533dcfce14 | ||
|
d2f83d81eb | ||
|
2379398c30 | ||
|
f53c48a5ae | ||
|
394b64e22d | ||
|
7c15742478 | ||
|
d65fffade9 | ||
|
bb6c95ca12 | ||
|
9027987b29 | ||
|
d410533c8d | ||
|
af2c5c33e8 | ||
|
e67bb6a12f | ||
|
e2e0ef6ea4 | ||
|
18419fcd3a | ||
|
73804a555e | ||
|
b16281e04a | ||
|
06f0bc873a | ||
|
834fbab12b | ||
|
822872992f | ||
|
ac43034d45 | ||
|
00446b40f0 | ||
|
9e29053afa | ||
|
2e93102106 | ||
|
d4b69195b3 | ||
|
a67fbac8bc | ||
|
a7abb9cbfc | ||
|
689478ee0f | ||
|
df77a1ebd6 | ||
|
641796b44e | ||
|
b7ed56b27e | ||
|
f119bd4b30 | ||
|
bbff0eac64 | ||
|
41f93b9f8d | ||
|
263cf26258 | ||
|
b9ad7c0f26 | ||
|
5ba32e3405 | ||
|
907332ff06 | ||
|
1d63fbbd93 | ||
|
2f4667f5a6 |
80 changed files with 517 additions and 297 deletions
4
.github/workflows/push.yml
vendored
4
.github/workflows/push.yml
vendored
|
@ -35,13 +35,17 @@ jobs:
|
|||
run: |
|
||||
mkdir -p artifacts/modules
|
||||
cd LaunchServer/build/libs
|
||||
mv proguard proguard-libraries
|
||||
zip -r -9 ../../../artifacts/libraries.zip * -x "LaunchServer.jar" -x "LaunchServer-clean.jar"
|
||||
cp LaunchServer.jar ../../../artifacts/LaunchServer.jar
|
||||
cd ../../..
|
||||
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 modules/*_module/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
|
||||
uses: actions/upload-artifact@v4
|
||||
|
|
|
@ -26,24 +26,24 @@
|
|||
targetCompatibility = '21'
|
||||
|
||||
configurations {
|
||||
compileOnlyA
|
||||
bundleOnly
|
||||
bundle
|
||||
hikari
|
||||
pack
|
||||
launch4j
|
||||
proguardPack
|
||||
bundleOnly.extendsFrom bundle
|
||||
api.extendsFrom bundle, hikari, pack, launch4j
|
||||
api.extendsFrom bundle, pack
|
||||
}
|
||||
|
||||
jar {
|
||||
dependsOn parent.childProjects.Launcher.tasks.assemble
|
||||
from { configurations.pack.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
exclude("module-info.class")
|
||||
from(parent.childProjects.Launcher.tasks.shadowJar)
|
||||
from(parent.childProjects.Launcher.tasks.genRuntimeJS)
|
||||
manifest.attributes("Main-Class": mainClassName,
|
||||
"Premain-Class": mainAgentName,
|
||||
"Multi-Release": "true",
|
||||
"Automatic-Module-Name": "launchserver"
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -75,25 +75,35 @@
|
|||
|
||||
|
||||
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: '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-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: 'bcpkix-jdk18on', version: rootProject['verBcpkix']
|
||||
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-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-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-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'
|
||||
// Netty
|
||||
bundle 'org.jboss.marshalling:jboss-marshalling:1.4.11.Final'
|
||||
bundle 'com.google.protobuf.nano:protobuf-javanano:3.1.0'
|
||||
//
|
||||
bundle group: 'org.slf4j', name: 'slf4j-api', version: rootProject['verSlf4j']
|
||||
bundle group: 'com.mysql', name: 'mysql-connector-j', version: rootProject['verMySQLConn']
|
||||
bundle group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: rootProject['verMariaDBConn']
|
||||
bundle group: 'org.postgresql', name: 'postgresql', version: rootProject['verPostgreSQLConn']
|
||||
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-slf4j2-impl', version: rootProject['verLog4j']
|
||||
bundle group: 'io.jsonwebtoken', name: 'jjwt-api', version: rootProject['verJwt']
|
||||
|
@ -103,40 +113,32 @@ pack project(':LauncherAPI')
|
|||
annotationProcessor(group: 'org.apache.logging.log4j', name: 'log4j-core', version: rootProject['verLog4j'])
|
||||
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: rootProject['verJunit']
|
||||
|
||||
hikari 'io.micrometer:micrometer-core:1.13.1'
|
||||
hikari('com.zaxxer:HikariCP:5.1.0') {
|
||||
bundle 'io.micrometer:micrometer-core:1.14.4'
|
||||
bundle('com.zaxxer:HikariCP:6.2.1') {
|
||||
exclude group: 'javassist'
|
||||
exclude group: 'io.micrometer'
|
||||
exclude group: 'org.slf4j'
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('hikari', Copy) {
|
||||
duplicatesStrategy = 'EXCLUDE'
|
||||
into "$buildDir/libs/libraries/hikaricp"
|
||||
from configurations.hikari
|
||||
}
|
||||
|
||||
tasks.register('dumpLibs', Copy) {
|
||||
duplicatesStrategy = 'EXCLUDE'
|
||||
dependsOn tasks.hikari
|
||||
into "$buildDir/libs/libraries"
|
||||
from configurations.bundleOnly
|
||||
}
|
||||
|
||||
tasks.register('dumpCompileOnlyLibs', Copy) {
|
||||
tasks.register('dumpProguard', Copy) {
|
||||
duplicatesStrategy = 'EXCLUDE'
|
||||
into "$buildDir/libs/launcher-libraries-compile"
|
||||
from configurations.compileOnlyA
|
||||
into "$buildDir/libs/proguard"
|
||||
from configurations.proguardPack
|
||||
}
|
||||
|
||||
tasks.register('bundle', Zip) {
|
||||
duplicatesStrategy = 'EXCLUDE'
|
||||
dependsOn parent.childProjects.Launcher.tasks.build, tasks.dumpLibs, tasks.dumpCompileOnlyLibs, tasks.jar
|
||||
dependsOn parent.childProjects.Launcher.tasks.build, tasks.dumpLibs, tasks.jar
|
||||
archiveFileName = 'LaunchServer.zip'
|
||||
destinationDirectory = file("$buildDir")
|
||||
from(tasks.dumpLibs.destinationDir) { into 'libraries' }
|
||||
from(tasks.dumpCompileOnlyLibs.destinationDir) { into 'launcher-libraries-compile' }
|
||||
from(tasks.jar)
|
||||
from(parent.childProjects.Launcher.tasks.dumpLibs) { into 'launcher-libraries' }
|
||||
}
|
||||
|
@ -147,7 +149,7 @@ pack project(':LauncherAPI')
|
|||
from parent.childProjects.Launcher.tasks.dumpLibs
|
||||
}
|
||||
|
||||
assemble.dependsOn tasks.dumpLibs, tasks.dumpCompileOnlyLibs, tasks.dumpClientLibs, tasks.bundle, tasks.cleanjar
|
||||
assemble.dependsOn tasks.dumpLibs, tasks.dumpClientLibs, tasks.bundle, tasks.cleanjar, tasks.dumpProguard
|
||||
|
||||
|
||||
publishing {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launcher.base.Launcher;
|
||||
import pro.gravit.launcher.base.events.RequestEvent;
|
||||
import pro.gravit.launcher.base.events.request.ProfilesRequestEvent;
|
||||
import pro.gravit.launcher.base.modules.events.ClosePhase;
|
||||
|
@ -23,20 +22,16 @@
|
|||
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;
|
||||
import pro.gravit.utils.command.Command;
|
||||
import pro.gravit.utils.command.CommandHandler;
|
||||
import pro.gravit.utils.command.SubCommand;
|
||||
import pro.gravit.utils.helper.CommonHelper;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.JVMHelper;
|
||||
import pro.gravit.utils.helper.SecurityHelper;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.security.KeyStore;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
|
@ -87,6 +82,7 @@ public final class LaunchServer implements Runnable, AutoCloseable, Reconfigurab
|
|||
public final Path launcherModulesDir;
|
||||
public final Path librariesDir;
|
||||
public final Path controlFile;
|
||||
public final Path proguardDir;
|
||||
/**
|
||||
* This object contains runtime configuration
|
||||
*/
|
||||
|
@ -143,6 +139,7 @@ public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, La
|
|||
launcherModulesDir = directories.launcherModules;
|
||||
librariesDir = directories.librariesDir;
|
||||
controlFile = directories.controlFile;
|
||||
proguardDir = directories.proguardDir;
|
||||
this.shardId = shardId;
|
||||
if(!Files.isDirectory(launcherPack)) {
|
||||
Files.createDirectories(launcherPack);
|
||||
|
@ -467,13 +464,16 @@ 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", 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 librariesDir;
|
||||
public Path launcherLibrariesDir;
|
||||
public Path launcherLibrariesCompileDir;
|
||||
public Path launcherPackDir;
|
||||
public Path keyDirectory;
|
||||
public Path proguardDir;
|
||||
public Path dir;
|
||||
public Path trustStore;
|
||||
public Path tmpDir;
|
||||
|
@ -494,6 +494,7 @@ public void collect() {
|
|||
if (launcherModules == null) launcherModules = getPath(LAUNCHER_MODULES);
|
||||
if (librariesDir == null) librariesDir = getPath(LIBRARIES);
|
||||
if (controlFile == null) controlFile = getPath(CONTROL_FILE);
|
||||
if (proguardDir == null) proguardDir = getPath(PROGUARD_DIR);
|
||||
if (tmpDir == null)
|
||||
tmpDir = Paths.get(System.getProperty("java.io.tmpdir")).resolve("launchserver-%s".formatted(SecurityHelper.randomStringToken()));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
import java.nio.file.Path;
|
||||
import java.security.Security;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LaunchServerStarter {
|
||||
|
@ -63,7 +62,7 @@ public static void main(String[] args) throws Exception {
|
|||
directories.collect();
|
||||
CertificateManager certificateManager = new CertificateManager();
|
||||
try {
|
||||
certificateManager.readTrustStore(dir.resolve("truststore"));
|
||||
certificateManager.readTrustStore(directories.trustStore);
|
||||
} catch (CertificateException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
import java.util.stream.Stream;
|
||||
|
||||
public class Main {
|
||||
private static final List<String> classpathOnly = List.of("proguard", "jline", "progressbar", "kotlin", "epoll");
|
||||
private static final List<String> classpathOnly = List.of("proguard", "progressbar", "kotlin");
|
||||
private static final String LOG4J_PROPERTY = "log4j2.configurationFile";
|
||||
private static final String DEBUG_PROPERTY = "launchserver.main.debug";
|
||||
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));
|
||||
options.moduleConf.modulePath.addAll(modulepath);
|
||||
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);
|
||||
control.clearLauncherPackages();
|
||||
control.addLauncherPackage("pro.gravit.utils.launch");
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
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.ClassVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
/**
|
||||
|
@ -18,14 +19,32 @@
|
|||
* чего угодно. Работает через поиск class-файлов в classpath.
|
||||
*/
|
||||
public class ClassMetadataReader implements Closeable {
|
||||
private final Logger logger = LogManager.getLogger(ClassMetadataReader.class);
|
||||
private final List<JarFile> cp;
|
||||
private final Map<String, Module> moduleClassFinder;
|
||||
|
||||
public ClassMetadataReader(List<JarFile> 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() {
|
||||
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() {
|
||||
|
@ -58,7 +77,42 @@ public byte[] getClassData(String className) throws IOException {
|
|||
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) {
|
||||
|
@ -66,6 +120,7 @@ public String getSuperClass(String type) {
|
|||
try {
|
||||
return getSuperClassASM(type);
|
||||
} catch (Exception e) {
|
||||
logger.warn("getSuperClass: type {} not found ({}: {})", type, e.getClass().getName(), e.getMessage());
|
||||
return "java/lang/Object";
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +155,7 @@ private static class CheckSuperClassVisitor extends ClassVisitor {
|
|||
String superClassName;
|
||||
|
||||
public CheckSuperClassVisitor() {
|
||||
super(Opcodes.ASM7);
|
||||
super(Opcodes.ASM9);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -174,7 +174,7 @@ public AuthManager.AuthReport sudo(User user, boolean shadow) throws IOException
|
|||
}
|
||||
|
||||
@Override
|
||||
public User checkServer(Client client, String username, String serverID) throws IOException {
|
||||
public User checkServer(Client client, String username, String serverID) {
|
||||
SQLUser user = (SQLUser) getUserByUsername(username);
|
||||
if (user == null) {
|
||||
return null;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package pro.gravit.launchserver.auth.core;
|
||||
|
||||
import pro.gravit.launcher.base.ClientPermissions;
|
||||
import pro.gravit.launcher.base.request.secure.HardwareReportRequest;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.auth.AuthProviderPair;
|
||||
|
|
|
@ -41,12 +41,12 @@ public AuthManager.AuthReport authorize(String login, AuthResponse.AuthContext c
|
|||
}
|
||||
|
||||
@Override
|
||||
public User checkServer(Client client, String username, String serverID) throws IOException {
|
||||
public User checkServer(Client client, String username, String serverID) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean joinServer(Client client, String username, UUID uuid, String accessToken, String serverID) throws IOException {
|
||||
public boolean joinServer(Client client, String username, UUID uuid, String accessToken, String serverID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
import pro.gravit.launchserver.auth.core.interfaces.provider.AuthSupportHardware;
|
||||
import pro.gravit.launchserver.auth.core.interfaces.session.UserSessionSupportHardware;
|
||||
import pro.gravit.launchserver.socket.Client;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.sql.*;
|
||||
import java.util.Base64;
|
||||
|
@ -85,7 +83,7 @@ protected SQLUser constructUser(ResultSet set) throws SQLException {
|
|||
set.getString(accessTokenColumn), set.getString(serverIDColumn), set.getString(passwordColumn), set.getLong(hardwareIdColumn)) : null;
|
||||
}
|
||||
|
||||
private SQLUserHardware fetchHardwareInfo(ResultSet set) throws SQLException, IOException {
|
||||
private SQLUserHardware fetchHardwareInfo(ResultSet set) throws SQLException {
|
||||
HardwareReportRequest.HardwareInfo hardwareInfo = new HardwareReportRequest.HardwareInfo();
|
||||
hardwareInfo.hwDiskId = set.getString("hwDiskId");
|
||||
hardwareInfo.baseboardSerialNumber = set.getString("baseboardSerialNumber");
|
||||
|
@ -126,7 +124,7 @@ public UserHardware getHardwareInfoByPublicKey(byte[] publicKey) {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
} catch (SQLException | IOException throwables) {
|
||||
} catch (SQLException throwables) {
|
||||
logger.error("SQL Error", throwables);
|
||||
return null;
|
||||
}
|
||||
|
@ -149,7 +147,7 @@ public UserHardware getHardwareInfoByData(HardwareReportRequest.HardwareInfo inf
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (SQLException | IOException throwables) {
|
||||
} catch (SQLException throwables) {
|
||||
logger.error("SQL Error", throwables);
|
||||
}
|
||||
return null;
|
||||
|
@ -170,7 +168,7 @@ public UserHardware getHardwareInfoById(String id) {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
} catch (SQLException | IOException throwables) {
|
||||
} catch (SQLException throwables) {
|
||||
logger.error("SQL Error", throwables);
|
||||
return null;
|
||||
}
|
||||
|
@ -294,7 +292,7 @@ protected AbstractSQLCoreProvider.SQLUserSession createSession(AbstractSQLCorePr
|
|||
}
|
||||
|
||||
@Override
|
||||
public UserSession extendedCheckServer(Client client, String username, String serverID) throws IOException {
|
||||
public UserSession extendedCheckServer(Client client, String username, String serverID) {
|
||||
AbstractSQLCoreProvider.SQLUser user = (AbstractSQLCoreProvider.SQLUser) getUserByUsername(username);
|
||||
if (user == null) {
|
||||
return null;
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
import java.io.IOException;
|
||||
|
||||
public interface AuthSupportExtendedCheckServer {
|
||||
UserSession extendedCheckServer(Client client, String username, String serverID) throws IOException;
|
||||
UserSession extendedCheckServer(Client client, String username, String serverID);
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ public void init(LaunchServer server, AuthProviderPair pair) {
|
|||
}
|
||||
|
||||
@Override
|
||||
public User checkServer(Client client, String username, String serverID) throws IOException {
|
||||
public User checkServer(Client client, String username, String serverID) {
|
||||
var savedServerId = sqlSessionStore.getServerIdByUsername(username);
|
||||
if (!serverID.equals(savedServerId)) {
|
||||
return null;
|
||||
|
@ -153,7 +153,7 @@ public User checkServer(Client client, String username, String serverID) throws
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean joinServer(Client client, String username, UUID uuid, String accessToken, String serverID) throws IOException {
|
||||
public boolean joinServer(Client client, String username, UUID uuid, String accessToken, String serverID) {
|
||||
User user;
|
||||
try {
|
||||
user = createUserFromMinecraftToken(accessToken);
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
import pro.gravit.launchserver.auth.SQLSourceConfig;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launchserver.binary.tasks.LauncherBuildTask;
|
||||
import pro.gravit.utils.helper.CommonHelper;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
|
@ -56,7 +56,7 @@ public final byte[] getDigest() {
|
|||
public void init() {
|
||||
}
|
||||
|
||||
public final boolean sync() throws IOException {
|
||||
public final boolean sync() {
|
||||
try {
|
||||
var target = syncBinaryFile.toString();
|
||||
var path = server.config.updatesProvider.download(null, List.of(target)).get(target);
|
||||
|
|
|
@ -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 {
|
||||
ClassReader cr = new ClassReader(input);
|
||||
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);
|
||||
cn.accept(cw);
|
||||
return cw.toByteArray();
|
||||
|
|
|
@ -146,7 +146,7 @@ public byte[] transformClass(byte[] bytes, String classname, BuildContext contex
|
|||
asmTransformer.transform(cn, classname, context);
|
||||
continue;
|
||||
} else if (cn != null) {
|
||||
writer = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
writer = new SafeClassWriter(reader, 0);
|
||||
cn.accept(writer);
|
||||
result = writer.toByteArray();
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public byte[] transformClass(byte[] bytes, String classname, BuildContext contex
|
|||
}
|
||||
}
|
||||
if (cn != null) {
|
||||
writer = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
writer = new SafeClassWriter(reader, 0);
|
||||
cn.accept(writer);
|
||||
result = writer.toByteArray();
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ default byte[] transform(byte[] input, String classname, BuildContext context) {
|
|||
ClassNode cn = new ClassNode();
|
||||
reader.accept(cn, 0);
|
||||
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);
|
||||
return writer.toByteArray();
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ public void invoke(String... args) throws Exception {
|
|||
boolean value = Boolean.parseBoolean(args[0]);
|
||||
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
||||
Configuration config = ctx.getConfiguration();
|
||||
config.getWatchManager().setIntervalSeconds(-1);
|
||||
LoggerConfig loggerConfig = config.getLoggerConfig("pro.gravit");
|
||||
loggerConfig.setLevel(value ? Level.TRACE : Level.DEBUG);
|
||||
ctx.updateLoggers();
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
import pro.gravit.utils.command.CommandException;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
|
|
|
@ -2,17 +2,13 @@
|
|||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launcher.base.Launcher;
|
||||
import pro.gravit.launcher.base.profiles.ClientProfile;
|
||||
import pro.gravit.launcher.base.profiles.ClientProfileBuilder;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.command.Command;
|
||||
import pro.gravit.utils.helper.CommonHelper;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
import pro.gravit.launcher.base.profiles.ClientProfile;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.command.Command;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DeleteProfileCommand extends Command {
|
||||
|
|
|
@ -22,7 +22,7 @@ public String getUsageDescription() {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void invoke(String... args) throws Exception {
|
||||
public void invoke(String... args) {
|
||||
for(var profile : server.getProfiles()) {
|
||||
logger.info("{} ({}) {}", profile.getTitle(), profile.getVersion().toString(), profile.isLimited() ? "limited" : "");
|
||||
}
|
||||
|
|
|
@ -2,14 +2,10 @@
|
|||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launcher.base.Launcher;
|
||||
import pro.gravit.launcher.base.profiles.ClientProfile;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.command.Command;
|
||||
import pro.gravit.launchserver.helper.MakeProfileHelper;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
public class MakeProfileCommand extends Command {
|
||||
private transient final Logger logger = LogManager.getLogger();
|
||||
|
|
|
@ -2,17 +2,10 @@
|
|||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launcher.base.Launcher;
|
||||
import pro.gravit.launcher.base.profiles.ClientProfile;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.command.Command;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SaveProfilesCommand extends Command {
|
||||
|
|
|
@ -117,7 +117,7 @@ public void invoke(String... args) throws Exception {
|
|||
Files.deleteIfExists(proguardConf.mappings);
|
||||
}
|
||||
});
|
||||
return null;
|
||||
return commands;
|
||||
}
|
||||
|
||||
public static class ProGuardMultiReleaseFixer implements LauncherBuildTask {
|
||||
|
@ -213,7 +213,7 @@ public Path process(Path inputFile) throws IOException {
|
|||
args.add(IOHelper.resolveJavaBin(IOHelper.JVM_DIR).toAbsolutePath().toString());
|
||||
args.addAll(component.jvmArgs);
|
||||
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
|
||||
.filter(e -> e.getFileName().toString().endsWith(".jar"))
|
||||
.map(path -> path.toAbsolutePath().toString())
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package pro.gravit.launchserver.config;
|
||||
|
||||
import io.netty.channel.epoll.Epoll;
|
||||
import io.netty.handler.logging.LogLevel;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
@ -19,6 +18,7 @@
|
|||
import pro.gravit.launchserver.components.AuthLimiterComponent;
|
||||
import pro.gravit.launchserver.components.Component;
|
||||
import pro.gravit.launchserver.components.ProGuardComponent;
|
||||
import pro.gravit.launchserver.socket.NettyObjectFactory;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -64,12 +64,7 @@ public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env) {
|
|||
newConfig.netty.fileServerEnabled = true;
|
||||
newConfig.netty.binds = new NettyBindAddress[]{new NettyBindAddress("0.0.0.0", 9274)};
|
||||
newConfig.netty.performance = new NettyPerformanceConfig();
|
||||
try {
|
||||
newConfig.netty.performance.usingEpoll = Epoll.isAvailable();
|
||||
} catch (Throwable e) {
|
||||
// Epoll class line 51+ catch (Exception) but Error will be thrown by System.load
|
||||
newConfig.netty.performance.usingEpoll = false;
|
||||
} // such as on ARM
|
||||
newConfig.netty.performance.mode = NettyObjectFactory.NettyFactoryMode.AUTO;
|
||||
newConfig.netty.performance.bossThread = 2;
|
||||
newConfig.netty.performance.workerThread = 8;
|
||||
newConfig.netty.performance.schedulerThread = 2;
|
||||
|
@ -277,7 +272,7 @@ public static class NettyConfig {
|
|||
}
|
||||
|
||||
public static class NettyPerformanceConfig {
|
||||
public boolean usingEpoll;
|
||||
public NettyObjectFactory.NettyFactoryMode mode = NettyObjectFactory.NettyFactoryMode.AUTO;
|
||||
public int bossThread;
|
||||
public int workerThread;
|
||||
public int schedulerThread;
|
||||
|
|
|
@ -49,7 +49,6 @@ public static ClientProfile makeProfile(ClientProfile.Version version, String ti
|
|||
// Official Mojang launcher java arguments
|
||||
if (version.compareTo(ClientProfileVersions.MINECRAFT_1_12_2) <= 0) {
|
||||
// lwjgl3ify arguments https://github.com/GTNewHorizons/lwjgl3ify
|
||||
jvmArgs.add("-Djava.security.manager=allow");
|
||||
jvmArgs.add("--add-opens");
|
||||
jvmArgs.add("java.base/jdk.internal.loader=ALL-UNNAMED");
|
||||
jvmArgs.add("--add-opens");
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
public class CertificateManager {
|
||||
private transient final Logger logger = LogManager.getLogger();
|
||||
public LauncherTrustManager trustManager;
|
||||
private Path truststorePath;
|
||||
|
||||
public void writePrivateKey(Path file, PrivateKey privateKey) throws IOException {
|
||||
writePrivateKey(IOHelper.newWriter(file), privateKey);
|
||||
|
@ -91,6 +92,7 @@ public X509CertificateHolder readCertificate(Reader reader) throws IOException {
|
|||
}
|
||||
|
||||
public void readTrustStore(Path dir) throws IOException, CertificateException {
|
||||
this.truststorePath = dir;
|
||||
if (!IOHelper.isDir(dir)) {
|
||||
Files.createDirectories(dir);
|
||||
try {
|
||||
|
@ -131,4 +133,8 @@ public LauncherTrustManager.CheckClassResult checkClass(Class<?> clazz) {
|
|||
X509Certificate[] certificates = JVMHelper.getCertificates(clazz);
|
||||
return trustManager.checkCertificates(certificates, trustManager::stdCertificateChecker);
|
||||
}
|
||||
|
||||
public Path getTruststorePath() {
|
||||
return truststorePath;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
package pro.gravit.launchserver.manangers;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launcher.core.hasher.HashedDir;
|
||||
import pro.gravit.launcher.core.serialize.HInput;
|
||||
import pro.gravit.launcher.core.serialize.HOutput;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.modules.events.LaunchServerUpdatesSyncEvent;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class UpdatesManager {
|
||||
private final LaunchServer server;
|
||||
|
@ -24,12 +14,12 @@ public UpdatesManager(LaunchServer server) {
|
|||
}
|
||||
|
||||
@Deprecated
|
||||
public void readUpdatesFromCache() throws IOException {
|
||||
public void readUpdatesFromCache() {
|
||||
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void readUpdatesDir() throws IOException {
|
||||
public void readUpdatesDir() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.epoll.Epoll;
|
||||
import io.netty.channel.group.DefaultChannelGroup;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.handler.codec.http.HttpObjectAggregator;
|
||||
|
@ -36,14 +35,9 @@ public class LauncherNettyServer implements AutoCloseable {
|
|||
|
||||
public LauncherNettyServer(LaunchServer server) {
|
||||
LaunchServerConfig.NettyConfig config = server.config.netty;
|
||||
NettyObjectFactory.setUsingEpoll(config.performance.usingEpoll);
|
||||
NettyObjectFactory.setMode(config.performance.mode);
|
||||
Logger logger = LogManager.getLogger();
|
||||
if (config.performance.usingEpoll) {
|
||||
logger.debug("Netty: Epoll enabled");
|
||||
}
|
||||
if (config.performance.usingEpoll && !Epoll.isAvailable()) {
|
||||
logger.error("Epoll is not available: (netty,perfomance.usingEpoll configured wrongly)", Epoll.unavailabilityCause());
|
||||
}
|
||||
logger.info("Netty usage {} transport mode", NettyObjectFactory.getMode());
|
||||
bossGroup = NettyObjectFactory.newEventLoopGroup(config.performance.bossThread, "LauncherNettyServer.bossGroup");
|
||||
workerGroup = NettyObjectFactory.newEventLoopGroup(config.performance.workerThread, "LauncherNettyServer.workerGroup");
|
||||
serverBootstrap = new ServerBootstrap();
|
||||
|
|
|
@ -2,30 +2,58 @@
|
|||
|
||||
import io.netty.channel.ChannelFactory;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.MultiThreadIoEventLoopGroup;
|
||||
import io.netty.channel.ServerChannel;
|
||||
import io.netty.channel.epoll.EpollEventLoopGroup;
|
||||
import io.netty.channel.epoll.Epoll;
|
||||
import io.netty.channel.epoll.EpollIoHandler;
|
||||
import io.netty.channel.epoll.EpollServerSocketChannel;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.nio.NioIoHandler;
|
||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
import io.netty.channel.uring.IoUring;
|
||||
import io.netty.channel.uring.IoUringIoHandler;
|
||||
import io.netty.channel.uring.IoUringServerSocketChannel;
|
||||
|
||||
public class NettyObjectFactory {
|
||||
private static boolean epoll = false;
|
||||
private static NettyFactoryMode mode;
|
||||
|
||||
public static void setUsingEpoll(boolean value) {
|
||||
epoll = value;
|
||||
public static void setMode(NettyFactoryMode mode) {
|
||||
NettyObjectFactory.mode = mode;
|
||||
if(mode == NettyFactoryMode.AUTO) {
|
||||
if(IoUring.isAvailable()) {
|
||||
NettyObjectFactory.mode = NettyFactoryMode.IO_URING;
|
||||
return;
|
||||
}
|
||||
if(Epoll.isAvailable()) {
|
||||
NettyObjectFactory.mode = NettyFactoryMode.EPOLL;
|
||||
return;
|
||||
}
|
||||
NettyObjectFactory.mode = NettyFactoryMode.NIO;
|
||||
}
|
||||
}
|
||||
|
||||
public static NettyFactoryMode getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public static EventLoopGroup newEventLoopGroup(int threads, String poolName) {
|
||||
if (epoll)
|
||||
return new EpollEventLoopGroup(threads);
|
||||
else
|
||||
return new NioEventLoopGroup(threads);
|
||||
return switch (mode) {
|
||||
case AUTO -> null;
|
||||
case NIO -> new MultiThreadIoEventLoopGroup(threads, NioIoHandler.newFactory());
|
||||
case EPOLL -> new MultiThreadIoEventLoopGroup(threads, EpollIoHandler.newFactory());
|
||||
case IO_URING -> new MultiThreadIoEventLoopGroup(threads, IoUringIoHandler.newFactory());
|
||||
};
|
||||
}
|
||||
|
||||
public static ChannelFactory<? extends ServerChannel> getServerSocketChannelFactory() {
|
||||
if (epoll)
|
||||
return EpollServerSocketChannel::new;
|
||||
else
|
||||
return NioServerSocketChannel::new;
|
||||
return switch (mode) {
|
||||
case AUTO -> null;
|
||||
case NIO -> NioServerSocketChannel::new;
|
||||
case EPOLL -> EpollServerSocketChannel::new;
|
||||
case IO_URING -> IoUringServerSocketChannel::new;
|
||||
};
|
||||
}
|
||||
|
||||
public enum NettyFactoryMode {
|
||||
AUTO, NIO, EPOLL, IO_URING
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
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;
|
||||
|
@ -64,29 +63,28 @@ public void run() {
|
|||
ByteBuffer buffer = ByteBuffer.allocate(1024);
|
||||
while (true) {
|
||||
SocketChannel channel = serverChannel.accept();
|
||||
channel.configureBlocking(true);
|
||||
String command = null;
|
||||
try {
|
||||
try (channel) {
|
||||
channel.configureBlocking(true);
|
||||
String command = null;
|
||||
mark:
|
||||
while (true) {
|
||||
int bytesRead = channel.read(buffer);
|
||||
if (bytesRead < 0) {
|
||||
break;
|
||||
}
|
||||
for (var i=0;i<buffer.limit();i++) {
|
||||
if(buffer.get(i) == '\n') {
|
||||
for (var i = 0; i < buffer.limit(); i++) {
|
||||
if (buffer.get(i) == '\n') {
|
||||
command = new String(buffer.array(), 0, i);
|
||||
break mark;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(command != null) {
|
||||
if (command != null) {
|
||||
runCommand(channel, command);
|
||||
}
|
||||
} finally {
|
||||
buffer.clear();
|
||||
channel.close();
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launcher.base.Launcher;
|
||||
import pro.gravit.launchserver.socket.NettyConnectContext;
|
||||
import pro.gravit.launchserver.socket.severlet.StatusSeverlet;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
|
@ -34,6 +35,7 @@ public class NettyWebAPIHandler extends SimpleChannelInboundHandler<FullHttpRequ
|
|||
public NettyWebAPIHandler(NettyConnectContext context) {
|
||||
super();
|
||||
this.context = context;
|
||||
addNewSeverlet("status", new StatusSeverlet());
|
||||
}
|
||||
|
||||
public static void addNewSeverlet(String path, SimpleSeverletHandler callback) {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoField;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.time.temporal.TemporalAccessor;
|
||||
import java.time.temporal.UnsupportedTemporalTypeException;
|
||||
import java.util.Arrays;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
public interface WebSocketServerResponse extends WebSocketRequest {
|
||||
String getType();
|
||||
|
||||
void execute(ChannelHandlerContext ctx, Client client) throws Exception;
|
||||
void execute(ChannelHandlerContext ctx, Client client);
|
||||
|
||||
default ThreadSafeStatus getThreadSafeStatus() {
|
||||
return ThreadSafeStatus.READ;
|
||||
|
|
|
@ -23,7 +23,7 @@ public String getType() {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||
public void execute(ChannelHandlerContext ctx, Client client) {
|
||||
sendResult(new CurrentUserRequestEvent(collectUserInfoFromClient(server, client)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public String getType() {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||
public void execute(ChannelHandlerContext ctx, Client client) {
|
||||
if (accessToken == null && !client.isAuth && needUserInfo) {
|
||||
sendError("Invalid request");
|
||||
return;
|
||||
|
|
|
@ -12,7 +12,7 @@ public String getType() {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||
public void execute(ChannelHandlerContext ctx, Client client) {
|
||||
if(!client.isAuth || client.auth == null || client.getUser() == null) {
|
||||
sendError("Access denied");
|
||||
return;
|
||||
|
|
|
@ -14,7 +14,7 @@ public String getType() {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||
public void execute(ChannelHandlerContext ctx, Client client) {
|
||||
if(!client.isAuth || client.auth == null || client.getUser() == null) {
|
||||
sendError("Access denied");
|
||||
return;
|
||||
|
|
|
@ -12,7 +12,7 @@ public String getType() {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||
public void execute(ChannelHandlerContext ctx, Client client) {
|
||||
sendResult(new GetConnectUUIDRequestEvent(connectUUID, server.shardId));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
|
@ -28,7 +28,6 @@
|
|||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ClientLauncherProcess {
|
||||
public final List<String> pre = new LinkedList<>();
|
||||
|
|
|
@ -28,6 +28,7 @@ public class DebugMain {
|
|||
public static String webSocketURL = System.getProperty("launcherdebug.websocket", "ws://localhost:9274/api");
|
||||
public static String projectName = System.getProperty("launcherdebug.projectname", "Minecraft");
|
||||
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 disableAutoRefresh = Boolean.getBoolean("launcherdebug.disableautorefresh");
|
||||
public static String[] moduleClasses = System.getProperty("launcherdebug.modules", "").split(",");
|
||||
|
@ -37,6 +38,14 @@ public class DebugMain {
|
|||
public static void main(String[] args) throws Throwable {
|
||||
LogHelper.printVersion("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);
|
||||
LogHelper.info("Launcher start in DEBUG mode (Only for developers)");
|
||||
LogHelper.debug("Initialization LauncherConfig");
|
||||
|
@ -56,7 +65,9 @@ public static void main(String[] args) throws Throwable {
|
|||
}
|
||||
LauncherEngine.modulesManager.initModules(null);
|
||||
LauncherEngine.initGson(LauncherEngine.modulesManager);
|
||||
ConsoleManager.initConsole();
|
||||
if(!disableConsole) {
|
||||
ConsoleManager.initConsole();
|
||||
}
|
||||
LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase());
|
||||
RequestService service;
|
||||
if (offlineMode) {
|
||||
|
@ -72,10 +83,6 @@ public static void main(String[] args) throws Throwable {
|
|||
if(!disableAutoRefresh) {
|
||||
Request.startAutoRefresh();
|
||||
}
|
||||
LogHelper.debug("Initialization LauncherEngine");
|
||||
LauncherEngine instance = LauncherEngine.newInstance(false, ClientRuntimeProvider.class);
|
||||
instance.start(args);
|
||||
LauncherEngine.exitLauncher(0);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package pro.gravit.launcher.runtime.debug;
|
||||
|
||||
public class DebugMainInlineInitializer {
|
||||
public static void run() throws Exception {
|
||||
DebugMain.initialize();
|
||||
}
|
||||
}
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
|
||||
public final class ClientProfile implements Comparable<ClientProfile> {
|
||||
|
|
|
@ -154,7 +154,7 @@ public static String getRefreshToken() {
|
|||
|
||||
public static void reconnect() throws Exception {
|
||||
|
||||
getRequestService().open();
|
||||
getRequestService().connect();
|
||||
restore();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
import java.io.IOException;
|
||||
|
||||
public final class RequestException extends IOException {
|
||||
private static final long serialVersionUID = 7558237657082664821L;
|
||||
|
||||
|
||||
public RequestException(String message) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
public interface RequestService {
|
||||
<T extends WebSocketEvent> CompletableFuture<T> request(Request<T> request) throws IOException;
|
||||
void open() throws Exception;
|
||||
void connect() throws Exception;
|
||||
|
||||
void registerEventHandler(EventHandler handler);
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.WebSocket;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
@ -33,7 +34,7 @@ public abstract class ClientJSONPoint implements WebSocket.Listener {
|
|||
private final Object sendSyncObject = new Object();
|
||||
private volatile StringBuilder builder = new StringBuilder();
|
||||
|
||||
public ClientJSONPoint(final String uri) throws SSLException {
|
||||
public ClientJSONPoint(final String uri) {
|
||||
this(URI.create(uri));
|
||||
}
|
||||
|
||||
|
@ -63,7 +64,7 @@ public ClientJSONPoint(URI uri) {
|
|||
}
|
||||
}
|
||||
|
||||
public void open() throws Exception {
|
||||
public void connect() throws Exception {
|
||||
webSocket = webSocketBuilder.buildAsync(uri, this).get();
|
||||
}
|
||||
|
||||
|
@ -97,6 +98,17 @@ public CompletionStage<?> onClose(WebSocket webSocket, int statusCode, String re
|
|||
return WebSocket.Listener.super.onClose(webSocket, statusCode, reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpen(WebSocket webSocket) {
|
||||
onOpen();
|
||||
WebSocket.Listener.super.onOpen(webSocket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletionStage<?> onBinary(WebSocket webSocket, ByteBuffer data, boolean last) {
|
||||
return WebSocket.Listener.super.onBinary(webSocket, data, last);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(WebSocket webSocket, Throwable error) {
|
||||
LogHelper.error(error);
|
||||
|
@ -114,7 +126,7 @@ public void send(String text) {
|
|||
|
||||
abstract void onOpen();
|
||||
|
||||
public void close() throws InterruptedException {
|
||||
public void close() {
|
||||
webSocket.abort();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public abstract class ClientWebSocketService extends ClientJSONPoint {
|
|||
public OnCloseCallback onCloseCallback;
|
||||
public ReconnectCallback reconnectCallback;
|
||||
|
||||
public ClientWebSocketService(String address) throws SSLException {
|
||||
public ClientWebSocketService(String address) {
|
||||
super(createURL(address));
|
||||
this.gson = Launcher.gsonManager.gson;
|
||||
this.onConnect = true;
|
||||
|
|
|
@ -45,7 +45,7 @@ public <T extends WebSocketEvent> CompletableFuture<T> request(Request<T> reques
|
|||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
public void connect() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,12 @@
|
|||
|
||||
import javax.net.ssl.SSLException;
|
||||
import java.io.IOException;
|
||||
import java.net.http.WebSocket;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionStage;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
|
@ -40,11 +43,7 @@ public static CompletableFuture<StdWebSocketService> initWebSockets(String addre
|
|||
service.openAsync(() -> {
|
||||
future.complete(service);
|
||||
JVMHelper.RUNTIME.addShutdownHook(new Thread(() -> {
|
||||
try {
|
||||
service.close();
|
||||
} catch (InterruptedException e) {
|
||||
LogHelper.error(e);
|
||||
}
|
||||
service.close();
|
||||
}));
|
||||
}, future::completeExceptionally);
|
||||
return future;
|
||||
|
|
|
@ -26,7 +26,7 @@ public <T extends WebSocketEvent> CompletableFuture<T> request(Request<T> reques
|
|||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
public void connect() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
public class ClientVersionTest {
|
||||
@Test
|
||||
public void parseTest() {
|
||||
Assertions.assertEquals(ClientProfile.Version.of("1.0.0").toCleanString(), "1.0.0");
|
||||
Assertions.assertEquals(ClientProfile.Version.of("1.0.0-1").toCleanString(), "1.0.0.1");
|
||||
Assertions.assertEquals(ClientProfile.Version.of("-----1.0.0").toCleanString(), "1.0.0");
|
||||
Assertions.assertEquals("1.0.0", ClientProfile.Version.of("1.0.0").toCleanString());
|
||||
Assertions.assertEquals("1.0.0.1", ClientProfile.Version.of("1.0.0-1").toCleanString());
|
||||
Assertions.assertEquals("1.0.0", ClientProfile.Version.of("-----1.0.0").toCleanString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -49,12 +49,12 @@ public void dependenciesTest() {
|
|||
moduleManager.loadModule(new Depend3Module());
|
||||
moduleManager.loadModule(new MainModule());
|
||||
moduleManager.initModules(null);
|
||||
Assertions.assertEquals(moduleManager.getModule("depend1").getInitStatus(), LauncherModule.InitStatus.FINISH);
|
||||
Assertions.assertEquals(moduleManager.getModule("depend2").getInitStatus(), LauncherModule.InitStatus.FINISH);
|
||||
Assertions.assertEquals(moduleManager.getModule("depend3").getInitStatus(), LauncherModule.InitStatus.FINISH);
|
||||
Assertions.assertEquals(moduleManager.getModule("internal").getInitStatus(), LauncherModule.InitStatus.FINISH);
|
||||
Assertions.assertEquals(moduleManager.getModule("virtual").getInitStatus(), LauncherModule.InitStatus.FINISH);
|
||||
Assertions.assertEquals(moduleManager.getModule("main").getInitStatus(), LauncherModule.InitStatus.FINISH);
|
||||
Assertions.assertEquals(LauncherModule.InitStatus.FINISH, moduleManager.getModule("depend1").getInitStatus());
|
||||
Assertions.assertEquals(LauncherModule.InitStatus.FINISH, moduleManager.getModule("depend2").getInitStatus());
|
||||
Assertions.assertEquals(LauncherModule.InitStatus.FINISH, moduleManager.getModule("depend3").getInitStatus());
|
||||
Assertions.assertEquals(LauncherModule.InitStatus.FINISH, moduleManager.getModule("internal").getInitStatus());
|
||||
Assertions.assertEquals(LauncherModule.InitStatus.FINISH, moduleManager.getModule("virtual").getInitStatus());
|
||||
Assertions.assertEquals(LauncherModule.InitStatus.FINISH, moduleManager.getModule("main").getInitStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -62,7 +62,7 @@ public void cyclicTest() {
|
|||
moduleManager.loadModule(new CyclicDependModule());
|
||||
moduleManager.loadModule(new Cyclic2DependModule());
|
||||
moduleManager.initModules(null);
|
||||
Assertions.assertEquals(moduleManager.getModule("cyclic1").getInitStatus(), LauncherModule.InitStatus.FINISH);
|
||||
Assertions.assertEquals(moduleManager.getModule("cyclic2").getInitStatus(), LauncherModule.InitStatus.FINISH);
|
||||
Assertions.assertEquals(LauncherModule.InitStatus.FINISH, moduleManager.getModule("cyclic1").getInitStatus());
|
||||
Assertions.assertEquals(LauncherModule.InitStatus.FINISH, moduleManager.getModule("cyclic2").getInitStatus());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,10 +16,10 @@ public Depend1Module() {
|
|||
@Override
|
||||
public void init(LauncherInitContext initContext) {
|
||||
InternalModule module = modulesManager.getModule(InternalModule.class);
|
||||
Assertions.assertEquals(module.getInitStatus(), InitStatus.FINISH);
|
||||
Assertions.assertEquals(InitStatus.FINISH, module.getInitStatus());
|
||||
Depend3Module module1 = modulesManager.getModule(Depend3Module.class);
|
||||
Assertions.assertEquals(module1.getInitStatus(), InitStatus.FINISH);
|
||||
Assertions.assertEquals(InitStatus.FINISH, module1.getInitStatus());
|
||||
VirtualInterface virtualInterface = modulesManager.getModuleByInterface(VirtualInterface.class);
|
||||
Assertions.assertEquals(((LauncherModule) virtualInterface).getInitStatus(), InitStatus.FINISH);
|
||||
Assertions.assertEquals(InitStatus.FINISH, ((LauncherModule) virtualInterface).getInitStatus());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ public MainModule() {
|
|||
@Override
|
||||
public void init(LauncherInitContext initContext) {
|
||||
Depend1Module module = modulesManager.getModule(Depend1Module.class);
|
||||
Assertions.assertEquals(module.getInitStatus(), InitStatus.FINISH);
|
||||
Assertions.assertEquals(InitStatus.FINISH, module.getInitStatus());
|
||||
Depend2Module module2 = modulesManager.getModule(Depend2Module.class);
|
||||
Assertions.assertEquals(module2.getInitStatus(), InitStatus.FINISH);
|
||||
Assertions.assertEquals(InitStatus.FINISH, module2.getInitStatus());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,15 +116,6 @@ private static void realMain(String[] args) throws Throwable {
|
|||
|
||||
// Verify 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).collect(Collectors.toList());
|
||||
// Start client with WatchService monitoring
|
||||
RequestService service;
|
||||
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());
|
||||
}
|
||||
}
|
||||
Set<Path> ignoredPath = new HashSet<>();
|
||||
if(options.moduleConf != null && options.moduleConf.modulePath != null) {
|
||||
List<Path> resolvedModulePath = resolveClassPathStream(ignoredPath, clientDir, options.moduleConf.modulePath).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(JVMHelper.JVM_VERSION <= 11) {
|
||||
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 {
|
||||
Stream<Path> result = resolveClassPathStream(ignorePaths, clientDir, profile.getClassPath());
|
||||
for (OptionalAction a : actions) {
|
||||
if (a instanceof OptionalActionClassPath)
|
||||
result = Stream.concat(result, resolveClassPathStream(ignorePaths, clientDir, ((OptionalActionClassPath) a).args));
|
||||
if(actions != null) {
|
||||
for (OptionalAction a : actions) {
|
||||
if (a instanceof OptionalActionClassPath)
|
||||
result = Stream.concat(result, resolveClassPathStream(ignorePaths, clientDir, ((OptionalActionClassPath) a).args));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ public enum WalkAction {
|
|||
|
||||
@FunctionalInterface
|
||||
public interface WalkCallback {
|
||||
WalkAction walked(String path, String name, HashedEntry entry) throws IOException;
|
||||
WalkAction walked(String path, String name, HashedEntry entry);
|
||||
}
|
||||
|
||||
public static class FindRecursiveResult {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package pro.gravit.utils;
|
||||
|
||||
public class HookException extends RuntimeException {
|
||||
private static final long serialVersionUID = -529141998961943161L;
|
||||
|
||||
public HookException(String message) {
|
||||
super(message);
|
||||
|
|
|
@ -6,7 +6,7 @@ public final class Version implements Comparable<Version> {
|
|||
|
||||
public static final int MAJOR = 5;
|
||||
public static final int MINOR = 6;
|
||||
public static final int PATCH = 9;
|
||||
public static final int PATCH = 16;
|
||||
public static final int BUILD = 1;
|
||||
public static final Version.Type RELEASE = Type.STABLE;
|
||||
public final int major;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package pro.gravit.utils.command;
|
||||
|
||||
public final class CommandException extends Exception {
|
||||
private static final long serialVersionUID = -6588814993972117772L;
|
||||
|
||||
|
||||
public CommandException(String message) {
|
||||
|
|
|
@ -221,37 +221,39 @@ public static ArgsParseResult parseJavaArgs(List<String> args) {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
if(arg.equals("--module-path") || arg.equals("-p")) {
|
||||
prevArgType = PrevArgType.MODULE_PATH;
|
||||
continue;
|
||||
}
|
||||
if(arg.equals("--classpath") || arg.equals("-cp")) {
|
||||
prevArgType = PrevArgType.CLASSPATH;
|
||||
continue;
|
||||
}
|
||||
if(arg.equals("--add-modules")) {
|
||||
prevArgType = PrevArgType.ADD_MODULES;
|
||||
continue;
|
||||
}
|
||||
if(arg.equals("--add-opens")) {
|
||||
prevArgType = PrevArgType.ADD_OPENS;
|
||||
continue;
|
||||
}
|
||||
if(arg.equals("--add-exports")) {
|
||||
prevArgType = PrevArgType.ADD_EXPORTS;
|
||||
continue;
|
||||
}
|
||||
if(arg.equals("--add-reads")) {
|
||||
prevArgType = PrevArgType.ADD_READS;
|
||||
continue;
|
||||
}
|
||||
if(arg.equals("--module") || arg.equals("-m")) {
|
||||
prevArgType = PrevArgType.MODULE;
|
||||
continue;
|
||||
}
|
||||
if(arg.equals("-jar")) {
|
||||
prevArgType = PrevArgType.JAR;
|
||||
continue;
|
||||
switch (arg) {
|
||||
case "--module-path", "-p" -> {
|
||||
prevArgType = PrevArgType.MODULE_PATH;
|
||||
continue;
|
||||
}
|
||||
case "--classpath", "-cp" -> {
|
||||
prevArgType = PrevArgType.CLASSPATH;
|
||||
continue;
|
||||
}
|
||||
case "--add-modules" -> {
|
||||
prevArgType = PrevArgType.ADD_MODULES;
|
||||
continue;
|
||||
}
|
||||
case "--add-opens" -> {
|
||||
prevArgType = PrevArgType.ADD_OPENS;
|
||||
continue;
|
||||
}
|
||||
case "--add-exports" -> {
|
||||
prevArgType = PrevArgType.ADD_EXPORTS;
|
||||
continue;
|
||||
}
|
||||
case "--add-reads" -> {
|
||||
prevArgType = PrevArgType.ADD_READS;
|
||||
continue;
|
||||
}
|
||||
case "--module", "-m" -> {
|
||||
prevArgType = PrevArgType.MODULE;
|
||||
continue;
|
||||
}
|
||||
case "-jar" -> {
|
||||
prevArgType = PrevArgType.JAR;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
jvmArgs.add(arg);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public static byte[] getClassBytes(Class<?> clazz, ClassLoader classLoader) thro
|
|||
return IOHelper.read(classLoader.getResourceAsStream(getClassFile(clazz)));
|
||||
}
|
||||
|
||||
public static InputStream getClassBytesStream(Class<?> clazz) throws IOException {
|
||||
public static InputStream getClassBytesStream(Class<?> clazz) {
|
||||
return getClassBytesStream(clazz, clazz.getClassLoader());
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public void addTransformer(ClassTransformer transformer) {
|
|||
}
|
||||
instrumentation.addTransformer(new ClassFileTransformer() {
|
||||
@Override
|
||||
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
|
||||
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) {
|
||||
if(transformer.filter(null, className)) {
|
||||
return transformer.transform(null, className, protectionDomain, classfileBuffer);
|
||||
}
|
||||
|
|
|
@ -14,5 +14,6 @@ public static final class ModuleConf {
|
|||
public Map<String, String> exports = new HashMap<>();
|
||||
public Map<String, String> opens = new HashMap<>();
|
||||
public Map<String, String> reads = new HashMap<>();
|
||||
public List<String> enableNativeAccess = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,18 @@ public class ModuleLaunch implements Launch {
|
|||
private ModuleLayer layer;
|
||||
private MethodHandles.Lookup hackLookup;
|
||||
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
|
||||
public ClassLoaderControl init(List<Path> files, String nativePath, LaunchOptions options) {
|
||||
this.disablePackageDelegateSupport = options.disablePackageDelegateSupport;
|
||||
|
@ -120,6 +132,20 @@ public ClassLoaderControl init(List<Path> files, String nativePath, LaunchOption
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ public void main() {
|
|||
String json2 = gson.toJson(new MyTestClass2("BBBB"), TestInterface.class);
|
||||
TestInterface test1 = gson.fromJson(json, TestInterface.class);
|
||||
TestInterface test2 = gson.fromJson(json2, TestInterface.class);
|
||||
Assertions.assertEquals(test1.get(), "AAAA");
|
||||
Assertions.assertEquals(test2.get(), "BBBB");
|
||||
Assertions.assertEquals("AAAA", test1.get());
|
||||
Assertions.assertEquals("BBBB", test2.get());
|
||||
}
|
||||
|
||||
public interface TestInterface {
|
||||
|
|
|
@ -48,6 +48,21 @@ pack project(':LauncherAPI')
|
|||
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 {
|
||||
publications {
|
||||
serverwrapperapi(MavenPublication) {
|
||||
|
@ -94,4 +109,4 @@ pack project(':LauncherAPI')
|
|||
sign publishing.publications.serverwrapperapi
|
||||
}
|
||||
|
||||
assemble.dependsOn tasks.shadowJar
|
||||
assemble.dependsOn tasks.shadowJar, tasks.inlinejar
|
||||
|
|
|
@ -25,14 +25,18 @@
|
|||
import pro.gravit.utils.launch.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ServerWrapper extends JsonConfigurable<ServerWrapper.Config> {
|
||||
public static final Path configFile = Paths.get(System.getProperty("serverwrapper.configFile", "ServerWrapperConfig.json"));
|
||||
|
@ -99,30 +103,20 @@ public void getProfiles() throws Exception {
|
|||
}
|
||||
}
|
||||
|
||||
public void run(String... args) throws Throwable {
|
||||
|
||||
public void initialize() throws Exception {
|
||||
initGson();
|
||||
AuthRequest.registerProviders();
|
||||
GetAvailabilityAuthRequest.registerProviders();
|
||||
OptionalAction.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");
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
public void connect() throws Exception {
|
||||
config.applyEnv();
|
||||
updateLauncherConfig();
|
||||
Launcher.applyLauncherEnv(Objects.requireNonNullElse(config.env, LauncherConfig.LauncherEnvironment.STD));
|
||||
StdWebSocketService service = StdWebSocketService.initWebSockets(config.address).get();
|
||||
service.reconnectCallback = () ->
|
||||
{
|
||||
|
@ -134,11 +128,6 @@ public void run(String... args) throws Throwable {
|
|||
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);
|
||||
if (config.logFile != null) LogHelper.addOutput(IOHelper.newWriter(Paths.get(config.logFile), true));
|
||||
{
|
||||
|
@ -151,6 +140,47 @@ public void run(String... args) throws Throwable {
|
|||
if(config.encodedServerEcPublicKey != null) {
|
||||
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;
|
||||
if (classname.isEmpty()) {
|
||||
LogHelper.error("MainClass not found. Please set MainClass for ServerWrapper.json or first commandline argument");
|
||||
|
@ -180,8 +210,6 @@ public void run(String... args) throws Throwable {
|
|||
System.arraycopy(args, 1, real_args, 0, args.length - 1);
|
||||
} else real_args = args;
|
||||
Launch launch;
|
||||
ClientService.nativePath = config.nativesDir;
|
||||
ConfigService.serverName = config.serverName;
|
||||
if(config.loadNatives != null) {
|
||||
for(String e : config.loadNatives) {
|
||||
System.load(Paths.get(config.nativesDir).resolve(ClientService.findLibrary(e)).toAbsolutePath().toString());
|
||||
|
@ -207,24 +235,27 @@ public void run(String... args) throws Throwable {
|
|||
LaunchOptions options = new LaunchOptions();
|
||||
options.enableHacks = config.enableHacks;
|
||||
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()) {
|
||||
ClientService.instrumentation = ServerAgent.inst;
|
||||
}
|
||||
ClientService.classLoaderControl = classLoaderControl;
|
||||
ClientService.baseURLs = classLoaderControl.getURLs();
|
||||
if(config.configServiceSettings != null) {
|
||||
config.configServiceSettings.apply();
|
||||
}
|
||||
LogHelper.info("Start Minecraft Server");
|
||||
try {
|
||||
if(config.compatClasses != null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
runCompatClasses();
|
||||
LogHelper.debug("Invoke main method %s with %s", classname, launch.getClass().getName());
|
||||
launch.launch(config.mainclass, config.mainmodule, Arrays.asList(real_args));
|
||||
} catch (Throwable e) {
|
||||
|
@ -251,12 +282,12 @@ public void setConfig(Config config) {
|
|||
@Override
|
||||
public Config getDefaultConfig() {
|
||||
Config newConfig = new Config();
|
||||
newConfig.serverName = "your server name";
|
||||
newConfig.serverName = "";
|
||||
newConfig.mainclass = "";
|
||||
newConfig.extendedTokens = new HashMap<>();
|
||||
newConfig.args = new ArrayList<>();
|
||||
newConfig.classpath = new ArrayList<>();
|
||||
newConfig.address = "ws://localhost:9274/api";
|
||||
newConfig.address = "";
|
||||
newConfig.classLoaderConfig = ClientProfile.ClassLoaderConfig.SYSTEM_ARGS;
|
||||
newConfig.env = LauncherConfig.LauncherEnvironment.STD;
|
||||
newConfig.properties = new HashMap<>();
|
||||
|
@ -304,5 +335,38 @@ public void apply() {
|
|||
ConfigService.checkServerConfig.needProperties = checkServerNeedProperties;
|
||||
}
|
||||
}
|
||||
|
||||
public void applyEnv() {
|
||||
this.authId = applyEnvOrDefault("SERVERWRAPPER_AUTH_ID", this.authId);
|
||||
this.address = applyEnvOrDefault("SERVERWRAPPER_ADDRESS", this.address);
|
||||
this.serverName = applyEnvOrDefault("SERVERWRAPPER_SERVER_NAME", this.serverName);
|
||||
this.encodedServerEcPublicKey = applyEnvOrDefault("SERVERWRAPPER_EC_PUBLIC_KEY", Base64.getUrlDecoder()::decode, null);
|
||||
this.encodedServerRsaPublicKey = applyEnvOrDefault("SERVERWRAPPER_RSA_PUBLIC_KEY", Base64.getUrlDecoder()::decode, null);
|
||||
{
|
||||
String token = System.getenv("SERVERWRAPPER_CHECK_SERVER_TOKEN");
|
||||
if(token != null) {
|
||||
if(extendedTokens == null) {
|
||||
extendedTokens = new HashMap<>();
|
||||
}
|
||||
extendedTokens.put("checkServer", new Request.ExtendedToken(token, 0L));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String applyEnvOrDefault(String envName, String def) {
|
||||
String value = System.getenv(envName);
|
||||
if(value == null) {
|
||||
return def;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private static<T> T applyEnvOrDefault(String envName, Function<String, T> mappingFunction, T def) {
|
||||
String value = System.getenv(envName);
|
||||
if(value == null) {
|
||||
return def;
|
||||
}
|
||||
return mappingFunction.apply(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -30,8 +30,11 @@ public ServerWrapperSetup() throws IOException {
|
|||
|
||||
public void run() throws Exception {
|
||||
ServerWrapper wrapper = ServerWrapper.wrapper;
|
||||
System.out.println("Print server jar filename:");
|
||||
String jarName = commands.commandHandler.readLine();
|
||||
String jarName = System.getenv("SERVERWRAPPER_JAR_NAME");
|
||||
if(jarName == null) {
|
||||
System.out.println("Print server jar filename:");
|
||||
jarName = commands.commandHandler.readLine();
|
||||
}
|
||||
Path jarPath = Paths.get(jarName);
|
||||
String mainClassName;
|
||||
String agentClassName;
|
||||
|
@ -56,14 +59,18 @@ public void run() throws Exception {
|
|||
if (agentClassName != null) {
|
||||
LogHelper.info("Found PremainClass %s", agentClassName);
|
||||
}
|
||||
System.out.println("Print your server name:");
|
||||
wrapper.config.serverName = commands.commandHandler.readLine();
|
||||
if(wrapper.config.serverName == null || wrapper.config.serverName.isEmpty()) {
|
||||
System.out.println("Print your server name:");
|
||||
wrapper.config.serverName = commands.commandHandler.readLine();
|
||||
}
|
||||
wrapper.config.mainclass = mainClassName;
|
||||
boolean altMode = false;
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
if(!Request.isAvailable() || Request.getRequestService().isClosed()) {
|
||||
System.out.println("Print launchserver websocket host( ws://host:port/api ):");
|
||||
wrapper.config.address = commands.commandHandler.readLine();
|
||||
if(wrapper.config.address == null || wrapper.config.address.isEmpty()) {
|
||||
System.out.println("Print launchserver websocket host( ws://host:port/api ):");
|
||||
wrapper.config.address = commands.commandHandler.readLine();
|
||||
}
|
||||
StdWebSocketService service;
|
||||
try {
|
||||
service = StdWebSocketService.initWebSockets(wrapper.config.address).get();
|
||||
|
@ -73,9 +80,11 @@ public void run() throws Exception {
|
|||
}
|
||||
Request.setRequestService(service);
|
||||
}
|
||||
System.out.println("Print server token:");
|
||||
String checkServerToken = commands.commandHandler.readLine();
|
||||
wrapper.config.extendedTokens.put("checkServer", new Request.ExtendedToken(checkServerToken, 0));
|
||||
if(wrapper.config.extendedTokens == null || wrapper.config.extendedTokens.get("checkServer") == null) {
|
||||
System.out.println("Print server token:");
|
||||
String checkServerToken = commands.commandHandler.readLine();
|
||||
wrapper.config.extendedTokens.put("checkServer", new Request.ExtendedToken(checkServerToken, 0));
|
||||
}
|
||||
wrapper.updateLauncherConfig();
|
||||
try {
|
||||
wrapper.restore();
|
||||
|
@ -93,7 +102,9 @@ public void run() throws Exception {
|
|||
}
|
||||
if(wrapper.profile != null && wrapper.profile.getVersion().compareTo(ClientProfileVersions.MINECRAFT_1_18) >= 0) {
|
||||
LogHelper.info("Switch to alternative start mode (1.18)");
|
||||
wrapper.config.classpath.add(jarName);
|
||||
if(!wrapper.config.classpath.contains(jarName)) {
|
||||
wrapper.config.classpath.add(jarName);
|
||||
}
|
||||
wrapper.config.classLoaderConfig = ClientProfile.ClassLoaderConfig.LAUNCHER;
|
||||
altMode = true;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
plugins {
|
||||
id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
|
||||
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||
id 'maven-publish'
|
||||
id 'signing'
|
||||
id 'org.openjfx.javafxplugin' version '0.1.0' apply false
|
||||
}
|
||||
group = 'pro.gravit.launcher'
|
||||
version = '5.6.9'
|
||||
version = '5.6.16'
|
||||
|
||||
apply from: 'props.gradle'
|
||||
|
||||
|
@ -71,10 +71,6 @@
|
|||
repositories {
|
||||
maven {
|
||||
url = version.endsWith('SNAPSHOT') ? getProperty('mavenSnapshotRepository') : getProperty('mavenReleaseRepository')
|
||||
credentials {
|
||||
username getProperty('mavenUsername')
|
||||
password getProperty('mavenPassword')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
5
gradlew
vendored
5
gradlew
vendored
|
@ -86,8 +86,7 @@ done
|
|||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
@ -206,7 +205,7 @@ fi
|
|||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# 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.
|
||||
# * 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.
|
||||
|
|
2
java24args.txt
Normal file
2
java24args.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
--enable-native-access=org.fusesource.jansi
|
||||
--enable-native-access=io.netty.common
|
4
javaargs.txt
Normal file
4
javaargs.txt
Normal 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
|
2
modules
2
modules
|
@ -1 +1 @@
|
|||
Subproject commit bf37c6860a80acfd516ee533494d64b226d89309
|
||||
Subproject commit a2c3ccecadb7f864039b88e6269583c4b77fba13
|
24
props.gradle
24
props.gradle
|
@ -1,18 +1,18 @@
|
|||
project.ext {
|
||||
verAsm = '9.7.1'
|
||||
verNetty = '4.1.114.Final'
|
||||
verOshiCore = '6.6.5'
|
||||
verJunit = '5.11.2'
|
||||
verNetty = '4.2.0.Final'
|
||||
verOshiCore = '6.8.0'
|
||||
verJunit = '5.11.4'
|
||||
verJansi = '2.4.1'
|
||||
verJline = '3.26.3'
|
||||
verJline = '3.29.0'
|
||||
verJwt = '0.12.6'
|
||||
verGson = '2.11.0'
|
||||
verBcpkix = '1.78.1'
|
||||
verSlf4j = '2.0.16'
|
||||
verLog4j = '2.24.1'
|
||||
verMySQLConn = '9.0.0'
|
||||
verMariaDBConn = '3.4.1'
|
||||
verPostgreSQLConn = '42.7.4'
|
||||
verGson = '2.12.1'
|
||||
verBcpkix = '1.80'
|
||||
verSlf4j = '2.0.17'
|
||||
verLog4j = '2.24.3'
|
||||
verMySQLConn = '9.2.0'
|
||||
verMariaDBConn = '3.5.3'
|
||||
verPostgreSQLConn = '42.7.5'
|
||||
verH2Conn = '2.3.232'
|
||||
verProguard = '7.6.0'
|
||||
verProguard = '7.7.0'
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue