diff --git a/LaunchServer/build.gradle b/LaunchServer/build.gradle index d090969f..fde96714 100644 --- a/LaunchServer/build.gradle +++ b/LaunchServer/build.gradle @@ -41,7 +41,6 @@ } dependencies { - pack project(':libLauncher') pack project(':LauncherAPI') bundle project(':Radon') bundle 'mysql:mysql-connector-java:8.0.16' diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index bc13b9d1..e6f15e8d 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -252,6 +252,8 @@ public void close() { public static class ExeConf { public boolean enabled; + public boolean setMaxVersion; + public String maxVersion; public String productName; public String productVer; public String fileDesc; @@ -263,8 +265,8 @@ public static class ExeConf { public String txtFileVersion; public String txtProductVersion; } - public static class NettyUpdatesBind - { + + public static class NettyUpdatesBind { public String url; public boolean zip; } @@ -705,6 +707,7 @@ private void generateConfigIfNotExists(boolean testEnv) throws IOException { newConfig.launch4j.txtProductVersion = "%s, build %d"; newConfig.launch4j.productName = "GravitLauncher"; newConfig.launch4j.productVer = newConfig.launch4j.fileVer; + newConfig.launch4j.maxVersion = "1.8.999"; newConfig.env = LauncherConfig.LauncherEnvironment.STD; newConfig.startScript = JVMHelper.OS_TYPE.equals(JVMHelper.OS.MUSTDIE) ? "." + File.separator + "start.bat" : "." + File.separator + "start.sh"; newConfig.hwidHandler = new AcceptHWIDHandler(); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/EXEL4JLauncherBinary.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/EXEL4JLauncherBinary.java index ea0826ea..0b754461 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/EXEL4JLauncherBinary.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/EXEL4JLauncherBinary.java @@ -78,6 +78,8 @@ private void setConfig() { // Prepare JRE Jre jre = new Jre(); jre.setMinVersion("1.8.0"); + if (server.config.launch4j.setMaxVersion) + jre.setMaxVersion(server.config.launch4j.maxVersion); jre.setRuntimeBits(Jre.RUNTIME_BITS_64_AND_32); jre.setJdkPreference(Jre.JDK_PREFERENCE_PREFER_JRE); config.setJre(jre); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java index 5d2ee007..bf61117a 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java @@ -42,11 +42,11 @@ public JARLauncherBinary(LaunchServer server) throws IOException { public void init() { tasks.add(new PrepareBuildTask(server)); tasks.add(new MainBuildTask(server)); - if(server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server)); + if (server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server)); tasks.add(new ProGuardBuildTask(server)); tasks.add(new AdditionalFixesApplyTask(server)); tasks.add(new RadonBuildTask(server)); - if(!server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server)); + if (!server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server)); } @Override diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java index 255dfd59..90eb8e45 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java @@ -137,7 +137,7 @@ public Path process(Path inputJar) throws IOException { jaConfigurator.setGuardType(server.config.launcher.guardType); jaConfigurator.setWarningMissArchJava(server.config.isWarningMissArchJava); jaConfigurator.setEnv(server.config.env); - if(server.runtime.oemUnlockKey == null) server.runtime.oemUnlockKey = SecurityHelper.randomStringToken(); + if (server.runtime.oemUnlockKey == null) server.runtime.oemUnlockKey = SecurityHelper.randomStringToken(); jaConfigurator.setOemUnlockKey(server.runtime.oemUnlockKey); server.buildHookManager.registerAllClientModuleClass(jaConfigurator); reader.getCp().add(new JarFile(inputJar.toFile())); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/websocket/json/update/UpdateResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/websocket/json/update/UpdateResponse.java index b326f1c0..5e03c7ef 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/websocket/json/update/UpdateResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/websocket/json/update/UpdateResponse.java @@ -40,8 +40,7 @@ public void execute(ChannelHandlerContext ctx, Client client) { } String url = LaunchServer.server.config.netty.downloadURL.replace("%dirname%", dirName); boolean zip = false; - if (server.config.netty.bindings.get(dirName) != null) - { + if (server.config.netty.bindings.get(dirName) != null) { LaunchServer.NettyUpdatesBind bind = server.config.netty.bindings.get(dirName); url = bind.url; zip = bind.zip; diff --git a/Launcher/runtime/dialog/images/downloader/blured.jpg b/Launcher/runtime/dialog/images/downloader/blured.jpg index b721d11c..2b739312 100644 Binary files a/Launcher/runtime/dialog/images/downloader/blured.jpg and b/Launcher/runtime/dialog/images/downloader/blured.jpg differ diff --git a/Launcher/runtime/dialog/overlay/settings/settings.fxml b/Launcher/runtime/dialog/overlay/settings/settings.fxml index bfd1ae16..90358a27 100644 --- a/Launcher/runtime/dialog/overlay/settings/settings.fxml +++ b/Launcher/runtime/dialog/overlay/settings/settings.fxml @@ -13,60 +13,44 @@ - + - - - - - - + + + + + + - + - - - - + + + + Выделение памяти: - + - + - + - - + + - + + + - - + + diff --git a/Launcher/runtime/dialog/overlay/settings/settings.js b/Launcher/runtime/dialog/overlay/settings/settings.js index 590dea8b..17090929 100644 --- a/Launcher/runtime/dialog/overlay/settings/settings.js +++ b/Launcher/runtime/dialog/overlay/settings/settings.js @@ -33,6 +33,11 @@ var settingsOverlay = { } }); + var featureStore = holder.lookup("#featureStore"); + featureStore.setSelected(settings.featureStore); + featureStore.selectedProperty()["addListener(javafx.beans.value.ChangeListener)"]( + function(o, ov, nv) settings.featureStore = nv); + var fullScreenBox = holder.lookup("#fullScreen"); fullScreenBox.setSelected(settings.fullScreen); fullScreenBox.selectedProperty()["addListener(javafx.beans.value.ChangeListener)"]( @@ -145,7 +150,7 @@ LogHelper.debug("Dir: %s", DirBridge.dir); var cliParams = { login: null, password: null, profile: -1, autoLogin: false, updatesDir: null, autoEnter: null, fullScreen: null, ram: -1, - offline: false, + offline: false, featureStore: null, init: function(params) { var named = params.getNamed(); @@ -167,6 +172,10 @@ var cliParams = { if (autoEnter !== null) { cliParams.autoEnter = java.lang.Boolean.parseBoolean(autoEnter); } + var featureStore = named.get("featureStore"); + if (featureStore !== null) { + cliParams.featureStore = java.lang.Boolean.parseBoolean(featureStore); + } var fullScreen = named.get("fullScreen"); if (fullScreen !== null) { cliParams.fullScreen = java.lang.Boolean.parseBoolean(fullScreen); @@ -175,7 +184,6 @@ var cliParams = { if (ram !== null) { cliParams.ram = java.lang.Integer.parseInt(ram); } - var offline = named.get("offline"); if (offline !== null) { cliParams.offline = java.lang.Boolean.parseBoolean(offline); @@ -192,19 +200,20 @@ var cliParams = { if (cliParams.profile >= 0) { settings.profile = cliParams.profile; } - if (cliParams.updatesDir !== null) { } if (cliParams.autoEnter !== null) { settings.autoLogin = cliParams.autoEnter; } + if (cliParams.featureStore !== null) { + settings.featureStore = cliParams.featureStore; + } if (cliParams.fullScreen !== null) { settings.fullScreen = cliParams.fullScreen; } if (cliParams.ram >= 0) { settingsOverlay.setRAM(cliParams.ram); } - if (cliParams.offline !== null) { settings.offline = cliParams.offline; } diff --git a/Launcher/runtime/dialog/scenes/options/options.fxml b/Launcher/runtime/dialog/scenes/options/options.fxml index c0b42259..a0bb1ef0 100644 --- a/Launcher/runtime/dialog/scenes/options/options.fxml +++ b/Launcher/runtime/dialog/scenes/options/options.fxml @@ -18,9 +18,9 @@ - + - + diff --git a/Launcher/runtime/dialog/scenes/options/options.js b/Launcher/runtime/dialog/scenes/options/options.js index b5959ff7..b7749643 100644 --- a/Launcher/runtime/dialog/scenes/options/options.js +++ b/Launcher/runtime/dialog/scenes/options/options.js @@ -137,11 +137,11 @@ var options = { textDescr = new javafx.scene.text.Text(modDescription); if(subLevel > 1) { for(var i = 1; i < subLevel; i++){ - textDescr.setWrappingWidth(630-(25*i)); + textDescr.setWrappingWidth(620-(25*i)); textDescr.setTranslateX(25+(25*i)); } } else { - textDescr.setWrappingWidth(630); + textDescr.setWrappingWidth(620); textDescr.setTranslateX(25); } textDescr.setTextAlignment(javafx.scene.text.TextAlignment.JUSTIFY); diff --git a/Launcher/src/main/java/ru/gravit/launcher/bridge/GravitGuardBridge.java b/Launcher/src/main/java/ru/gravit/launcher/bridge/GravitGuardBridge.java new file mode 100644 index 00000000..cabe2cc6 --- /dev/null +++ b/Launcher/src/main/java/ru/gravit/launcher/bridge/GravitGuardBridge.java @@ -0,0 +1,22 @@ +package ru.gravit.launcher.bridge; + +import ru.gravit.launcher.LauncherAPI; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; + +@LauncherAPI +public class GravitGuardBridge { + @LauncherAPI + public static native void callGuard(); + + @LauncherAPI + public static int sendHTTPRequest(String strurl) throws IOException { + URL url = new URL(strurl); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("GET"); + connection.setRequestProperty("Content-Language", "en-US"); + return connection.getResponseCode(); + } +} diff --git a/Launcher/src/main/java/ru/gravit/launcher/client/LauncherUpdateController.java b/Launcher/src/main/java/ru/gravit/launcher/client/LauncherUpdateController.java index a5dc40d6..73a57835 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/client/LauncherUpdateController.java +++ b/Launcher/src/main/java/ru/gravit/launcher/client/LauncherUpdateController.java @@ -17,7 +17,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicReference; @@ -34,47 +33,40 @@ public void preDiff(UpdateRequest request, UpdateRequestEvent e) { @Override public void postDiff(UpdateRequest request, UpdateRequestEvent e, HashedDir.Diff diff) throws IOException { - if(e.zip) return; - if(SettingsManager.settings.featureStore) - { + if (e.zip) return; + if (SettingsManager.settings.featureStore) { LogHelper.info("Enabled HStore feature. Find"); AtomicReference lastEn = new AtomicReference<>(null); - ArrayList removed = new ArrayList<>(); + //ArrayList removed = new ArrayList<>(); diff.mismatch.walk(File.separator, (path, name, entry) -> { - if(entry.getType() == HashedEntry.Type.DIR) { + if (entry.getType() == HashedEntry.Type.DIR) { Files.createDirectories(request.getDir().resolve(path)); return HashedDir.WalkAction.CONTINUE; } HashedFile file = (HashedFile) entry; //Первый экспериментальный способ - честно обходим все возможные Store Path ret = null; - if(lastEn.get() == null) - { - for(NewLauncherSettings.HashedStoreEntry en : SettingsManager.settings.lastHDirs) - { + if (lastEn.get() == null) { + for (NewLauncherSettings.HashedStoreEntry en : SettingsManager.settings.lastHDirs) { ret = tryFind(en, file); - if(ret != null) { + if (ret != null) { lastEn.set(en); break; } } - } - else { + } else { ret = tryFind(lastEn.get(), file); } - if(ret == null) - { - for(NewLauncherSettings.HashedStoreEntry en : SettingsManager.settings.lastHDirs) - { + if (ret == null) { + for (NewLauncherSettings.HashedStoreEntry en : SettingsManager.settings.lastHDirs) { ret = tryFind(en, file); - if(ret != null) { + if (ret != null) { lastEn.set(en); break; } } } - if(ret != null) - { + if (ret != null) { //Еще раз проверим корректность хеша //Возможно эта проверка избыточна //if(file.isSame(ret, true)) @@ -83,8 +75,7 @@ public void postDiff(UpdateRequest request, UpdateRequestEvent e, HashedDir.Diff LogHelper.debug("Copy file %s to %s", ret.toAbsolutePath().toString(), source.toAbsolutePath().toString()); //Let's go! Files.copy(ret, source); - try(InputStream input = IOHelper.newInput(ret)) - { + try (InputStream input = IOHelper.newInput(ret)) { IOHelper.transfer(input, source); } entry.flag = true; @@ -95,25 +86,22 @@ public void postDiff(UpdateRequest request, UpdateRequestEvent e, HashedDir.Diff }); } } - public Path tryFind(NewLauncherSettings.HashedStoreEntry en, HashedFile file) throws IOException - { + + public Path tryFind(NewLauncherSettings.HashedStoreEntry en, HashedFile file) throws IOException { AtomicReference ret = new AtomicReference<>(null); en.hdir.walk(File.separator, (path, name, entry) -> { - if(entry.getType() == HashedEntry.Type.DIR) return HashedDir.WalkAction.CONTINUE; + if (entry.getType() == HashedEntry.Type.DIR) return HashedDir.WalkAction.CONTINUE; HashedFile tfile = (HashedFile) entry; - if(tfile.isSame(file)) - { + if (tfile.isSame(file)) { LogHelper.dev("[DIR:%s] Found file %s in %s", en.name, name, path); Path tdir = Paths.get(en.fullPath).resolve(path); try { - if(tfile.isSame(tdir, true)) - { + if (tfile.isSame(tdir, true)) { LogHelper.dev("[DIR:%s] Confirmed file %s in %s", en.name, name, path); ret.set(tdir); return HashedDir.WalkAction.STOP; } - } catch (IOException e) - { + } catch (IOException e) { LogHelper.error("Check file error %s %s", e.getClass().getName(), e.getMessage()); } } diff --git a/Launcher/src/main/java/ru/gravit/launcher/console/FeatureCommand.java b/Launcher/src/main/java/ru/gravit/launcher/console/FeatureCommand.java index 07f9ffc8..79dd2b3c 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/console/FeatureCommand.java +++ b/Launcher/src/main/java/ru/gravit/launcher/console/FeatureCommand.java @@ -19,15 +19,12 @@ public String getUsageDescription() { public void invoke(String... args) throws Exception { verifyArgs(args, 2); boolean enabled = Boolean.valueOf(args[1]); - switch (args[0]) - { - case "store": - { + switch (args[0]) { + case "store": { SettingsManager.settings.featureStore = enabled; break; } - default: - { + default: { LogHelper.info("Features: [store]"); return; } diff --git a/Launcher/src/main/java/ru/gravit/launcher/console/store/CopyStoreDirCommand.java b/Launcher/src/main/java/ru/gravit/launcher/console/store/CopyStoreDirCommand.java index 9731dba5..4b966ca5 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/console/store/CopyStoreDirCommand.java +++ b/Launcher/src/main/java/ru/gravit/launcher/console/store/CopyStoreDirCommand.java @@ -26,20 +26,16 @@ public void invoke(String... args) throws Exception { int ind = 1; int index = Integer.valueOf(args[0]); boolean overwrite = Boolean.valueOf(args[1]); - for(NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) - { - if(ind == index) - { + for (NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) { + if (ind == index) { LogHelper.info("Copy [%d] FullPath: %s name: %s", ind, e.fullPath, e.name); Path path = Paths.get(e.fullPath); - if(!Files.isDirectory(path)) - { + if (!Files.isDirectory(path)) { LogHelper.error("Directory %s not found", path.toAbsolutePath().toString()); return; } Path target = Paths.get(SettingsManager.settings.updatesDirPath).resolve(e.name); - if(Files.exists(target) && !overwrite) - { + if (Files.exists(target) && !overwrite) { LogHelper.error("Directory %s found, flag overwrite not found", target.toAbsolutePath().toString()); return; } diff --git a/Launcher/src/main/java/ru/gravit/launcher/console/store/LinkStoreDirCommand.java b/Launcher/src/main/java/ru/gravit/launcher/console/store/LinkStoreDirCommand.java index a107e6d3..712a04a1 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/console/store/LinkStoreDirCommand.java +++ b/Launcher/src/main/java/ru/gravit/launcher/console/store/LinkStoreDirCommand.java @@ -26,20 +26,16 @@ public void invoke(String... args) throws Exception { verifyArgs(args, 1); int ind = 1; int index = Integer.valueOf(args[0]); - for(NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) - { - if(ind == index) - { + for (NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) { + if (ind == index) { LogHelper.info("Copy [%d] FullPath: %s name: %s", ind, e.fullPath, e.name); Path path = Paths.get(e.fullPath); - if(!Files.isDirectory(path)) - { + if (!Files.isDirectory(path)) { LogHelper.error("Directory %s not found", path.toAbsolutePath().toString()); return; } Path target = Paths.get(SettingsManager.settings.updatesDirPath).resolve(e.name); - if(Files.exists(target)) - { + if (Files.exists(target)) { LogHelper.error("Directory %s already exists", target.toAbsolutePath().toString()); return; } diff --git a/Launcher/src/main/java/ru/gravit/launcher/console/store/StoreListCommand.java b/Launcher/src/main/java/ru/gravit/launcher/console/store/StoreListCommand.java index 14a68524..0770d172 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/console/store/StoreListCommand.java +++ b/Launcher/src/main/java/ru/gravit/launcher/console/store/StoreListCommand.java @@ -19,8 +19,7 @@ public String getUsageDescription() { @Override public void invoke(String... args) throws Exception { int ind = 1; - for(NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) - { + for (NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) { LogHelper.info("[%d] FullPath: %s name: %s", ind, e.fullPath, e.name); ind++; } diff --git a/Launcher/src/main/java/ru/gravit/launcher/guard/LauncherGravitGuard.java b/Launcher/src/main/java/ru/gravit/launcher/guard/LauncherGravitGuard.java new file mode 100644 index 00000000..de9bd32f --- /dev/null +++ b/Launcher/src/main/java/ru/gravit/launcher/guard/LauncherGravitGuard.java @@ -0,0 +1,94 @@ +package ru.gravit.launcher.guard; + +import ru.gravit.launcher.Launcher; +import ru.gravit.launcher.LauncherConfig; +import ru.gravit.launcher.bridge.GravitGuardBridge; +import ru.gravit.launcher.client.ClientLauncher; +import ru.gravit.launcher.client.ClientLauncherContext; +import ru.gravit.launcher.client.DirBridge; +import ru.gravit.utils.helper.IOHelper; +import ru.gravit.utils.helper.JVMHelper; +import ru.gravit.utils.helper.UnpackHelper; + +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Collections; +import java.util.Map; + +//Используется для всех типов защит, совместимых с новым GravitGuard API +public class LauncherGravitGuard implements LauncherGuardInterface { + public String protectToken; + public Path javaBinPath; + + @Override + public String getName() { + return "wrapper"; + } + + @Override + public Path getJavaBinPath() { + if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) { + String projectName = Launcher.getConfig().projectname; + String wrapperUnpackName = JVMHelper.JVM_BITS == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe"); + return DirBridge.getGuardDir().resolve(wrapperUnpackName); + } else if (ClientLauncher.getJavaBinPath() != null) { + javaBinPath = ClientLauncher.getJavaBinPath(); + String projectName = Launcher.getConfig().projectname; + String wrapperUnpackName = JVMHelper.JVM_BITS == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe"); + return DirBridge.getGuardDir().resolve(wrapperUnpackName); + } else + return IOHelper.resolveJavaBin(Paths.get(System.getProperty("java.home"))); + } + + @Override + public int getClientJVMBits() { + return JVMHelper.JVM_BITS; + } + + @Override + public void init(boolean clientInstance) { + try { + String wrapperName = JVMHelper.JVM_BITS == 64 ? "wrapper64.exe" : "wrapper32.exe"; + String projectName = Launcher.getConfig().projectname; + String wrapperUnpackName = JVMHelper.JVM_BITS == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe"); + String antiInjectName = JVMHelper.JVM_BITS == 64 ? "AntiInject64.dll" : "AntiInject32.dll"; + UnpackHelper.unpack(Launcher.getResourceURL(wrapperName, "guard"), DirBridge.getGuardDir().resolve(wrapperUnpackName)); + UnpackHelper.unpack(Launcher.getResourceURL(antiInjectName, "guard"), DirBridge.getGuardDir().resolve(antiInjectName)); + } catch (IOException e) { + throw new SecurityException(e); + } + if (clientInstance) GravitGuardBridge.callGuard(); + } + + @Override + public void addCustomParams(ClientLauncherContext context) { + Collections.addAll(context.args, "-Djava.class.path=".concat(context.pathLauncher)); + } + + @Override + public void addCustomEnv(ClientLauncherContext context) { + Map env = context.builder.environment(); + if (javaBinPath == null) + env.put("JAVA_HOME", System.getProperty("java.home")); + else + env.put("JAVA_HOME", javaBinPath.toAbsolutePath().toString()); + LauncherConfig config = Launcher.getConfig(); + env.put("GUARD_BRIDGE", GravitGuardBridge.class.getName()); + env.put("GUARD_USERNAME", context.playerProfile.username); + env.put("GUARD_PUBLICKEY", config.publicKey.getModulus().toString(16)); + env.put("GUARD_PROJECTNAME", config.projectname); + if (protectToken != null) + env.put("GUARD_TOKEN", protectToken); + if (config.guardLicenseName != null) + env.put("GUARD_LICENSE_NAME", config.guardLicenseName); + if (config.guardLicenseKey != null) { + env.put("GUARD_LICENSE_KEY", config.guardLicenseKey); + } + } + + @Override + public void setProtectToken(String token) { + protectToken = token; + } +} diff --git a/Launcher/src/main/java/ru/gravit/launcher/guard/LauncherGuardManager.java b/Launcher/src/main/java/ru/gravit/launcher/guard/LauncherGuardManager.java index e636dd0d..63a10397 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/guard/LauncherGuardManager.java +++ b/Launcher/src/main/java/ru/gravit/launcher/guard/LauncherGuardManager.java @@ -11,6 +11,10 @@ public class LauncherGuardManager { public static void initGuard(boolean clientInstance) { LauncherConfig config = Launcher.getConfig(); switch (config.guardType) { + case "gravitguard": { + guard = new LauncherGravitGuard(); + break; + } case "wrapper": { guard = new LauncherWrapperGuard(); break; diff --git a/Launcher/src/main/java/ru/gravit/launcher/managers/ConsoleManager.java b/Launcher/src/main/java/ru/gravit/launcher/managers/ConsoleManager.java index ac22db8d..864ab65a 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/managers/ConsoleManager.java +++ b/Launcher/src/main/java/ru/gravit/launcher/managers/ConsoleManager.java @@ -20,9 +20,6 @@ import ru.gravit.utils.helper.LogHelper; import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; public class ConsoleManager { public static CommandHandler handler; diff --git a/Launcher/src/main/java/ru/gravit/launcher/managers/SettingsManager.java b/Launcher/src/main/java/ru/gravit/launcher/managers/SettingsManager.java index d6788e91..052dd999 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/managers/SettingsManager.java +++ b/Launcher/src/main/java/ru/gravit/launcher/managers/SettingsManager.java @@ -25,8 +25,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) String fullPath = input.readString(1024); HashedDir dir = new HashedDir(input); settings.lastHDirs.add(new NewLauncherSettings.HashedStoreEntry(dir, dirName, fullPath)); - } catch (IOException e) - { + } catch (IOException e) { LogHelper.error("Skip file %s exception: %s", file.toAbsolutePath().toString(), e.getMessage()); } return super.visitFile(file, attrs); @@ -61,10 +60,8 @@ public void setConfig(NewLauncherSettings config) { settings = config; if (settings.updatesDirPath != null) settings.updatesDir = Paths.get(settings.updatesDirPath); - if(settings.consoleUnlockKey != null && !ConsoleManager.isConsoleUnlock) - { - if(ConsoleManager.checkUnlockKey(settings.consoleUnlockKey)) - { + if (settings.consoleUnlockKey != null && !ConsoleManager.isConsoleUnlock) { + if (ConsoleManager.checkUnlockKey(settings.consoleUnlockKey)) { ConsoleManager.unlock(); LogHelper.info("Console auto unlocked"); } @@ -81,7 +78,7 @@ public void loadHDirStore(Path storePath) throws IOException { public void saveHDirStore(Path storeProjectPath) throws IOException { Files.createDirectories(storeProjectPath); for (NewLauncherSettings.HashedStoreEntry e : settings.lastHDirs) { - if(!e.needSave) continue; + if (!e.needSave) continue; Path file = storeProjectPath.resolve(e.name.concat(".bin")); if (!Files.exists(file)) Files.createFile(file); try (HOutput output = new HOutput(IOHelper.newOutput(file))) { diff --git a/LauncherAPI/build.gradle b/LauncherAPI/build.gradle index 1e733b39..305be8ce 100644 --- a/LauncherAPI/build.gradle +++ b/LauncherAPI/build.gradle @@ -2,7 +2,7 @@ targetCompatibility = '1.8' dependencies { - compile project(':libLauncher') + compile project(':LauncherCore') compileOnly 'org.apache.httpcomponents:httpclient:4.5.7' compileOnly 'io.netty:netty-all:4.1.36.Final' } diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/config/JsonConfigurable.java b/LauncherAPI/src/main/java/ru/gravit/launcher/config/JsonConfigurable.java index 5e1883e0..9546e85d 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/config/JsonConfigurable.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/config/JsonConfigurable.java @@ -33,7 +33,7 @@ public JsonConfigurable(Type type, Path configPath) { @LauncherAPI public void saveConfig(Path configPath) throws IOException { try (BufferedWriter writer = IOHelper.newWriter(configPath)) { - Launcher.gsonManager.gson.toJson(getConfig(), type, writer); + Launcher.gsonManager.configGson.toJson(getConfig(), type, writer); } } @@ -41,7 +41,7 @@ public void saveConfig(Path configPath) throws IOException { public void loadConfig(Path configPath) throws IOException { if (generateConfigIfNotExists(configPath)) return; try (BufferedReader reader = IOHelper.newReader(configPath)) { - setConfig(Launcher.gsonManager.gson.fromJson(reader, type)); + setConfig(Launcher.gsonManager.configGson.fromJson(reader, type)); } } diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/downloader/ListDownloader.java b/LauncherAPI/src/main/java/ru/gravit/launcher/downloader/ListDownloader.java index 7646379c..d31a5344 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/downloader/ListDownloader.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/downloader/ListDownloader.java @@ -62,6 +62,7 @@ public void download(String base, List applies, Path dstDirFile, D } } } + public void downloadZip(String base, Path dstDirFile, DownloadCallback callback, DownloadTotalCallback totalCallback) throws IOException, URISyntaxException { /*try (CloseableHttpClient httpclient = HttpClients.custom() .setRedirectStrategy(new LaxRedirectStrategy()) @@ -132,23 +133,18 @@ public FileDownloadResponseHandler(Path target, DownloadCallback callback, Downl @Override public Path handleResponse(HttpResponse response) throws IOException { InputStream source = response.getEntity().getContent(); - if(zip) - { - try(ZipInputStream input = IOHelper.newZipInput(source)) - { + if (zip) { + try (ZipInputStream input = IOHelper.newZipInput(source)) { ZipEntry entry = input.getNextEntry(); - while(entry != null) - { - if(entry.isDirectory()) - { + while (entry != null) { + if (entry.isDirectory()) { entry = input.getNextEntry(); continue; } long size = entry.getSize(); String filename = entry.getName(); Path target = this.target.resolve(filename); - if(callback != null) - { + if (callback != null) { callback.stateChanged(entry.getName(), 0, entry.getSize()); } LogHelper.dev("Resolved filename %s to %s", filename, target.toAbsolutePath().toString()); diff --git a/libLauncher/src/main/java/ru/gravit/launcher/managers/SimpleModuleManager.java b/LauncherAPI/src/main/java/ru/gravit/launcher/managers/SimpleModuleManager.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/managers/SimpleModuleManager.java rename to LauncherAPI/src/main/java/ru/gravit/launcher/managers/SimpleModuleManager.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/managers/SimpleModulesConfigManager.java b/LauncherAPI/src/main/java/ru/gravit/launcher/managers/SimpleModulesConfigManager.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/managers/SimpleModulesConfigManager.java rename to LauncherAPI/src/main/java/ru/gravit/launcher/managers/SimpleModulesConfigManager.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/modules/Module.java b/LauncherAPI/src/main/java/ru/gravit/launcher/modules/Module.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/modules/Module.java rename to LauncherAPI/src/main/java/ru/gravit/launcher/modules/Module.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/modules/ModuleContext.java b/LauncherAPI/src/main/java/ru/gravit/launcher/modules/ModuleContext.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/modules/ModuleContext.java rename to LauncherAPI/src/main/java/ru/gravit/launcher/modules/ModuleContext.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/modules/ModulesConfigManager.java b/LauncherAPI/src/main/java/ru/gravit/launcher/modules/ModulesConfigManager.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/modules/ModulesConfigManager.java rename to LauncherAPI/src/main/java/ru/gravit/launcher/modules/ModulesConfigManager.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/modules/ModulesManager.java b/LauncherAPI/src/main/java/ru/gravit/launcher/modules/ModulesManager.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/modules/ModulesManager.java rename to LauncherAPI/src/main/java/ru/gravit/launcher/modules/ModulesManager.java diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/UpdateAction.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/UpdateAction.java deleted file mode 100644 index 9f80c671..00000000 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/UpdateAction.java +++ /dev/null @@ -1,60 +0,0 @@ -package ru.gravit.launcher.request; - -import ru.gravit.launcher.hasher.HashedEntry; -import ru.gravit.launcher.serialize.HInput; -import ru.gravit.launcher.serialize.HOutput; -import ru.gravit.launcher.serialize.stream.EnumSerializer; -import ru.gravit.launcher.serialize.stream.StreamObject; -import ru.gravit.utils.helper.IOHelper; - -import java.io.IOException; - -public final class UpdateAction extends StreamObject { - public enum Type implements EnumSerializer.Itf { - CD(1), CD_BACK(2), GET(3), FINISH(255); - private static final EnumSerializer SERIALIZER = new EnumSerializer<>(Type.class); - - public static Type read(HInput input) throws IOException { - return SERIALIZER.read(input); - } - - private final int n; - - Type(int n) { - this.n = n; - } - - @Override - public int getNumber() { - return n; - } - } - - public static final UpdateAction CD_BACK = new UpdateAction(Type.CD_BACK, null, null); - - public static final UpdateAction FINISH = new UpdateAction(Type.FINISH, null, null); - // Instance - public final Type type; - public final String name; - - public final HashedEntry entry; - - public UpdateAction(HInput input) throws IOException { - type = Type.read(input); - name = type == Type.CD || type == Type.GET ? IOHelper.verifyFileName(input.readString(255)) : null; - entry = null; - } - - public UpdateAction(Type type, String name, HashedEntry entry) { - this.type = type; - this.name = name; - this.entry = entry; - } - - @Override - public void write(HOutput output) throws IOException { - EnumSerializer.write(output, type); - if (type == Type.CD || type == Type.GET) - output.writeString(name, 255); - } -} diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java index 8ae58501..931e6828 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java @@ -27,15 +27,20 @@ import java.util.Objects; public final class UpdateRequest extends Request implements RequestInterface { - public interface UpdateController - { + public interface UpdateController { void preUpdate(UpdateRequest request, UpdateRequestEvent e) throws IOException; + void preDiff(UpdateRequest request, UpdateRequestEvent e) throws IOException; - void postDiff(UpdateRequest request, UpdateRequestEvent e,HashedDir.Diff diff) throws IOException; + + void postDiff(UpdateRequest request, UpdateRequestEvent e, HashedDir.Diff diff) throws IOException; + void preDownload(UpdateRequest request, UpdateRequestEvent e, List adds) throws IOException; + void postDownload(UpdateRequest request, UpdateRequestEvent e) throws IOException; + void postUpdate(UpdateRequest request, UpdateRequestEvent e) throws IOException; } + private static UpdateController controller; public static void setController(UpdateController controller) { @@ -184,18 +189,17 @@ public double getTotalSizeMiB() { public UpdateRequestEvent requestDo(StandartClientWebSocketService service) throws Exception { LogHelper.debug("Start update request"); UpdateRequestEvent e = (UpdateRequestEvent) service.sendRequest(this); - if(controller != null) controller.preUpdate(this, e); + if (controller != null) controller.preUpdate(this, e); LogHelper.debug("Start update"); Launcher.profile.pushOptionalFile(e.hdir, !Launcher.profile.isUpdateFastCheck()); - if(controller != null) controller.preDiff(this, e); + if (controller != null) controller.preDiff(this, e); HashedDir.Diff diff = e.hdir.diff(localDir, matcher); - if(controller != null) controller.postDiff(this, e, diff); + if (controller != null) controller.postDiff(this, e, diff); final List adds = new ArrayList<>(); - if(controller != null) controller.preDownload(this, e, adds); + if (controller != null) controller.preDownload(this, e, adds); diff.mismatch.walk(IOHelper.CROSS_SEPARATOR, (path, name, entry) -> { if (entry.getType().equals(HashedEntry.Type.FILE)) { - if(!entry.flag) - { + if (!entry.flag) { HashedFile file = (HashedFile) entry; totalSize += file.size; adds.add(new ListDownloader.DownloadTask(path, file.size)); @@ -214,17 +218,14 @@ public UpdateRequestEvent requestDo(StandartClientWebSocketService service) thro updateState("UnknownFile", 0L, 100); ListDownloader listDownloader = new ListDownloader(); LogHelper.info("Download %s to %s", dirName, dir.toAbsolutePath().toString()); - if(e.zip && !adds.isEmpty()) - { + if (e.zip && !adds.isEmpty()) { listDownloader.downloadZip(e.url, dir, this::updateState, (add) -> totalDownloaded += add); - } - else - { + } else { listDownloader.download(e.url, adds, dir, this::updateState, (add) -> totalDownloaded += add); } - if(controller != null) controller.postDownload(this, e); + if (controller != null) controller.postDownload(this, e); deleteExtraDir(dir, diff.extra, diff.extra.flag); - if(controller != null) controller.postUpdate(this, e); + if (controller != null) controller.postUpdate(this, e); LogHelper.debug("Update success"); return e; } diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/StandartClientWebSocketService.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/StandartClientWebSocketService.java index a5372c44..bfdff933 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/StandartClientWebSocketService.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/StandartClientWebSocketService.java @@ -63,7 +63,7 @@ public ResultInterface get() throws InterruptedException, ExecutionException { } ResultInterface result = event.result; waitEventHandler.requests.remove(event); - if (event.result.getType().equals("error")) { + if (event.result.getType().equals("error") || event.result.getType().equals("exception")) { ErrorRequestEvent errorRequestEvent = (ErrorRequestEvent) event.result; throw new ExecutionException(new RequestException(errorRequestEvent.error)); } @@ -80,7 +80,7 @@ public ResultInterface get(long timeout, TimeUnit unit) throws InterruptedExcept } ResultInterface result = event.result; waitEventHandler.requests.remove(event); - if (event.result.getType().equals("error")) { + if (event.result.getType().equals("error") || event.result.getType().equals("exception")) { ErrorRequestEvent errorRequestEvent = (ErrorRequestEvent) event.result; throw new ExecutionException(new RequestException(errorRequestEvent.error)); } diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/WaitEventHandler.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/WaitEventHandler.java index d319714d..e9a4fb03 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/WaitEventHandler.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/WaitEventHandler.java @@ -4,7 +4,6 @@ import ru.gravit.launcher.request.ResultInterface; import ru.gravit.utils.helper.LogHelper; -import java.util.HashSet; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/WebSocketClientHandler.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/WebSocketClientHandler.java index d9c27341..c7042963 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/WebSocketClientHandler.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/WebSocketClientHandler.java @@ -32,9 +32,9 @@ public void handlerAdded(final ChannelHandlerContext ctx) throws Exception { public void channelActive(final ChannelHandlerContext ctx) throws Exception { handshaker.handshake(ctx.channel()); clientJSONPoint.onOpen(); - ctx.executor().schedule(() -> { + ctx.executor().scheduleWithFixedDelay(() -> { ctx.channel().writeAndFlush(new PingWebSocketFrame()); - }, 20L, TimeUnit.SECONDS); + }, 20L, 20L, TimeUnit.SECONDS); } @Override @@ -66,6 +66,10 @@ protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Except LogHelper.dev("Message: %s", textFrame.text()); // uncomment to print request // logger.info(textFrame.text()); + } else if ((frame instanceof PingWebSocketFrame)) { + frame.content().retain(); + ctx.channel().writeAndFlush(new PongWebSocketFrame(frame.content())); + //return; } else if (frame instanceof PongWebSocketFrame) { } else if (frame instanceof CloseWebSocketFrame) ch.close(); diff --git a/libLauncher/src/main/java/ru/gravit/launcher/ssl/LauncherKeyStore.java b/LauncherAPI/src/main/java/ru/gravit/launcher/ssl/LauncherKeyStore.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/ssl/LauncherKeyStore.java rename to LauncherAPI/src/main/java/ru/gravit/launcher/ssl/LauncherKeyStore.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/ssl/LauncherSSLContext.java b/LauncherAPI/src/main/java/ru/gravit/launcher/ssl/LauncherSSLContext.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/ssl/LauncherSSLContext.java rename to LauncherAPI/src/main/java/ru/gravit/launcher/ssl/LauncherSSLContext.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/ssl/LauncherTrustManager.java b/LauncherAPI/src/main/java/ru/gravit/launcher/ssl/LauncherTrustManager.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/ssl/LauncherTrustManager.java rename to LauncherAPI/src/main/java/ru/gravit/launcher/ssl/LauncherTrustManager.java diff --git a/libLauncher/build.gradle b/LauncherCore/build.gradle similarity index 100% rename from libLauncher/build.gradle rename to LauncherCore/build.gradle diff --git a/libLauncher/src/main/java/ru/gravit/launcher/LauncherAPI.java b/LauncherCore/src/main/java/ru/gravit/launcher/LauncherAPI.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/LauncherAPI.java rename to LauncherCore/src/main/java/ru/gravit/launcher/LauncherAPI.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/LauncherNetworkAPI.java b/LauncherCore/src/main/java/ru/gravit/launcher/LauncherNetworkAPI.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/LauncherNetworkAPI.java rename to LauncherCore/src/main/java/ru/gravit/launcher/LauncherNetworkAPI.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/NeedGarbageCollection.java b/LauncherCore/src/main/java/ru/gravit/launcher/NeedGarbageCollection.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/NeedGarbageCollection.java rename to LauncherCore/src/main/java/ru/gravit/launcher/NeedGarbageCollection.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/hasher/FileNameMatcher.java b/LauncherCore/src/main/java/ru/gravit/launcher/hasher/FileNameMatcher.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/hasher/FileNameMatcher.java rename to LauncherCore/src/main/java/ru/gravit/launcher/hasher/FileNameMatcher.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedDir.java b/LauncherCore/src/main/java/ru/gravit/launcher/hasher/HashedDir.java similarity index 97% rename from libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedDir.java rename to LauncherCore/src/main/java/ru/gravit/launcher/hasher/HashedDir.java index bb1327be..0fed474b 100644 --- a/libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedDir.java +++ b/LauncherCore/src/main/java/ru/gravit/launcher/hasher/HashedDir.java @@ -342,8 +342,8 @@ public void walk(CharSequence separator, WalkCallback callback) throws IOExcepti String append = ""; walk(append, separator, callback, true); } - public enum WalkAction - { + + public enum WalkAction { STOP, CONTINUE } @@ -356,24 +356,21 @@ private WalkAction walk(String append, CharSequence separator, WalkCallback call for (Map.Entry entry : map.entrySet()) { HashedEntry e = entry.getValue(); if (e.getType() == Type.FILE) { - if (noSeparator) - { + if (noSeparator) { WalkAction a = callback.walked(append + entry.getKey(), entry.getKey(), e); - if(a == WalkAction.STOP) return a; - } - else - { + if (a == WalkAction.STOP) return a; + } else { WalkAction a = callback.walked(append + separator + entry.getKey(), entry.getKey(), e); - if(a == WalkAction.STOP) return a; + if (a == WalkAction.STOP) return a; } } else { String newAppend; if (noSeparator) newAppend = append + entry.getKey(); else newAppend = append + separator + entry.getKey(); WalkAction a = callback.walked(newAppend, entry.getKey(), e); - if(a == WalkAction.STOP) return a; + if (a == WalkAction.STOP) return a; a = ((HashedDir) e).walk(newAppend, separator, callback, false); - if(a == WalkAction.STOP) return a; + if (a == WalkAction.STOP) return a; } } return WalkAction.CONTINUE; diff --git a/libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedEntry.java b/LauncherCore/src/main/java/ru/gravit/launcher/hasher/HashedEntry.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedEntry.java rename to LauncherCore/src/main/java/ru/gravit/launcher/hasher/HashedEntry.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedEntryAdapter.java b/LauncherCore/src/main/java/ru/gravit/launcher/hasher/HashedEntryAdapter.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedEntryAdapter.java rename to LauncherCore/src/main/java/ru/gravit/launcher/hasher/HashedEntryAdapter.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedFile.java b/LauncherCore/src/main/java/ru/gravit/launcher/hasher/HashedFile.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedFile.java rename to LauncherCore/src/main/java/ru/gravit/launcher/hasher/HashedFile.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/managers/GarbageManager.java b/LauncherCore/src/main/java/ru/gravit/launcher/managers/GarbageManager.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/managers/GarbageManager.java rename to LauncherCore/src/main/java/ru/gravit/launcher/managers/GarbageManager.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/managers/GsonManager.java b/LauncherCore/src/main/java/ru/gravit/launcher/managers/GsonManager.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/managers/GsonManager.java rename to LauncherCore/src/main/java/ru/gravit/launcher/managers/GsonManager.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/serialize/HInput.java b/LauncherCore/src/main/java/ru/gravit/launcher/serialize/HInput.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/serialize/HInput.java rename to LauncherCore/src/main/java/ru/gravit/launcher/serialize/HInput.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/serialize/HOutput.java b/LauncherCore/src/main/java/ru/gravit/launcher/serialize/HOutput.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/serialize/HOutput.java rename to LauncherCore/src/main/java/ru/gravit/launcher/serialize/HOutput.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/serialize/SerializeLimits.java b/LauncherCore/src/main/java/ru/gravit/launcher/serialize/SerializeLimits.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/serialize/SerializeLimits.java rename to LauncherCore/src/main/java/ru/gravit/launcher/serialize/SerializeLimits.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/serialize/signed/DigestBytesHolder.java b/LauncherCore/src/main/java/ru/gravit/launcher/serialize/signed/DigestBytesHolder.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/serialize/signed/DigestBytesHolder.java rename to LauncherCore/src/main/java/ru/gravit/launcher/serialize/signed/DigestBytesHolder.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/serialize/signed/SignedBytesHolder.java b/LauncherCore/src/main/java/ru/gravit/launcher/serialize/signed/SignedBytesHolder.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/serialize/signed/SignedBytesHolder.java rename to LauncherCore/src/main/java/ru/gravit/launcher/serialize/signed/SignedBytesHolder.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/serialize/signed/SignedObjectHolder.java b/LauncherCore/src/main/java/ru/gravit/launcher/serialize/signed/SignedObjectHolder.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/serialize/signed/SignedObjectHolder.java rename to LauncherCore/src/main/java/ru/gravit/launcher/serialize/signed/SignedObjectHolder.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/serialize/stream/EnumSerializer.java b/LauncherCore/src/main/java/ru/gravit/launcher/serialize/stream/EnumSerializer.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/serialize/stream/EnumSerializer.java rename to LauncherCore/src/main/java/ru/gravit/launcher/serialize/stream/EnumSerializer.java diff --git a/libLauncher/src/main/java/ru/gravit/launcher/serialize/stream/StreamObject.java b/LauncherCore/src/main/java/ru/gravit/launcher/serialize/stream/StreamObject.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/launcher/serialize/stream/StreamObject.java rename to LauncherCore/src/main/java/ru/gravit/launcher/serialize/stream/StreamObject.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/BiHookSet.java b/LauncherCore/src/main/java/ru/gravit/utils/BiHookSet.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/BiHookSet.java rename to LauncherCore/src/main/java/ru/gravit/utils/BiHookSet.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/HTTPRequest.java b/LauncherCore/src/main/java/ru/gravit/utils/HTTPRequest.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/HTTPRequest.java rename to LauncherCore/src/main/java/ru/gravit/utils/HTTPRequest.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/HookException.java b/LauncherCore/src/main/java/ru/gravit/utils/HookException.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/HookException.java rename to LauncherCore/src/main/java/ru/gravit/utils/HookException.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/HookSet.java b/LauncherCore/src/main/java/ru/gravit/utils/HookSet.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/HookSet.java rename to LauncherCore/src/main/java/ru/gravit/utils/HookSet.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/HttpDownloader.java b/LauncherCore/src/main/java/ru/gravit/utils/HttpDownloader.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/HttpDownloader.java rename to LauncherCore/src/main/java/ru/gravit/utils/HttpDownloader.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/ProviderMap.java b/LauncherCore/src/main/java/ru/gravit/utils/ProviderMap.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/ProviderMap.java rename to LauncherCore/src/main/java/ru/gravit/utils/ProviderMap.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/PublicURLClassLoader.java b/LauncherCore/src/main/java/ru/gravit/utils/PublicURLClassLoader.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/PublicURLClassLoader.java rename to LauncherCore/src/main/java/ru/gravit/utils/PublicURLClassLoader.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/UniversalJsonAdapter.java b/LauncherCore/src/main/java/ru/gravit/utils/UniversalJsonAdapter.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/UniversalJsonAdapter.java rename to LauncherCore/src/main/java/ru/gravit/utils/UniversalJsonAdapter.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/Version.java b/LauncherCore/src/main/java/ru/gravit/utils/Version.java similarity index 98% rename from libLauncher/src/main/java/ru/gravit/utils/Version.java rename to LauncherCore/src/main/java/ru/gravit/utils/Version.java index 5f729792..e314edd1 100644 --- a/libLauncher/src/main/java/ru/gravit/utils/Version.java +++ b/LauncherCore/src/main/java/ru/gravit/utils/Version.java @@ -17,7 +17,7 @@ public final class Version { public final Type release; public static final int MAJOR = 5; public static final int MINOR = 0; - public static final int PATCH = 1; + public static final int PATCH = 2; public static final int BUILD = 1; public static final Version.Type RELEASE = Version.Type.STABLE; diff --git a/libLauncher/src/main/java/ru/gravit/utils/command/BaseCommandCategory.java b/LauncherCore/src/main/java/ru/gravit/utils/command/BaseCommandCategory.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/command/BaseCommandCategory.java rename to LauncherCore/src/main/java/ru/gravit/utils/command/BaseCommandCategory.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/command/Command.java b/LauncherCore/src/main/java/ru/gravit/utils/command/Command.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/command/Command.java rename to LauncherCore/src/main/java/ru/gravit/utils/command/Command.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/command/CommandCategory.java b/LauncherCore/src/main/java/ru/gravit/utils/command/CommandCategory.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/command/CommandCategory.java rename to LauncherCore/src/main/java/ru/gravit/utils/command/CommandCategory.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/command/CommandException.java b/LauncherCore/src/main/java/ru/gravit/utils/command/CommandException.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/command/CommandException.java rename to LauncherCore/src/main/java/ru/gravit/utils/command/CommandException.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/command/CommandHandler.java b/LauncherCore/src/main/java/ru/gravit/utils/command/CommandHandler.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/command/CommandHandler.java rename to LauncherCore/src/main/java/ru/gravit/utils/command/CommandHandler.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/command/JLineCommandHandler.java b/LauncherCore/src/main/java/ru/gravit/utils/command/JLineCommandHandler.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/command/JLineCommandHandler.java rename to LauncherCore/src/main/java/ru/gravit/utils/command/JLineCommandHandler.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/command/StdCommandHandler.java b/LauncherCore/src/main/java/ru/gravit/utils/command/StdCommandHandler.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/command/StdCommandHandler.java rename to LauncherCore/src/main/java/ru/gravit/utils/command/StdCommandHandler.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/command/basic/ClearCommand.java b/LauncherCore/src/main/java/ru/gravit/utils/command/basic/ClearCommand.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/command/basic/ClearCommand.java rename to LauncherCore/src/main/java/ru/gravit/utils/command/basic/ClearCommand.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/command/basic/DebugCommand.java b/LauncherCore/src/main/java/ru/gravit/utils/command/basic/DebugCommand.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/command/basic/DebugCommand.java rename to LauncherCore/src/main/java/ru/gravit/utils/command/basic/DebugCommand.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/command/basic/GCCommand.java b/LauncherCore/src/main/java/ru/gravit/utils/command/basic/GCCommand.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/command/basic/GCCommand.java rename to LauncherCore/src/main/java/ru/gravit/utils/command/basic/GCCommand.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/command/basic/HelpCommand.java b/LauncherCore/src/main/java/ru/gravit/utils/command/basic/HelpCommand.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/command/basic/HelpCommand.java rename to LauncherCore/src/main/java/ru/gravit/utils/command/basic/HelpCommand.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/event/EventHandler.java b/LauncherCore/src/main/java/ru/gravit/utils/event/EventHandler.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/event/EventHandler.java rename to LauncherCore/src/main/java/ru/gravit/utils/event/EventHandler.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/event/EventInterface.java b/LauncherCore/src/main/java/ru/gravit/utils/event/EventInterface.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/event/EventInterface.java rename to LauncherCore/src/main/java/ru/gravit/utils/event/EventInterface.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/event/EventManager.java b/LauncherCore/src/main/java/ru/gravit/utils/event/EventManager.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/event/EventManager.java rename to LauncherCore/src/main/java/ru/gravit/utils/event/EventManager.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/helper/CommonHelper.java b/LauncherCore/src/main/java/ru/gravit/utils/helper/CommonHelper.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/helper/CommonHelper.java rename to LauncherCore/src/main/java/ru/gravit/utils/helper/CommonHelper.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/helper/EnvHelper.java b/LauncherCore/src/main/java/ru/gravit/utils/helper/EnvHelper.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/helper/EnvHelper.java rename to LauncherCore/src/main/java/ru/gravit/utils/helper/EnvHelper.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/helper/FormatHelper.java b/LauncherCore/src/main/java/ru/gravit/utils/helper/FormatHelper.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/helper/FormatHelper.java rename to LauncherCore/src/main/java/ru/gravit/utils/helper/FormatHelper.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/helper/IOHelper.java b/LauncherCore/src/main/java/ru/gravit/utils/helper/IOHelper.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/helper/IOHelper.java rename to LauncherCore/src/main/java/ru/gravit/utils/helper/IOHelper.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/helper/JVMHelper.java b/LauncherCore/src/main/java/ru/gravit/utils/helper/JVMHelper.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/helper/JVMHelper.java rename to LauncherCore/src/main/java/ru/gravit/utils/helper/JVMHelper.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/helper/JarHelper.java b/LauncherCore/src/main/java/ru/gravit/utils/helper/JarHelper.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/helper/JarHelper.java rename to LauncherCore/src/main/java/ru/gravit/utils/helper/JarHelper.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/helper/LogHelper.java b/LauncherCore/src/main/java/ru/gravit/utils/helper/LogHelper.java similarity index 99% rename from libLauncher/src/main/java/ru/gravit/utils/helper/LogHelper.java rename to LauncherCore/src/main/java/ru/gravit/utils/helper/LogHelper.java index 22c1649a..a1739758 100644 --- a/libLauncher/src/main/java/ru/gravit/utils/helper/LogHelper.java +++ b/LauncherCore/src/main/java/ru/gravit/utils/helper/LogHelper.java @@ -113,8 +113,7 @@ public static void debug(String format, Object... args) { @LauncherAPI public static void dev(String format, Object... args) { - if(isDevEnabled()) - { + if (isDevEnabled()) { dev(String.format(format, args)); } } diff --git a/libLauncher/src/main/java/ru/gravit/utils/helper/SecurityHelper.java b/LauncherCore/src/main/java/ru/gravit/utils/helper/SecurityHelper.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/helper/SecurityHelper.java rename to LauncherCore/src/main/java/ru/gravit/utils/helper/SecurityHelper.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/helper/UnpackHelper.java b/LauncherCore/src/main/java/ru/gravit/utils/helper/UnpackHelper.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/helper/UnpackHelper.java rename to LauncherCore/src/main/java/ru/gravit/utils/helper/UnpackHelper.java diff --git a/libLauncher/src/main/java/ru/gravit/utils/helper/VerifyHelper.java b/LauncherCore/src/main/java/ru/gravit/utils/helper/VerifyHelper.java similarity index 100% rename from libLauncher/src/main/java/ru/gravit/utils/helper/VerifyHelper.java rename to LauncherCore/src/main/java/ru/gravit/utils/helper/VerifyHelper.java diff --git a/modules b/modules index b5995176..5c3aa4d1 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit b599517693c9d1c9a9045982ffa8068e1ed620c4 +Subproject commit 5c3aa4d10e6973799315c5befed2ecb7cd98b203 diff --git a/settings.gradle b/settings.gradle index 50775c2f..72971c4c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,7 +2,7 @@ include 'Launcher' include 'Radon' -include 'libLauncher' +include 'LauncherCore' include 'LauncherAPI' include 'LauncherAuthlib' include 'ServerWrapper'