mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FEATURE]Полноценная реализация блокировки launcher консоли
This commit is contained in:
parent
5373856646
commit
c5635de295
6 changed files with 17 additions and 1 deletions
|
@ -83,6 +83,12 @@ public void setSecretKey(String key) {
|
|||
body.append("\";");
|
||||
}
|
||||
|
||||
public void setOemUnlockKey(String key) {
|
||||
body.append("this.oemUnlockKey = \"");
|
||||
body.append(key);
|
||||
body.append("\";");
|
||||
}
|
||||
|
||||
public void setGuardType(String key) {
|
||||
body.append("this.guardType = \"");
|
||||
body.append(key);
|
||||
|
|
|
@ -137,6 +137,8 @@ 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();
|
||||
jaConfigurator.setOemUnlockKey(server.runtime.oemUnlockKey);
|
||||
server.buildHookManager.registerAllClientModuleClass(jaConfigurator);
|
||||
reader.getCp().add(new JarFile(inputJar.toFile()));
|
||||
server.launcherBinary.coreLibs.forEach(e -> {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
public class LaunchServerRuntimeConfig {
|
||||
public String clientToken;
|
||||
public String oemUnlockKey;
|
||||
|
||||
public void verify() {
|
||||
if (clientToken == null) LogHelper.error("[RuntimeConfig] clientToken must not be null");
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ru.gravit.launcher.managers;
|
||||
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.console.FeatureCommand;
|
||||
import ru.gravit.launcher.console.UnlockCommand;
|
||||
import ru.gravit.launcher.console.admin.ExecCommand;
|
||||
|
@ -19,6 +20,9 @@
|
|||
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;
|
||||
|
@ -50,7 +54,7 @@ public static void registerCommands() {
|
|||
}
|
||||
|
||||
public static boolean checkUnlockKey(String key) {
|
||||
return true;
|
||||
return key.equals(Launcher.getConfig().oemUnlockKey);
|
||||
}
|
||||
|
||||
public static void unlock() {
|
||||
|
|
|
@ -8,6 +8,7 @@ public class AutogenConfig {
|
|||
private boolean isInitModules;
|
||||
public String guardType;
|
||||
public String secretKeyClient;
|
||||
public String oemUnlockKey;
|
||||
public String guardLicenseName;
|
||||
public String guardLicenseKey;
|
||||
public String guardLicenseEncryptKey;
|
||||
|
|
|
@ -25,6 +25,7 @@ public static AutogenConfig getAutogenConfig() {
|
|||
public final String projectname;
|
||||
public final int clientPort;
|
||||
public String secretKeyClient;
|
||||
public String oemUnlockKey;
|
||||
@LauncherAPI
|
||||
public final RSAPublicKey publicKey;
|
||||
|
||||
|
@ -45,6 +46,7 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
|||
projectname = config.projectname;
|
||||
clientPort = config.clientPort;
|
||||
secretKeyClient = config.secretKeyClient;
|
||||
oemUnlockKey = config.oemUnlockKey;
|
||||
|
||||
isWarningMissArchJava = config.isWarningMissArchJava;
|
||||
guardLicenseEncryptKey = config.guardLicenseEncryptKey;
|
||||
|
|
Loading…
Reference in a new issue