mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
[FEATURE] Указание guardType
This commit is contained in:
parent
3c0de3727d
commit
0201c8d474
7 changed files with 37 additions and 46 deletions
|
@ -131,20 +131,16 @@ public AuthProviderPair getAuthProviderPair() {
|
||||||
public NettyConfig netty;
|
public NettyConfig netty;
|
||||||
public GuardLicenseConf guardLicense;
|
public GuardLicenseConf guardLicense;
|
||||||
|
|
||||||
public boolean compress;
|
|
||||||
|
|
||||||
public String whitelistRejectString;
|
public String whitelistRejectString;
|
||||||
|
|
||||||
public boolean genMappings;
|
public boolean genMappings;
|
||||||
public boolean isUsingWrapper;
|
public LauncherConf launcher;
|
||||||
public boolean isDownloadJava;
|
|
||||||
|
|
||||||
public boolean isWarningMissArchJava;
|
public boolean isWarningMissArchJava;
|
||||||
public boolean enabledProGuard;
|
public boolean enabledProGuard;
|
||||||
public boolean enabledRadon;
|
public boolean enabledRadon;
|
||||||
public boolean stripLineNumbers;
|
public boolean stripLineNumbers;
|
||||||
public boolean deleteTempFiles;
|
public boolean deleteTempFiles;
|
||||||
public boolean enableRcon;
|
|
||||||
|
|
||||||
public String startScript;
|
public String startScript;
|
||||||
|
|
||||||
|
@ -242,6 +238,11 @@ public static class ExeConf {
|
||||||
public String txtProductVersion;
|
public String txtProductVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class LauncherConf
|
||||||
|
{
|
||||||
|
public String guardType;
|
||||||
|
}
|
||||||
|
|
||||||
public class NettyConfig {
|
public class NettyConfig {
|
||||||
public boolean clientEnabled;
|
public boolean clientEnabled;
|
||||||
public String launcherURL;
|
public String launcherURL;
|
||||||
|
|
|
@ -83,6 +83,12 @@ public void setSecretKey(String key) {
|
||||||
body.append("\";");
|
body.append("\";");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setGuardType(String key) {
|
||||||
|
body.append("this.guardType = \"");
|
||||||
|
body.append(key);
|
||||||
|
body.append("\";");
|
||||||
|
}
|
||||||
|
|
||||||
public void setEnv(LauncherConfig.LauncherEnvironment env) {
|
public void setEnv(LauncherConfig.LauncherEnvironment env) {
|
||||||
int i = 2;
|
int i = 2;
|
||||||
switch (env) {
|
switch (env) {
|
||||||
|
@ -111,18 +117,6 @@ public void setClientPort(int port) {
|
||||||
body.append(";");
|
body.append(";");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsingWrapper(boolean b) {
|
|
||||||
body.append("this.isUsingWrapper = ");
|
|
||||||
body.append(b ? "true" : "false");
|
|
||||||
body.append(";");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDownloadJava(boolean b) {
|
|
||||||
body.append("this.isDownloadJava = ");
|
|
||||||
body.append(b ? "true" : "false");
|
|
||||||
body.append(";");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWarningMissArchJava(boolean b) {
|
public void setWarningMissArchJava(boolean b) {
|
||||||
body.append("this.isWarningMissArchJava = ");
|
body.append("this.isWarningMissArchJava = ");
|
||||||
body.append(b ? "true" : "false");
|
body.append(b ? "true" : "false");
|
||||||
|
|
|
@ -134,9 +134,8 @@ public Path process(Path inputJar) throws IOException {
|
||||||
jaConfigurator.setProjectName(server.config.projectName);
|
jaConfigurator.setProjectName(server.config.projectName);
|
||||||
jaConfigurator.setSecretKey(SecurityHelper.randomStringAESKey());
|
jaConfigurator.setSecretKey(SecurityHelper.randomStringAESKey());
|
||||||
jaConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512));
|
jaConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512));
|
||||||
jaConfigurator.setUsingWrapper(server.config.isUsingWrapper);
|
jaConfigurator.setGuardType(server.config.launcher.guardType);
|
||||||
jaConfigurator.setWarningMissArchJava(server.config.isWarningMissArchJava);
|
jaConfigurator.setWarningMissArchJava(server.config.isWarningMissArchJava);
|
||||||
jaConfigurator.setDownloadJava(server.config.isDownloadJava);
|
|
||||||
jaConfigurator.setEnv(server.config.env);
|
jaConfigurator.setEnv(server.config.env);
|
||||||
server.buildHookManager.registerAllClientModuleClass(jaConfigurator);
|
server.buildHookManager.registerAllClientModuleClass(jaConfigurator);
|
||||||
reader.getCp().add(new JarFile(inputJar.toFile()));
|
reader.getCp().add(new JarFile(inputJar.toFile()));
|
||||||
|
|
|
@ -139,8 +139,6 @@ public void write(HOutput output) throws IOException {
|
||||||
private static final String SOCKET_HOST = "127.0.0.1";
|
private static final String SOCKET_HOST = "127.0.0.1";
|
||||||
private static final int SOCKET_PORT = Launcher.getConfig().clientPort;
|
private static final int SOCKET_PORT = Launcher.getConfig().clientPort;
|
||||||
private static final String MAGICAL_INTEL_OPTION = "-XX:HeapDumpPath=ThisTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump";
|
private static final String MAGICAL_INTEL_OPTION = "-XX:HeapDumpPath=ThisTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump";
|
||||||
private static final boolean isUsingWrapper = Launcher.getConfig().isUsingWrapper;
|
|
||||||
private static final boolean isDownloadJava = Launcher.getConfig().isDownloadJava;
|
|
||||||
|
|
||||||
private static Path JavaBinPath;
|
private static Path JavaBinPath;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
@ -165,10 +163,6 @@ public static class ClientUserProperties {
|
||||||
String[] cloakDigest;
|
String[] cloakDigest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDownloadJava() {
|
|
||||||
return isDownloadJava;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Path getJavaBinPath() {
|
public static Path getJavaBinPath() {
|
||||||
return JavaBinPath;
|
return JavaBinPath;
|
||||||
}
|
}
|
||||||
|
@ -265,11 +259,6 @@ public static boolean isLaunched() {
|
||||||
return Launcher.LAUNCHED.get();
|
return Launcher.LAUNCHED.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean isUsingWrapper() {
|
|
||||||
return JVMHelper.OS_TYPE == OS.MUSTDIE && isUsingWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void launch(ClientProfile profile, Params params) throws Throwable {
|
private static void launch(ClientProfile profile, Params params) throws Throwable {
|
||||||
// Add client args
|
// Add client args
|
||||||
Collection<String> args = new LinkedList<>();
|
Collection<String> args = new LinkedList<>();
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.gravit.launcher.guard;
|
package ru.gravit.launcher.guard;
|
||||||
|
|
||||||
|
import ru.gravit.launcher.Launcher;
|
||||||
|
import ru.gravit.launcher.LauncherConfig;
|
||||||
import ru.gravit.launcher.client.ClientLauncher;
|
import ru.gravit.launcher.client.ClientLauncher;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
@ -8,11 +10,22 @@ public class LauncherGuardManager {
|
||||||
public static LauncherGuardInterface guard;
|
public static LauncherGuardInterface guard;
|
||||||
|
|
||||||
public static void initGuard(boolean clientInstance) {
|
public static void initGuard(boolean clientInstance) {
|
||||||
if (ClientLauncher.isUsingWrapper()) {
|
LauncherConfig config = Launcher.getConfig();
|
||||||
guard = new LauncherWrapperGuard();
|
switch (config.guardType)
|
||||||
} else if (ClientLauncher.isDownloadJava()) {
|
{
|
||||||
guard = new LauncherJavaGuard();
|
case "wrapper":
|
||||||
} else guard = new LauncherNoGuard();
|
{
|
||||||
|
guard = new LauncherWrapperGuard();
|
||||||
|
}
|
||||||
|
case "java":
|
||||||
|
{
|
||||||
|
guard = new LauncherJavaGuard();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
guard = new LauncherNoGuard();
|
||||||
|
}
|
||||||
|
}
|
||||||
guard.init(clientInstance);
|
guard.init(clientInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ public class AutogenConfig {
|
||||||
public int clientPort;
|
public int clientPort;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private boolean isInitModules;
|
private boolean isInitModules;
|
||||||
public boolean isUsingWrapper;
|
public String guardType;
|
||||||
public boolean isDownloadJava; //Выставление этого флага требует модификации runtime части
|
|
||||||
public String secretKeyClient;
|
public String secretKeyClient;
|
||||||
public String guardLicenseName;
|
public String guardLicenseName;
|
||||||
public String guardLicenseKey;
|
public String guardLicenseKey;
|
||||||
|
|
|
@ -30,15 +30,13 @@ public static AutogenConfig getAutogenConfig() {
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public final Map<String, byte[]> runtime;
|
public final Map<String, byte[]> runtime;
|
||||||
|
|
||||||
public final boolean isUsingWrapper;
|
|
||||||
public final boolean isDownloadJava;
|
|
||||||
public final boolean isWarningMissArchJava;
|
public final boolean isWarningMissArchJava;
|
||||||
public boolean isNettyEnabled;
|
public boolean isNettyEnabled;
|
||||||
|
|
||||||
public final String guardLicenseName;
|
public final String guardLicenseName;
|
||||||
public final String guardLicenseKey;
|
public final String guardLicenseKey;
|
||||||
public final String guardLicenseEncryptKey;
|
public final String guardLicenseEncryptKey;
|
||||||
|
public final String guardType;
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException {
|
public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException {
|
||||||
|
@ -46,11 +44,11 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
||||||
projectname = config.projectname;
|
projectname = config.projectname;
|
||||||
clientPort = config.clientPort;
|
clientPort = config.clientPort;
|
||||||
secretKeyClient = config.secretKeyClient;
|
secretKeyClient = config.secretKeyClient;
|
||||||
isDownloadJava = config.isDownloadJava;
|
|
||||||
isUsingWrapper = config.isUsingWrapper;
|
|
||||||
isWarningMissArchJava = config.isWarningMissArchJava;
|
isWarningMissArchJava = config.isWarningMissArchJava;
|
||||||
guardLicenseEncryptKey = config.guardLicenseEncryptKey;
|
guardLicenseEncryptKey = config.guardLicenseEncryptKey;
|
||||||
guardLicenseKey = config.guardLicenseKey;
|
guardLicenseKey = config.guardLicenseKey;
|
||||||
|
guardType = config.guardType;
|
||||||
guardLicenseName = config.guardLicenseName;
|
guardLicenseName = config.guardLicenseName;
|
||||||
address = config.address;
|
address = config.address;
|
||||||
LauncherEnvironment env;
|
LauncherEnvironment env;
|
||||||
|
@ -82,8 +80,7 @@ public LauncherConfig(String address, RSAPublicKey publicKey, Map<String, byte[]
|
||||||
this.guardLicenseName = "FREE";
|
this.guardLicenseName = "FREE";
|
||||||
this.guardLicenseKey = "AAAA-BBBB-CCCC-DDDD";
|
this.guardLicenseKey = "AAAA-BBBB-CCCC-DDDD";
|
||||||
this.guardLicenseEncryptKey = "12345";
|
this.guardLicenseEncryptKey = "12345";
|
||||||
isUsingWrapper = true;
|
guardType = "no";
|
||||||
isDownloadJava = false;
|
|
||||||
isWarningMissArchJava = true;
|
isWarningMissArchJava = true;
|
||||||
isNettyEnabled = false;
|
isNettyEnabled = false;
|
||||||
}
|
}
|
||||||
|
@ -98,8 +95,7 @@ public LauncherConfig(String address, RSAPublicKey publicKey, Map<String, byte[]
|
||||||
this.guardLicenseKey = "AAAA-BBBB-CCCC-DDDD";
|
this.guardLicenseKey = "AAAA-BBBB-CCCC-DDDD";
|
||||||
this.guardLicenseEncryptKey = "12345";
|
this.guardLicenseEncryptKey = "12345";
|
||||||
this.clientPort = 32148;
|
this.clientPort = 32148;
|
||||||
isUsingWrapper = true;
|
guardType = "no";
|
||||||
isDownloadJava = false;
|
|
||||||
isWarningMissArchJava = true;
|
isWarningMissArchJava = true;
|
||||||
isNettyEnabled = false;
|
isNettyEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue