mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
Merge branch 'release/5.6.3'
This commit is contained in:
commit
ede9ab2c85
19 changed files with 104 additions and 59 deletions
12
.github/workflows/push.yml
vendored
12
.github/workflows/push.yml
vendored
|
@ -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 }}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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.launcherLibrariesDir;
|
||||||
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()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
||||||
|
|
|
@ -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<>();
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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())
|
||||||
|
|
|
@ -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";
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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));
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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']
|
||||||
|
|
|
@ -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 = 3;
|
||||||
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;
|
||||||
|
|
|
@ -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.3'
|
||||||
|
|
||||||
apply from: 'props.gradle'
|
apply from: 'props.gradle'
|
||||||
|
|
||||||
|
|
2
modules
2
modules
|
@ -1 +1 @@
|
||||||
Subproject commit a52b9cc8552445167b95e8933f4289bbaa70677d
|
Subproject commit 0b9e8819db5c3d7db874b334cfa629a73daabf01
|
|
@ -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'
|
||||||
|
|
Loading…
Reference in a new issue