mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-04-19 14:33:04 +03:00
[FEATURE] Чистка конфига.
This commit is contained in:
parent
35a5741a4f
commit
8fe68b7e3b
7 changed files with 19 additions and 18 deletions
|
@ -80,6 +80,8 @@ public static final class Config {
|
||||||
|
|
||||||
public String binaryName;
|
public String binaryName;
|
||||||
|
|
||||||
|
public boolean copyBinaries = true;
|
||||||
|
|
||||||
public LauncherConfig.LauncherEnvironment env;
|
public LauncherConfig.LauncherEnvironment env;
|
||||||
|
|
||||||
// Handlers & Providers
|
// Handlers & Providers
|
||||||
|
@ -269,7 +271,7 @@ public class LauncherConf
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NettyConfig {
|
public class NettyConfig {
|
||||||
public boolean clientEnabled;
|
public boolean fileServerEnabled;
|
||||||
public boolean sendExceptionEnabled;
|
public boolean sendExceptionEnabled;
|
||||||
public String launcherURL;
|
public String launcherURL;
|
||||||
public String downloadURL;
|
public String downloadURL;
|
||||||
|
@ -704,11 +706,7 @@ private void generateConfigIfNotExists(boolean testEnv) throws IOException {
|
||||||
newConfig.whitelistRejectString = "Вас нет в белом списке";
|
newConfig.whitelistRejectString = "Вас нет в белом списке";
|
||||||
|
|
||||||
newConfig.netty = new NettyConfig();
|
newConfig.netty = new NettyConfig();
|
||||||
newConfig.netty.address = "ws://localhost:9274/api";
|
newConfig.netty.fileServerEnabled = true;
|
||||||
newConfig.netty.downloadURL = "http://localhost:9274/%dirname%/";
|
|
||||||
newConfig.netty.launcherURL = "http://localhost:9274/Launcher.jar";
|
|
||||||
newConfig.netty.launcherEXEURL = "http://localhost:9274/Launcher.exe";
|
|
||||||
newConfig.netty.clientEnabled = false;
|
|
||||||
newConfig.netty.binds = new NettyBindAddress[]{ new NettyBindAddress("0.0.0.0", 9274) };
|
newConfig.netty.binds = new NettyBindAddress[]{ new NettyBindAddress("0.0.0.0", 9274) };
|
||||||
newConfig.netty.performance = new NettyPerformanceConfig();
|
newConfig.netty.performance = new NettyPerformanceConfig();
|
||||||
newConfig.netty.performance.bossThread = 2;
|
newConfig.netty.performance.bossThread = 2;
|
||||||
|
@ -754,6 +752,12 @@ private void generateConfigIfNotExists(boolean testEnv) throws IOException {
|
||||||
newConfig.projectName = "MineCraft";
|
newConfig.projectName = "MineCraft";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newConfig.netty.address = "ws://" + newConfig.legacyAddress + ":9274/api";
|
||||||
|
newConfig.netty.downloadURL = "http://" + newConfig.legacyAddress + ":9274/%dirname%/";
|
||||||
|
newConfig.netty.launcherURL = "http://" + newConfig.legacyAddress + ":9274/internal/Launcher.jar";
|
||||||
|
newConfig.netty.launcherEXEURL = "http://" + newConfig.legacyAddress + ":9274/internal/Launcher.exe";
|
||||||
|
newConfig.netty.sendExceptionEnabled = true;
|
||||||
|
|
||||||
// Write LaunchServer config
|
// Write LaunchServer config
|
||||||
LogHelper.info("Writing LaunchServer config file");
|
LogHelper.info("Writing LaunchServer config file");
|
||||||
try (BufferedWriter writer = IOHelper.newWriter(configFile)) {
|
try (BufferedWriter writer = IOHelper.newWriter(configFile)) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ public void clear() {
|
||||||
|
|
||||||
|
|
||||||
public EXEL4JLauncherBinary(LaunchServer server) {
|
public EXEL4JLauncherBinary(LaunchServer server) {
|
||||||
super(server, server.dir.resolve(server.config.binaryName + ".exe"));
|
super(server, LauncherBinary.resolve(server, ".exe"));
|
||||||
faviconFile = server.dir.resolve("favicon.ico");
|
faviconFile = server.dir.resolve("favicon.ico");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
public class EXELauncherBinary extends LauncherBinary {
|
public class EXELauncherBinary extends LauncherBinary {
|
||||||
|
|
||||||
public EXELauncherBinary(LaunchServer server) {
|
public EXELauncherBinary(LaunchServer server) {
|
||||||
super(server, server.dir.resolve(server.config.binaryName + ".exe"));
|
super(server, LauncherBinary.resolve(server, ".exe"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,9 +24,8 @@ public final class JARLauncherBinary extends LauncherBinary {
|
||||||
public List<Path> addonLibs;
|
public List<Path> addonLibs;
|
||||||
|
|
||||||
public JARLauncherBinary(LaunchServer server) throws IOException {
|
public JARLauncherBinary(LaunchServer server) throws IOException {
|
||||||
super(server);
|
super(server, LauncherBinary.resolve(server, ".jar"));
|
||||||
count = new AtomicLong(0);
|
count = new AtomicLong(0);
|
||||||
syncBinaryFile = server.dir.resolve(server.config.binaryName + ".jar");
|
|
||||||
runtimeDir = server.dir.resolve(Launcher.RUNTIME_DIR);
|
runtimeDir = server.dir.resolve(Launcher.RUNTIME_DIR);
|
||||||
guardDir = server.dir.resolve(Launcher.GUARD_DIR);
|
guardDir = server.dir.resolve(Launcher.GUARD_DIR);
|
||||||
buildDir = server.dir.resolve("build");
|
buildDir = server.dir.resolve("build");
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
public abstract class LauncherBinary {
|
public abstract class LauncherBinary {
|
||||||
public final LaunchServer server;
|
public final LaunchServer server;
|
||||||
public Path syncBinaryFile;
|
public final Path syncBinaryFile;
|
||||||
private volatile DigestBytesHolder binary;
|
private volatile DigestBytesHolder binary;
|
||||||
private volatile byte[] sign;
|
private volatile byte[] sign;
|
||||||
|
|
||||||
|
@ -19,10 +19,6 @@ protected LauncherBinary(LaunchServer server, Path binaryFile) {
|
||||||
syncBinaryFile = binaryFile;
|
syncBinaryFile = binaryFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LauncherBinary(LaunchServer server) {
|
|
||||||
this.server = server;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void build() throws IOException;
|
public abstract void build() throws IOException;
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,4 +45,8 @@ public final boolean sync() throws IOException {
|
||||||
|
|
||||||
return exists;
|
return exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final Path resolve(LaunchServer server, String ext) {
|
||||||
|
return server.config.copyBinaries ? server.updatesDir.resolve(server.config.binaryName + ext) : server.dir.resolve(server.config.binaryName + ext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public void initChannel(NioSocketChannel ch) {
|
||||||
pipeline.addLast(new HttpObjectAggregator(65536));
|
pipeline.addLast(new HttpObjectAggregator(65536));
|
||||||
pipeline.addLast(new WebSocketServerCompressionHandler());
|
pipeline.addLast(new WebSocketServerCompressionHandler());
|
||||||
pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true));
|
pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true));
|
||||||
pipeline.addLast(new FileServerHandler(LaunchServer.server.updatesDir, true));
|
if (LaunchServer.server.config.netty.fileServerEnabled) pipeline.addLast(new FileServerHandler(LaunchServer.server.updatesDir, true));
|
||||||
pipeline.addLast(new WebSocketFrameHandler());
|
pipeline.addLast(new WebSocketFrameHandler());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
public class LauncherSSLContext {
|
public class LauncherSSLContext {
|
||||||
public SSLServerSocketFactory ssf;
|
public SSLServerSocketFactory ssf;
|
||||||
public SSLSocketFactory sf;
|
public SSLSocketFactory sf;
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private SSLContext sc;
|
|
||||||
|
|
||||||
public LauncherSSLContext(KeyStore ks, String keypassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, KeyManagementException {
|
public LauncherSSLContext(KeyStore ks, String keypassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, KeyManagementException {
|
||||||
TrustManager[] trustAllCerts = new TrustManager[]{
|
TrustManager[] trustAllCerts = new TrustManager[]{
|
||||||
|
|
Loading…
Reference in a new issue