Compare commits

..

No commits in common. "b1a5ecdc136bbcdf96474893f3dbb9211c48803c" and "79fc42e86a6e4970b0ea2c2df25fdce1bbc43da3" have entirely different histories.

21 changed files with 60 additions and 108 deletions

View file

@ -6,28 +6,26 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
submodules: recursive submodules: recursive
- name: Cache Gradle - name: Cache Gradle
uses: actions/cache@v4 uses: actions/cache@v1
with: with:
path: ~/.gradle/caches path: ~/.gradle/caches
key: gravit-${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-launcher key: gravit-${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-launcher
- name: Set up JDK 21 - name: Set up JDK 21
uses: actions/setup-java@v4 uses: actions/setup-java@v1
with: with:
java-version: 21 java-version: 21
distribution: temurin
- name: Grant execute permission for gradlew - name: Grant execute permission for gradlew
run: chmod +x gradlew run: chmod +x gradlew
- name: Build with Gradle - name: Build with Gradle
run: ./gradlew build run: ./gradlew build
- name: Generate and submit dependency graph - name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5
@ -44,7 +42,7 @@ jobs:
cp modules/*_lmodule/build/libs/*.jar artifacts/modules || true cp modules/*_lmodule/build/libs/*.jar artifacts/modules || true
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v1
with: with:
name: Launcher name: Launcher
path: artifacts path: artifacts
@ -65,7 +63,7 @@ jobs:
- name: Create release - name: Create release
id: create_release id: create_release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v1
if: startsWith(github.event.ref, 'refs/tags') if: startsWith(github.event.ref, 'refs/tags')
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -61,6 +61,7 @@
dependsOn jar dependsOn jar
archiveClassifier.set('clean') archiveClassifier.set('clean')
manifest.attributes("Main-Class": mainClassName, manifest.attributes("Main-Class": mainClassName,
"Premain-Class": mainAgentName,
"Automatic-Module-Name": "launchserver" "Automatic-Module-Name": "launchserver"
) )
from sourceSets.main.output from sourceSets.main.output
@ -70,6 +71,7 @@
dependencies { dependencies {
pack project(':LauncherAPI') pack project(':LauncherAPI')
bundle group: 'me.tongfei', name: 'progressbar', version: '0.10.1' bundle group: 'me.tongfei', name: 'progressbar', version: '0.10.1'
bundle group: 'com.github.Marcono1234', name: 'gson-record-type-adapter-factory', version: 'v0.3.0'
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', version: rootProject['verJline']
bundle group: 'org.jline', name: 'jline-reader', version: rootProject['verJline'] bundle group: 'org.jline', name: 'jline-reader', version: rootProject['verJline']
@ -91,16 +93,20 @@ pack project(':LauncherAPI')
bundle group: 'io.jsonwebtoken', name: 'jjwt-api', version: rootProject['verJwt'] bundle group: 'io.jsonwebtoken', name: 'jjwt-api', version: rootProject['verJwt']
bundle group: 'io.jsonwebtoken', name: 'jjwt-impl', version: rootProject['verJwt'] bundle group: 'io.jsonwebtoken', name: 'jjwt-impl', version: rootProject['verJwt']
bundle group: 'io.jsonwebtoken', name: 'jjwt-gson', version: rootProject['verJwt'] bundle group: 'io.jsonwebtoken', name: 'jjwt-gson', version: rootProject['verJwt']
bundle group: 'com.google.code.gson', name: 'gson', version: rootProject['verGson']
annotationProcessor(group: 'org.apache.logging.log4j', name: 'log4j-core', version: rootProject['verLog4j']) annotationProcessor(group: 'org.apache.logging.log4j', name: 'log4j-core', version: rootProject['verLog4j'])
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: rootProject['verJunit'] testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: rootProject['verJunit']
hikari 'io.micrometer:micrometer-core:1.13.1' hikari 'io.micrometer:micrometer-core:1.8.4'
hikari('com.zaxxer:HikariCP:5.1.0') { hikari('com.zaxxer:HikariCP:5.0.1') {
exclude group: 'javassist' exclude group: 'javassist'
exclude group: 'io.micrometer' exclude group: 'io.micrometer'
exclude group: 'org.slf4j' exclude group: 'org.slf4j'
} }
compileOnlyA group: 'com.google.guava', name: 'guava', version: rootProject['verGuavaC']
// Do not update (laggy deps).
compileOnlyA 'log4j:log4j:1.2.17'
compileOnlyA 'org.apache.logging.log4j:log4j-core:2.14.1'
} }
tasks.register('hikari', Copy) { tasks.register('hikari', Copy) {

View file

@ -82,9 +82,6 @@ public final class LaunchServer implements Runnable, AutoCloseable, Reconfigurab
*/ */
public final Path profilesDir; public final Path profilesDir;
public final Path tmpDir; public final Path tmpDir;
public final Path modulesDir;
public final Path launcherModulesDir;
public final Path librariesDir;
/** /**
* This object contains runtime configuration * This object contains runtime configuration
*/ */
@ -139,9 +136,6 @@ public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, La
launcherLibraries = directories.launcherLibrariesDir; launcherLibraries = directories.launcherLibrariesDir;
launcherLibrariesCompile = directories.launcherLibrariesCompileDir; launcherLibrariesCompile = directories.launcherLibrariesCompileDir;
launcherPack = directories.launcherPackDir; launcherPack = directories.launcherPackDir;
modulesDir = directories.modules;
launcherModulesDir = directories.launcherModules;
librariesDir = directories.librariesDir;
this.shardId = shardId; this.shardId = shardId;
if(!Files.isDirectory(launcherPack)) { if(!Files.isDirectory(launcherPack)) {
Files.createDirectories(launcherPack); Files.createDirectories(launcherPack);
@ -357,17 +351,14 @@ public void run() {
// Sync updates dir // Sync updates dir
CommonHelper.newThread("Profiles and updates sync", true, () -> { CommonHelper.newThread("Profiles and updates sync", true, () -> {
try { try {
// Sync profiles dir
if (!IOHelper.isDir(profilesDir))
Files.createDirectory(profilesDir);
syncProfilesDir();
// Sync updates dir
if (!IOHelper.isDir(updatesDir)) if (!IOHelper.isDir(updatesDir))
Files.createDirectory(updatesDir); Files.createDirectory(updatesDir);
updatesManager.readUpdatesDir(); updatesManager.readUpdatesDir();
// Sync profiles dir
if (!IOHelper.isDir(profilesDir))
Files.createDirectory(profilesDir);
syncProfilesDir();
modulesManager.invokeEvent(new LaunchServerProfilesSyncEvent(this)); modulesManager.invokeEvent(new LaunchServerProfilesSyncEvent(this));
} catch (IOException e) { } catch (IOException e) {
logger.error("Updates/Profiles not synced", e); logger.error("Updates/Profiles not synced", e);
@ -497,10 +488,9 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
public static class LaunchServerDirectories { public static class LaunchServerDirectories {
public static final String UPDATES_NAME = "updates", PROFILES_NAME = "profiles", public static final String UPDATES_NAME = "updates", PROFILES_NAME = "profiles",
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"; LAUNCHERLIBRARIESCOMPILE_NAME = "launcher-libraries-compile", LAUNCHERPACK_NAME = "launcher-pack", KEY_NAME = ".keys";
public Path updatesDir; public Path updatesDir;
public Path profilesDir; public Path profilesDir;
public Path librariesDir;
public Path launcherLibrariesDir; public Path launcherLibrariesDir;
public Path launcherLibrariesCompileDir; public Path launcherLibrariesCompileDir;
public Path launcherPackDir; public Path launcherPackDir;
@ -508,8 +498,6 @@ public static class LaunchServerDirectories {
public Path dir; public Path dir;
public Path trustStore; public Path trustStore;
public Path tmpDir; public Path tmpDir;
public Path modules;
public Path launcherModules;
public void collect() { public void collect() {
if (updatesDir == null) updatesDir = getPath(UPDATES_NAME); if (updatesDir == null) updatesDir = getPath(UPDATES_NAME);
@ -521,9 +509,6 @@ public void collect() {
if(launcherPackDir == null) if(launcherPackDir == null)
launcherPackDir = getPath(LAUNCHERPACK_NAME); launcherPackDir = getPath(LAUNCHERPACK_NAME);
if (keyDirectory == null) keyDirectory = getPath(KEY_NAME); if (keyDirectory == null) keyDirectory = getPath(KEY_NAME);
if (modules == null) modules = getPath(MODULES);
if (launcherModules == null) launcherModules = getPath(LAUNCHER_MODULES);
if (librariesDir == null) librariesDir = getPath(LIBRARIES);
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

@ -34,7 +34,6 @@
import java.nio.file.Path; import java.nio.file.Path;
import java.security.Security; import java.security.Security;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class LaunchServerStarter { public class LaunchServerStarter {
@ -52,13 +51,10 @@ public static void main(String[] args) throws Exception {
try { try {
Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider"); Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
Security.addProvider(new BouncyCastleProvider()); Security.addProvider(new BouncyCastleProvider());
} catch (ClassNotFoundException | NoClassDefFoundError ex) { } catch (ClassNotFoundException ex) {
LogHelper.error("Library BouncyCastle not found! Is directory 'libraries' empty?"); LogHelper.error("Library BouncyCastle not found! Is directory 'libraries' empty?");
return; return;
} }
LaunchServer.LaunchServerDirectories directories = new LaunchServer.LaunchServerDirectories();
directories.dir = dir;
directories.collect();
CertificateManager certificateManager = new CertificateManager(); CertificateManager certificateManager = new CertificateManager();
try { try {
certificateManager.readTrustStore(dir.resolve("truststore")); certificateManager.readTrustStore(dir.resolve("truststore"));
@ -82,7 +78,7 @@ public static void main(String[] args) throws Exception {
LaunchServerRuntimeConfig runtimeConfig; LaunchServerRuntimeConfig runtimeConfig;
LaunchServerConfig config; LaunchServerConfig config;
LaunchServer.LaunchServerEnv env = LaunchServer.LaunchServerEnv.PRODUCTION; LaunchServer.LaunchServerEnv env = LaunchServer.LaunchServerEnv.PRODUCTION;
LaunchServerModulesManager modulesManager = new LaunchServerModulesManager(directories.modules, dir.resolve("config"), certificateManager.trustManager); LaunchServerModulesManager modulesManager = new LaunchServerModulesManager(dir.resolve("modules"), dir.resolve("config"), certificateManager.trustManager);
modulesManager.autoload(); modulesManager.autoload();
modulesManager.initModules(null); modulesManager.initModules(null);
registerAll(); registerAll();
@ -127,6 +123,8 @@ public static void main(String[] args) throws Exception {
} }
LaunchServer.LaunchServerConfigManager launchServerConfigManager = new BasicLaunchServerConfigManager(configFile, runtimeConfigFile); LaunchServer.LaunchServerConfigManager launchServerConfigManager = new BasicLaunchServerConfigManager(configFile, runtimeConfigFile);
LaunchServer.LaunchServerDirectories directories = new LaunchServer.LaunchServerDirectories();
directories.dir = dir;
LaunchServer server = new LaunchServerBuilder() LaunchServer server = new LaunchServerBuilder()
.setDirectories(directories) .setDirectories(directories)
.setEnv(env) .setEnv(env)
@ -137,24 +135,7 @@ public static void main(String[] args) throws Exception {
.setLaunchServerConfigManager(launchServerConfigManager) .setLaunchServerConfigManager(launchServerConfigManager)
.setCertificateManager(certificateManager) .setCertificateManager(certificateManager)
.build(); .build();
List<String> allArgs = List.of(args); if (!prepareMode) {
boolean isPrepareMode = prepareMode || allArgs.contains("--prepare");
boolean isRunCommand = false;
String runCommand = null;
for(var e : allArgs) {
if(e.equals("--run")) {
isRunCommand = true;
continue;
}
if(isRunCommand) {
runCommand = e;
isRunCommand = false;
}
}
if(runCommand != null) {
localCommandHandler.eval(runCommand, false);
}
if (!isPrepareMode) {
server.run(); server.run();
} else { } else {
server.close(); server.close();
@ -220,7 +201,7 @@ public static void generateConfigIfNotExists(Path configFile, CommandHandler com
address = System.getProperty("launchserver.address", null); address = System.getProperty("launchserver.address", null);
} }
if (address == null) { if (address == null) {
System.out.println("External launchServer address:port (default: localhost:9274): "); System.out.println("LaunchServer address(default: localhost): ");
address = commandHandler.readLine(); address = commandHandler.readLine();
} }
String projectName = System.getenv("PROJECTNAME"); String projectName = System.getenv("PROJECTNAME");
@ -234,29 +215,18 @@ public static void generateConfigIfNotExists(Path configFile, CommandHandler com
newConfig.setProjectName(projectName); newConfig.setProjectName(projectName);
} }
if (address == null || address.isEmpty()) { if (address == null || address.isEmpty()) {
logger.error("Address null. Using localhost:9274"); logger.error("Address null. Using localhost");
address = "localhost:9274"; address = "localhost";
} }
if (newConfig.projectName == null || newConfig.projectName.isEmpty()) { if (newConfig.projectName == null || newConfig.projectName.isEmpty()) {
logger.error("ProjectName null. Using MineCraft"); logger.error("ProjectName null. Using MineCraft");
newConfig.projectName = "MineCraft"; newConfig.projectName = "MineCraft";
} }
int port = 9274;
if(address.contains(":")) { newConfig.netty.address = "ws://" + address + ":9274/api";
String portString = address.substring(address.indexOf(':')+1); newConfig.netty.downloadURL = "http://" + address + ":9274/%dirname%/";
try { newConfig.netty.launcherURL = "http://" + address + ":9274/Launcher.jar";
port = Integer.parseInt(portString); newConfig.netty.launcherEXEURL = "http://" + address + ":9274/Launcher.exe";
} catch (NumberFormatException e) {
logger.warn("Unknown port {}, using 9274", portString);
}
} else {
logger.info("Address {} doesn't contains port (you want to use nginx?)", address);
}
newConfig.netty.address = "ws://" + address + "/api";
newConfig.netty.downloadURL = "http://" + address + "/%dirname%/";
newConfig.netty.launcherURL = "http://" + address + "/Launcher.jar";
newConfig.netty.launcherEXEURL = "http://" + address + "/Launcher.exe";
newConfig.netty.binds[0].port = port;
// Write LaunchServer config // Write LaunchServer config
logger.info("Writing LaunchServer config file"); logger.info("Writing LaunchServer config file");

View file

@ -21,7 +21,6 @@ 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", "jline", "progressbar", "kotlin", "epoll");
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 boolean isClasspathOnly(Path path) { private static boolean isClasspathOnly(Path path) {
var fileName = path.getFileName().toString(); var fileName = path.getFileName().toString();
for(var e : classpathOnly) { for(var e : classpathOnly) {
@ -57,9 +56,8 @@ public static void main(String[] args) throws Throwable {
ModuleLaunch launch = new ModuleLaunch(); ModuleLaunch launch = new ModuleLaunch();
LaunchOptions options = new LaunchOptions(); LaunchOptions options = new LaunchOptions();
options.moduleConf = new LaunchOptions.ModuleConf(); options.moduleConf = new LaunchOptions.ModuleConf();
Path librariesPath = Path.of(System.getProperty(LIBRARIES_PROPERTY, "libraries"));
List<Path> libraries; List<Path> libraries;
try(Stream<Path> files = Files.walk(librariesPath, FileVisitOption.FOLLOW_LINKS)) { try(Stream<Path> files = Files.walk(Path.of("libraries"), FileVisitOption.FOLLOW_LINKS)) {
libraries = new ArrayList<>(files.filter(e -> e.getFileName().toString().endsWith(".jar")).toList()); libraries = new ArrayList<>(files.filter(e -> e.getFileName().toString().endsWith(".jar")).toList());
} }
List<Path> classpath = new ArrayList<>(); List<Path> classpath = new ArrayList<>();

View file

@ -276,7 +276,7 @@ public void close() {
protected SQLUser constructUser(ResultSet set) throws SQLException { protected SQLUser constructUser(ResultSet set) throws SQLException {
return set.next() ? new SQLUser(UUID.fromString(set.getString(uuidColumn)), set.getString(usernameColumn), return set.next() ? new SQLUser(UUID.fromString(set.getString(uuidColumn)), set.getString(usernameColumn),
set.getString(accessTokenColumn), set.getString(serverIDColumn), set.getString(passwordColumn)) : null; set.getString(accessTokenColumn), set.getString(serverIDColumn), set.getString(passwordColumn), requestPermissions(set.getString(uuidColumn))) : null;
} }
public ClientPermissions requestPermissions (String uuid) throws SQLException public ClientPermissions requestPermissions (String uuid) throws SQLException
@ -286,17 +286,14 @@ public ClientPermissions requestPermissions (String uuid) throws SQLException
} }
private SQLUser queryUser(String sql, String value) throws SQLException { private SQLUser queryUser(String sql, String value) throws SQLException {
SQLUser user;
try (Connection c = getSQLConfig().getConnection()) { try (Connection c = getSQLConfig().getConnection()) {
PreparedStatement s = c.prepareStatement(sql); PreparedStatement s = c.prepareStatement(sql);
s.setString(1, value); s.setString(1, value);
s.setQueryTimeout(MySQLSourceConfig.TIMEOUT); s.setQueryTimeout(MySQLSourceConfig.TIMEOUT);
try (ResultSet set = s.executeQuery()) { try (ResultSet set = s.executeQuery()) {
user = constructUser(set); return constructUser(set);
} }
} }
user.permissions = requestPermissions(user.uuid.toString());
return user;
} }
private List<String> queryPermissions(String sql, String value) throws SQLException { private List<String> queryPermissions(String sql, String value) throws SQLException {
@ -343,14 +340,15 @@ public static class SQLUser implements User {
protected String accessToken; protected String accessToken;
protected String serverId; protected String serverId;
protected final String password; protected final String password;
protected ClientPermissions permissions; protected final ClientPermissions permissions;
public SQLUser(UUID uuid, String username, String accessToken, String serverId, String password) { public SQLUser(UUID uuid, String username, String accessToken, String serverId, String password, ClientPermissions permissions) {
this.uuid = uuid; this.uuid = uuid;
this.username = username; this.username = username;
this.accessToken = accessToken; this.accessToken = accessToken;
this.serverId = serverId; this.serverId = serverId;
this.password = password; this.password = password;
this.permissions = permissions;
} }
@Override @Override

View file

@ -72,7 +72,7 @@ protected String makeUserCols() {
@Override @Override
protected MySQLUser constructUser(ResultSet set) throws SQLException { protected MySQLUser constructUser(ResultSet set) throws SQLException {
return set.next() ? new MySQLUser(UUID.fromString(set.getString(uuidColumn)), set.getString(usernameColumn), return set.next() ? new MySQLUser(UUID.fromString(set.getString(uuidColumn)), set.getString(usernameColumn),
set.getString(accessTokenColumn), set.getString(serverIDColumn), set.getString(passwordColumn), set.getLong(hardwareIdColumn)) : null; set.getString(accessTokenColumn), set.getString(serverIDColumn), set.getString(passwordColumn), requestPermissions(set.getString(uuidColumn)), set.getLong(hardwareIdColumn)) : null;
} }
private MySQLUserHardware fetchHardwareInfo(ResultSet set) throws SQLException, IOException { private MySQLUserHardware fetchHardwareInfo(ResultSet set) throws SQLException, IOException {
@ -336,8 +336,8 @@ public String toString() {
public static class MySQLUser extends SQLUser { public static class MySQLUser extends SQLUser {
protected long hwidId; protected long hwidId;
public MySQLUser(UUID uuid, String username, String accessToken, String serverId, String password, long hwidId) { public MySQLUser(UUID uuid, String username, String accessToken, String serverId, String password, ClientPermissions permissions, long hwidId) {
super(uuid, username, accessToken, serverId, password); super(uuid, username, accessToken, serverId, password, permissions);
this.hwidId = hwidId; this.hwidId = hwidId;
} }

View file

@ -37,9 +37,7 @@ public Path process(Path inputFile) throws IOException {
server.launcherBinary.addonLibs.clear(); server.launcherBinary.addonLibs.clear();
server.launcherBinary.files.clear(); server.launcherBinary.files.clear();
IOHelper.walk(server.launcherLibraries, new ListFileVisitor(server.launcherBinary.coreLibs), false); IOHelper.walk(server.launcherLibraries, new ListFileVisitor(server.launcherBinary.coreLibs), false);
if(Files.isDirectory(server.launcherLibrariesCompile)) {
IOHelper.walk(server.launcherLibrariesCompile, new ListFileVisitor(server.launcherBinary.addonLibs), false); IOHelper.walk(server.launcherLibrariesCompile, new ListFileVisitor(server.launcherBinary.addonLibs), false);
}
try(Stream<Path> stream = Files.walk(server.launcherPack).filter((e) -> { try(Stream<Path> stream = Files.walk(server.launcherPack).filter((e) -> {
try { try {
return !Files.isDirectory(e) && !Files.isHidden(e); return !Files.isDirectory(e) && !Files.isHidden(e);

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(Path.of("libraries"), 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

@ -103,7 +103,6 @@ public static ClientProfile makeProfile(ClientProfile.Version version, String ti
} }
if (fabric.isPresent()) { if (fabric.isPresent()) {
builder.setAltClassPath(fabric.orElseThrow().getAltClassPath()); builder.setAltClassPath(fabric.orElseThrow().getAltClassPath());
jvmArgs.add("-Dsodium.checks.issue2561=false"); // Please don't check LWJL3 version (Sodium: https://github.com/CaffeineMC/sodium-fabric/issues/2561 )
} }
if(quilt.isPresent()) { if(quilt.isPresent()) {
builder.setClassLoaderConfig(ClientProfile.ClassLoaderConfig.SYSTEM_ARGS); builder.setClassLoaderConfig(ClientProfile.ClassLoaderConfig.SYSTEM_ARGS);
@ -197,9 +196,6 @@ public static String getMainClassByVersion(ClientProfile.Version version, MakePr
if(version.compareTo(ClientProfileVersions.MINECRAFT_1_7_10) == 0) { if(version.compareTo(ClientProfileVersions.MINECRAFT_1_7_10) == 0) {
return "com.gtnewhorizons.retrofuturabootstrap.Main"; return "com.gtnewhorizons.retrofuturabootstrap.Main";
} }
if(version.compareTo(ClientProfileVersions.MINECRAFT_1_12_2) == 0) {
return "top.outlands.foundation.boot.Foundation"; // Cleanroom
}
if (findOption(options, MakeProfileOptionLaunchWrapper.class).isPresent()) { if (findOption(options, MakeProfileOptionLaunchWrapper.class).isPresent()) {
return "net.minecraft.launchwrapper.Launch"; return "net.minecraft.launchwrapper.Launch";
} }
@ -207,7 +203,7 @@ public static String getMainClassByVersion(ClientProfile.Version version, MakePr
return "cpw.mods.modlauncher.Launcher"; return "cpw.mods.modlauncher.Launcher";
} }
if (findOption(options, MakeProfileOptionFabric.class).isPresent()) { if (findOption(options, MakeProfileOptionFabric.class).isPresent()) {
return "net.fabricmc.loader.impl.launch.knot.KnotClient"; return "net.fabricmc.loader.launch.knot.KnotClient";
} }
if(findOption(options, MakeProfilesOptionsQuilt.class).isPresent()) { if(findOption(options, MakeProfilesOptionsQuilt.class).isPresent()) {
return "org.quiltmc.loader.impl.launch.knot.KnotClient"; return "org.quiltmc.loader.impl.launch.knot.KnotClient";

View file

@ -33,7 +33,7 @@ public class LauncherModuleLoader {
public LauncherModuleLoader(LaunchServer server) { public LauncherModuleLoader(LaunchServer server) {
this.server = server; this.server = server;
modulesDir = server.launcherModulesDir; modulesDir = server.dir.resolve("launcher-modules");
} }
public void init() { public void init() {

View file

@ -22,7 +22,6 @@ public class KeyAgreementManager {
public final RSAPublicKey rsaPublicKey; public final RSAPublicKey rsaPublicKey;
public final RSAPrivateKey rsaPrivateKey; public final RSAPrivateKey rsaPrivateKey;
public final String legacySalt; public final String legacySalt;
public final Path keyDirectory;
public KeyAgreementManager(ECPublicKey ecdsaPublicKey, ECPrivateKey ecdsaPrivateKey, RSAPublicKey rsaPublicKey, RSAPrivateKey rsaPrivateKey, String legacySalt) { public KeyAgreementManager(ECPublicKey ecdsaPublicKey, ECPrivateKey ecdsaPrivateKey, RSAPublicKey rsaPublicKey, RSAPrivateKey rsaPrivateKey, String legacySalt) {
this.ecdsaPublicKey = ecdsaPublicKey; this.ecdsaPublicKey = ecdsaPublicKey;
@ -30,11 +29,9 @@ public KeyAgreementManager(ECPublicKey ecdsaPublicKey, ECPrivateKey ecdsaPrivate
this.rsaPublicKey = rsaPublicKey; this.rsaPublicKey = rsaPublicKey;
this.rsaPrivateKey = rsaPrivateKey; this.rsaPrivateKey = rsaPrivateKey;
this.legacySalt = legacySalt; this.legacySalt = legacySalt;
this.keyDirectory = null;
} }
public KeyAgreementManager(Path keyDirectory) throws IOException, InvalidKeySpecException { public KeyAgreementManager(Path keyDirectory) throws IOException, InvalidKeySpecException {
this.keyDirectory = keyDirectory;
Path ecdsaPublicKeyPath = keyDirectory.resolve("ecdsa_id.pub"), ecdsaPrivateKeyPath = keyDirectory.resolve("ecdsa_id"); Path ecdsaPublicKeyPath = keyDirectory.resolve("ecdsa_id.pub"), ecdsaPrivateKeyPath = keyDirectory.resolve("ecdsa_id");
Logger logger = LogManager.getLogger(); Logger logger = LogManager.getLogger();
if (IOHelper.isFile(ecdsaPublicKeyPath) && IOHelper.isFile(ecdsaPrivateKeyPath)) { if (IOHelper.isFile(ecdsaPublicKeyPath) && IOHelper.isFile(ecdsaPrivateKeyPath)) {

View file

@ -1,6 +1,7 @@
package pro.gravit.launchserver.manangers; package pro.gravit.launchserver.manangers;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import marcono1234.gson.recordadapter.RecordTypeAdapterFactory;
import pro.gravit.launcher.base.events.request.GetAvailabilityAuthRequestEvent; import pro.gravit.launcher.base.events.request.GetAvailabilityAuthRequestEvent;
import pro.gravit.launcher.core.managers.GsonManager; import pro.gravit.launcher.core.managers.GsonManager;
import pro.gravit.launcher.base.modules.events.PreGsonPhase; import pro.gravit.launcher.base.modules.events.PreGsonPhase;
@ -33,6 +34,9 @@ public LaunchServerGsonManager(LaunchServerModulesManager modulesManager) {
@Override @Override
public void registerAdapters(GsonBuilder builder) { public void registerAdapters(GsonBuilder builder) {
super.registerAdapters(builder); super.registerAdapters(builder);
builder.registerTypeAdapterFactory(RecordTypeAdapterFactory.builder()
.allowMissingComponentValues()
.create());
builder.registerTypeAdapter(ClientProfile.Version.class, new ClientProfile.Version.GsonSerializer()); builder.registerTypeAdapter(ClientProfile.Version.class, new ClientProfile.Version.GsonSerializer());
builder.registerTypeAdapter(TextureProvider.class, new UniversalJsonAdapter<>(TextureProvider.providers)); builder.registerTypeAdapter(TextureProvider.class, new UniversalJsonAdapter<>(TextureProvider.providers));
builder.registerTypeAdapter(AuthCoreProvider.class, new UniversalJsonAdapter<>(AuthCoreProvider.providers)); builder.registerTypeAdapter(AuthCoreProvider.class, new UniversalJsonAdapter<>(AuthCoreProvider.providers));

View file

@ -256,7 +256,7 @@ protected HttpRequest makeHttpRequest(URI baseUri, String filePath) throws URISy
} }
protected ProgressTrackingBodyHandler<Path> makeBodyHandler(Path file, DownloadCallback callback) { protected ProgressTrackingBodyHandler<Path> makeBodyHandler(Path file, DownloadCallback callback) {
return new ProgressTrackingBodyHandler<>(HttpResponse.BodyHandlers.ofFile(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING), callback); return new ProgressTrackingBodyHandler<>(HttpResponse.BodyHandlers.ofFile(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE), callback);
} }
public interface DownloadCallback { public interface DownloadCallback {

View file

@ -79,7 +79,6 @@ public ClientProfileBuilder(ClientProfile profile) {
this.loadNatives = new ArrayList<>(profile.getLoadNatives()); this.loadNatives = new ArrayList<>(profile.getLoadNatives());
this.properties = new HashMap<>(profile.getProperties()); this.properties = new HashMap<>(profile.getProperties());
this.servers = new ArrayList<>(profile.getServers()); this.servers = new ArrayList<>(profile.getServers());
this.classLoaderConfig = profile.getClassLoaderConfig();
this.flags = new ArrayList<>(profile.getFlags()); this.flags = new ArrayList<>(profile.getFlags());
this.recommendJavaVersion = profile.getRecommendJavaVersion(); this.recommendJavaVersion = profile.getRecommendJavaVersion();
this.minJavaVersion = profile.getMinJavaVersion(); this.minJavaVersion = profile.getMinJavaVersion();

View file

@ -88,7 +88,7 @@ public Set<OptionalAction> getEnabledActions() {
public void fixDependencies() { public void fixDependencies() {
Set<OptionalFile> disabled = all.stream().filter(t -> !isEnabled(t)).collect(Collectors.toSet()); Set<OptionalFile> disabled = all.stream().filter(t -> !isEnabled(t)).collect(Collectors.toSet());
for (OptionalFile file : disabled) { for (OptionalFile file : disabled) {
if (file.group != null && file.group.length > 0 && Arrays.stream(file.group).noneMatch(this::isEnabled)) { if (file.group != null && Arrays.stream(file.group).noneMatch(this::isEnabled)) {
enable(file.group[0], false, null); enable(file.group[0], false, null);
} }
} }

View file

@ -6,6 +6,7 @@
compileOnly group: 'org.jline', name: 'jline', version: rootProject['verJline'] compileOnly group: 'org.jline', name: 'jline', version: rootProject['verJline']
compileOnly group: 'org.jline', name: 'jline-reader', version: rootProject['verJline'] compileOnly group: 'org.jline', name: 'jline-reader', version: rootProject['verJline']
compileOnly group: 'org.jline', name: 'jline-terminal', version: rootProject['verJline'] compileOnly group: 'org.jline', name: 'jline-terminal', version: rootProject['verJline']
compileOnly group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: rootProject['verBcprov']
compileOnly group: 'org.slf4j', name: 'slf4j-api', version: rootProject['verSlf4j'] compileOnly group: 'org.slf4j', name: 'slf4j-api', version: rootProject['verSlf4j']
api group: 'com.google.code.gson', name: 'gson', version: rootProject['verGson'] api group: 'com.google.code.gson', name: 'gson', version: rootProject['verGson']
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: rootProject['verJunit'] testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: rootProject['verJunit']

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 = 5; public static final int PATCH = 2;
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

@ -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.5' version = '5.6.2'
apply from: 'props.gradle' apply from: 'props.gradle'

@ -1 +1 @@
Subproject commit 9f1ccd0bbc767d04a8a2d2909cc050980c8a458f Subproject commit a52b9cc8552445167b95e8933f4289bbaa70677d

View file

@ -1,16 +1,18 @@
project.ext { project.ext {
verAsm = '9.7' verAsm = '9.7'
verNetty = '4.1.111.Final' verNetty = '4.1.110.Final'
verOshiCore = '6.6.1' verOshiCore = '6.6.1'
verJunit = '5.10.2' verJunit = '5.10.2'
verGuavaC = '30.1.1-jre'
verJansi = '2.4.1' verJansi = '2.4.1'
verJline = '3.26.1' verJline = '3.26.1'
verJwt = '0.12.5' verJwt = '0.12.5'
verBcprov = '1.70'
verGson = '2.11.0' verGson = '2.11.0'
verBcpkix = '1.78.1' verBcpkix = '1.78.1'
verSlf4j = '2.0.13' verSlf4j = '2.0.13'
verLog4j = '2.23.1' verLog4j = '2.23.1'
verMySQLConn = '9.0.0' verMySQLConn = '8.4.0'
verMariaDBConn = '3.4.0' verMariaDBConn = '3.4.0'
verPostgreSQLConn = '42.7.3' verPostgreSQLConn = '42.7.3'
verH2Conn = '2.2.224' verH2Conn = '2.2.224'