[FEATURE] Чистка конфига.

This commit is contained in:
zaxar163 2019-04-28 10:46:36 +03:00
parent 35a5741a4f
commit 8fe68b7e3b
No known key found for this signature in database
GPG key ID: E3B309DD3852DE06
7 changed files with 19 additions and 18 deletions

View file

@ -79,6 +79,8 @@ public static final class Config {
public String[] mirrors;
public String binaryName;
public boolean copyBinaries = true;
public LauncherConfig.LauncherEnvironment env;
@ -269,7 +271,7 @@ public class LauncherConf
}
public class NettyConfig {
public boolean clientEnabled;
public boolean fileServerEnabled;
public boolean sendExceptionEnabled;
public String launcherURL;
public String downloadURL;
@ -704,11 +706,7 @@ private void generateConfigIfNotExists(boolean testEnv) throws IOException {
newConfig.whitelistRejectString = "Вас нет в белом списке";
newConfig.netty = new NettyConfig();
newConfig.netty.address = "ws://localhost:9274/api";
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.fileServerEnabled = true;
newConfig.netty.binds = new NettyBindAddress[]{ new NettyBindAddress("0.0.0.0", 9274) };
newConfig.netty.performance = new NettyPerformanceConfig();
newConfig.netty.performance.bossThread = 2;
@ -753,6 +751,12 @@ private void generateConfigIfNotExists(boolean testEnv) throws IOException {
LogHelper.error("ProjectName null. Using 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
LogHelper.info("Writing LaunchServer config file");

View file

@ -35,7 +35,7 @@ public void clear() {
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");
}

View file

@ -10,7 +10,7 @@
public class EXELauncherBinary extends LauncherBinary {
public EXELauncherBinary(LaunchServer server) {
super(server, server.dir.resolve(server.config.binaryName + ".exe"));
super(server, LauncherBinary.resolve(server, ".exe"));
}
@Override

View file

@ -24,9 +24,8 @@ public final class JARLauncherBinary extends LauncherBinary {
public List<Path> addonLibs;
public JARLauncherBinary(LaunchServer server) throws IOException {
super(server);
super(server, LauncherBinary.resolve(server, ".jar"));
count = new AtomicLong(0);
syncBinaryFile = server.dir.resolve(server.config.binaryName + ".jar");
runtimeDir = server.dir.resolve(Launcher.RUNTIME_DIR);
guardDir = server.dir.resolve(Launcher.GUARD_DIR);
buildDir = server.dir.resolve("build");

View file

@ -10,7 +10,7 @@
public abstract class LauncherBinary {
public final LaunchServer server;
public Path syncBinaryFile;
public final Path syncBinaryFile;
private volatile DigestBytesHolder binary;
private volatile byte[] sign;
@ -19,10 +19,6 @@ protected LauncherBinary(LaunchServer server, Path binaryFile) {
syncBinaryFile = binaryFile;
}
protected LauncherBinary(LaunchServer server) {
this.server = server;
}
public abstract void build() throws IOException;
@ -49,4 +45,8 @@ public final boolean sync() throws IOException {
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);
}
}

View file

@ -42,7 +42,7 @@ public void initChannel(NioSocketChannel ch) {
pipeline.addLast(new HttpObjectAggregator(65536));
pipeline.addLast(new WebSocketServerCompressionHandler());
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());
}
});

View file

@ -6,8 +6,6 @@
public class LauncherSSLContext {
public SSLServerSocketFactory ssf;
public SSLSocketFactory sf;
@SuppressWarnings("unused")
private SSLContext sc;
public LauncherSSLContext(KeyStore ks, String keypassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, KeyManagementException {
TrustManager[] trustAllCerts = new TrustManager[]{