From 2c06cdec24eae8f895c29e77d42c4ec93809d7e0 Mon Sep 17 00:00:00 2001 From: Gravit Date: Sun, 23 Dec 2018 23:47:07 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D0=BE=D0=B2=20=D0=BD=D0=B0?= =?UTF-8?q?=20Json=20=D1=87=D0=B0=D1=81=D1=82=D1=8C=205=20=D0=9F=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8=20=D1=80=D0=B0=D0=BD=D1=82=D0=B0=D0=B9?= =?UTF-8?q?=D0=BC=D0=B0=20=D0=9A=D0=BE=D0=BC=D0=BF=D0=BB=D0=B8=D1=80=D1=83?= =?UTF-8?q?=D0=B5=D1=82=D1=81=D1=8F,=20=D0=BF=D0=BE=D0=BA=D0=B0=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ru/gravit/launchserver/LaunchServer.java | 17 +++++++++++++---- Launcher/runtime/engine/api.js | 12 ------------ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index ede68a93..f0bef164 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -1,6 +1,7 @@ package ru.gravit.launchserver; import com.google.gson.GsonBuilder; +import com.google.gson.annotations.Expose; import ru.gravit.launcher.Launcher; import ru.gravit.launcher.LauncherConfig; import ru.gravit.launcher.hasher.HashedDir; @@ -89,7 +90,9 @@ public static final class Config { public String[] mirrors; public String binaryName; + @Expose private String address; + @Expose private String bindAddress; public LauncherConfig.LauncherEnvironment env; public boolean isWarningMissArchJava; @@ -301,6 +304,7 @@ public LaunchServer(Path dir) throws IOException, InvalidKeySpecException { modulesManager.autoload(dir.resolve("modules")); modulesManager.preInitModules(); initGson(); + LogHelper.setStacktraceEnabled(true); // Read LaunchServer config generateConfigIfNotExists(); @@ -356,6 +360,7 @@ public static void initGson() { if(Launcher.gson != null) return; Launcher.gsonBuilder = new GsonBuilder(); + Launcher.gsonBuilder.setPrettyPrinting(); Launcher.gson = Launcher.gsonBuilder.create(); } @@ -402,10 +407,14 @@ private void generateConfigIfNotExists() throws IOException { // Create new config LogHelper.info("Creating LaunchServer config"); - Config newConfig; - try (BufferedReader reader = IOHelper.newReader(IOHelper.getResourceURL("ru/gravit/launchserver/defaults/config.cfg"))) { - newConfig = Launcher.gson.fromJson(reader,Config.class); - } + Config newConfig = new Config(); + newConfig.mirrors = new String[]{"http://mirror.gravitlauncher.ml"}; + newConfig.launch4j = new ExeConf(); + newConfig.buildPostTransform = new PostBuildTransformConf(); + newConfig.env = LauncherConfig.LauncherEnvironment.STD; + //try (BufferedReader reader = IOHelper.newReader(IOHelper.getResourceURL("ru/gravit/launchserver/defaults/config.cfg"))) { + // newConfig = Launcher.gson.fromJson(reader,Config.class); + //} // Set server address LogHelper.println("LaunchServer address: "); diff --git a/Launcher/runtime/engine/api.js b/Launcher/runtime/engine/api.js index 37b3ab55..f423687d 100644 --- a/Launcher/runtime/engine/api.js +++ b/Launcher/runtime/engine/api.js @@ -45,18 +45,6 @@ var SignedBytesHolder = SignedBytesHolderClass.static; var SignedObjectHolder = SignedObjectHolderClass.static; var EnumSerializer = EnumSerializerClass.static; -// Config serialization class bindings -var ConfigObject = ConfigObjectClass.static; -var ConfigObjectAdapter = ConfigObjectAdapterClass.static; -var BlockConfigEntry = BlockConfigEntryClass.static; -var BooleanConfigEntry = BooleanConfigEntryClass.static; -var IntegerConfigEntry = IntegerConfigEntryClass.static; -var ListConfigEntry = ListConfigEntryClass.static; -var StringConfigEntry = StringConfigEntryClass.static; -var ConfigEntryType = ConfigEntryTypeClass.static; -var TextConfigReader = TextConfigReaderClass.static; -var TextConfigWriter = TextConfigWriterClass.static; - // Helper class API imports var CommonHelper = CommonHelperClass.static; var IOHelper = IOHelperClass.static;