Compare commits

..

38 commits

Author SHA1 Message Date
Gravita
b1a5ecdc13
Merge branch 'release/5.6.5' 2024-07-21 20:18:00 +07:00
Gravita
68e9affbe0
[ANY] 5.6.5-stable 2024-07-21 20:17:51 +07:00
Gravita
7d7485afdc
[FIX] Downloader downloadList truncate file 2024-07-21 19:48:55 +07:00
Gravita
c2926b5b40
[ANY] Update modules 2024-07-20 19:20:12 +07:00
Gravita
9c82d76781
[FEATURE][REFACTOR] Refactoring GenerateCertificateModule 2024-07-20 19:19:41 +07:00
Gravita
450774de7e
Merge tag 'v5.6.4' into dev
5.6.4-stable hotfix
2024-07-18 20:35:57 +07:00
Gravita
f88c0308f8
Merge branch 'release/5.6.4' 2024-07-18 20:35:46 +07:00
Gravita
20f713be05
5.6.4-stable 2024-07-18 20:35:26 +07:00
Gravita
5bf92d9a00
[FIX] ProGuard librariesDir 2024-07-18 20:34:31 +07:00
Gravita
903c4d40c5
Merge tag 'v5.6.3' into dev
5.6.3-stable
2024-07-18 15:55:07 +07:00
Gravita
ede9ab2c85
Merge branch 'release/5.6.3' 2024-07-18 15:54:58 +07:00
Gravita
c8c83c0dba
[ANY] 5.6.3-stable 2024-07-18 15:54:45 +07:00
Gravita
1bd5d8854c
[FIX] ProGuard and launchserver.dir.libraries 2024-07-17 01:32:51 +07:00
Gravita
992d31c883
[FEATURE] Set netty bind port in first run 2024-07-16 22:05:13 +07:00
Gravita
accbbe6b13
[FEATURE] Support port in launchserver address in first run 2024-07-16 21:54:59 +07:00
Gravita
0894e0b9c3
[FIX] Sync profiles before updates 2024-07-16 17:11:12 +07:00
Gravita
925007015f
[ANY] Update modules 2024-07-09 20:57:52 +07:00
Gravita
ec526a343d
[FIX] OptionalView.fixDependencies throw out of range 2024-07-08 21:29:40 +07:00
Gravita
1bebd8de2c
[FIX] classLoaderConfig is null 2024-07-08 21:22:44 +07:00
Gravita
c7781b30be
[FIX] launcher-libraries-compile not found 2024-07-06 22:34:20 +07:00
Gravita
df9d05a49c
[FEATURE] Support -Dlaunchserver.dir.modules and -Dlaunchserver.dir.launcher-modules 2024-07-06 03:24:02 +07:00
Gravita
03d53d4a09
[FEATURE] Support -Dlaunchserver.dir.libraries 2024-07-06 02:59:36 +07:00
Gravita
c261496af8
[ANY] Update modules 2024-07-06 01:55:10 +07:00
Gravita
8c11ab0cbe
[FIX] Disable Sodium lwjgl check 2024-07-05 16:27:50 +07:00
Gravita
78b4f1e3aa
[FIX] Gson version 2024-07-05 15:55:54 +07:00
Gravita
bbc5f1722b
[ANY] Update modules 2024-07-05 15:30:03 +07:00
Gravita
51411c5838
[ANY] Update modules 2024-07-05 14:55:21 +07:00
Gravita
3b22b76278
[FIX] Cleanroom install 2024-07-05 14:55:10 +07:00
Gravita
ef9cbfe0da
[ANY] Update modules 2024-07-05 14:38:57 +07:00
Gravita
353b663e12
[FEATURE] Support command execute by args 2024-07-05 14:38:45 +07:00
Gravita
78be606029
[FIX] FabricLoader main class 2024-07-05 14:27:45 +07:00
Gravita
584acdb8c3
[ANY] Update dependencies 2024-07-05 14:15:22 +07:00
Gravita
7f6a645dd7 [FIX] Compile fix 2024-06-01 23:16:34 +07:00
luckybl0ck
c6930ded74
[FIX] Set Java distrubution in Actions workflow (#714) 2024-06-01 23:11:50 +07:00
Gravita
c2a6a408c4 [FIX] Hikari getConnection() deadlock when with using user_permissions table 2024-06-01 23:10:56 +07:00
luckybl0ck
01cd50840a
[ANY] Update actions versions (#713) 2024-06-01 22:21:35 +07:00
Gravita
bb4d5b99c6 [ANY] 5.6.3-dev 2024-06-01 00:13:00 +07:00
Gravita
ff2f647b50 Merge tag 'v5.6.2' into dev
5.6.2 stable
2024-05-31 23:53:32 +07:00
21 changed files with 108 additions and 60 deletions

View file

@ -6,26 +6,28 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- name: Cache Gradle - name: Cache Gradle
uses: actions/cache@v1 uses: actions/cache@v4
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@v1 uses: actions/setup-java@v4
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
@ -42,7 +44,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@v1 uses: actions/upload-artifact@v4
with: with:
name: Launcher name: Launcher
path: artifacts path: artifacts
@ -63,7 +65,7 @@ jobs:
- name: Create release - name: Create release
id: create_release id: create_release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v2
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,7 +61,6 @@
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
@ -71,7 +70,6 @@
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']
@ -93,20 +91,16 @@ 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.8.4' hikari 'io.micrometer:micrometer-core:1.13.1'
hikari('com.zaxxer:HikariCP:5.0.1') { hikari('com.zaxxer:HikariCP:5.1.0') {
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,6 +82,9 @@ 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
*/ */
@ -136,6 +139,9 @@ 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);
@ -351,14 +357,17 @@ 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 {
if (!IOHelper.isDir(updatesDir))
Files.createDirectory(updatesDir);
updatesManager.readUpdatesDir();
// Sync profiles dir // Sync profiles dir
if (!IOHelper.isDir(profilesDir)) if (!IOHelper.isDir(profilesDir))
Files.createDirectory(profilesDir); Files.createDirectory(profilesDir);
syncProfilesDir(); syncProfilesDir();
// Sync updates dir
if (!IOHelper.isDir(updatesDir))
Files.createDirectory(updatesDir);
updatesManager.readUpdatesDir();
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);
@ -488,9 +497,10 @@ 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"; LAUNCHERLIBRARIESCOMPILE_NAME = "launcher-libraries-compile", LAUNCHERPACK_NAME = "launcher-pack", KEY_NAME = ".keys", MODULES = "modules", LAUNCHER_MODULES = "launcher-modules", LIBRARIES = "libraries";
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;
@ -498,6 +508,8 @@ 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);
@ -506,9 +518,12 @@ public void collect() {
if (launcherLibrariesDir == null) launcherLibrariesDir = getPath(LAUNCHERLIBRARIES_NAME); if (launcherLibrariesDir == null) launcherLibrariesDir = getPath(LAUNCHERLIBRARIES_NAME);
if (launcherLibrariesCompileDir == null) if (launcherLibrariesCompileDir == null)
launcherLibrariesCompileDir = getPath(LAUNCHERLIBRARIESCOMPILE_NAME); launcherLibrariesCompileDir = getPath(LAUNCHERLIBRARIESCOMPILE_NAME);
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,6 +34,7 @@
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 {
@ -51,10 +52,13 @@ 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 ex) { } catch (ClassNotFoundException | NoClassDefFoundError 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"));
@ -78,7 +82,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(dir.resolve("modules"), dir.resolve("config"), certificateManager.trustManager); LaunchServerModulesManager modulesManager = new LaunchServerModulesManager(directories.modules, dir.resolve("config"), certificateManager.trustManager);
modulesManager.autoload(); modulesManager.autoload();
modulesManager.initModules(null); modulesManager.initModules(null);
registerAll(); registerAll();
@ -123,8 +127,6 @@ 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)
@ -135,7 +137,24 @@ public static void main(String[] args) throws Exception {
.setLaunchServerConfigManager(launchServerConfigManager) .setLaunchServerConfigManager(launchServerConfigManager)
.setCertificateManager(certificateManager) .setCertificateManager(certificateManager)
.build(); .build();
if (!prepareMode) { List<String> allArgs = List.of(args);
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();
@ -201,7 +220,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("LaunchServer address(default: localhost): "); System.out.println("External launchServer address:port (default: localhost:9274): ");
address = commandHandler.readLine(); address = commandHandler.readLine();
} }
String projectName = System.getenv("PROJECTNAME"); String projectName = System.getenv("PROJECTNAME");
@ -215,18 +234,29 @@ 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"); logger.error("Address null. Using localhost:9274");
address = "localhost"; address = "localhost:9274";
} }
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;
newConfig.netty.address = "ws://" + address + ":9274/api"; if(address.contains(":")) {
newConfig.netty.downloadURL = "http://" + address + ":9274/%dirname%/"; String portString = address.substring(address.indexOf(':')+1);
newConfig.netty.launcherURL = "http://" + address + ":9274/Launcher.jar"; try {
newConfig.netty.launcherEXEURL = "http://" + address + ":9274/Launcher.exe"; port = Integer.parseInt(portString);
} 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,6 +21,7 @@ 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) {
@ -56,8 +57,9 @@ 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(Path.of("libraries"), FileVisitOption.FOLLOW_LINKS)) { try(Stream<Path> files = Files.walk(librariesPath, 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), requestPermissions(set.getString(uuidColumn))) : null; set.getString(accessTokenColumn), set.getString(serverIDColumn), set.getString(passwordColumn)) : null;
} }
public ClientPermissions requestPermissions (String uuid) throws SQLException public ClientPermissions requestPermissions (String uuid) throws SQLException
@ -286,14 +286,17 @@ 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()) {
return constructUser(set); user = 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 {
@ -340,15 +343,14 @@ 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 final ClientPermissions permissions; protected ClientPermissions permissions;
public SQLUser(UUID uuid, String username, String accessToken, String serverId, String password, ClientPermissions permissions) { public SQLUser(UUID uuid, String username, String accessToken, String serverId, String password) {
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), requestPermissions(set.getString(uuidColumn)), set.getLong(hardwareIdColumn)) : null; set.getString(accessTokenColumn), set.getString(serverIDColumn), set.getString(passwordColumn), 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, ClientPermissions permissions, long hwidId) { public MySQLUser(UUID uuid, String username, String accessToken, String serverId, String password, long hwidId) {
super(uuid, username, accessToken, serverId, password, permissions); super(uuid, username, accessToken, serverId, password);
this.hwidId = hwidId; this.hwidId = hwidId;
} }

View file

@ -37,7 +37,9 @@ 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);
IOHelper.walk(server.launcherLibrariesCompile, new ListFileVisitor(server.launcherBinary.addonLibs), false); if(Files.isDirectory(server.launcherLibrariesCompile)) {
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(Path.of("libraries"), FileVisitOption.FOLLOW_LINKS)) { try(Stream<Path> files = Files.walk(server.librariesDir, 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,6 +103,7 @@ 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);
@ -196,6 +197,9 @@ 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";
} }
@ -203,7 +207,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.launch.knot.KnotClient"; return "net.fabricmc.loader.impl.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.dir.resolve("launcher-modules"); modulesDir = server.launcherModulesDir;
} }
public void init() { public void init() {

View file

@ -22,6 +22,7 @@ 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;
@ -29,9 +30,11 @@ 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,7 +1,6 @@
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;
@ -34,9 +33,6 @@ 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), callback); return new ProgressTrackingBodyHandler<>(HttpResponse.BodyHandlers.ofFile(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING), callback);
} }
public interface DownloadCallback { public interface DownloadCallback {

View file

@ -79,6 +79,7 @@ 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 && Arrays.stream(file.group).noneMatch(this::isEnabled)) { if (file.group != null && file.group.length > 0 && Arrays.stream(file.group).noneMatch(this::isEnabled)) {
enable(file.group[0], false, null); enable(file.group[0], false, null);
} }
} }

View file

@ -6,7 +6,6 @@
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 = 2; public static final int PATCH = 5;
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.2' version = '5.6.5'
apply from: 'props.gradle' apply from: 'props.gradle'

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

View file

@ -1,18 +1,16 @@
project.ext { project.ext {
verAsm = '9.7' verAsm = '9.7'
verNetty = '4.1.110.Final' verNetty = '4.1.111.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 = '8.4.0' verMySQLConn = '9.0.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'