mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[ANY] Чистка LauncherConfig
This commit is contained in:
parent
176430e442
commit
b9761637db
7 changed files with 13 additions and 55 deletions
|
@ -195,7 +195,7 @@ public Path process(Path inputJar) throws IOException {
|
|||
byte[] launcherConfigBytes;
|
||||
try (ByteArrayOutputStream configArray = IOHelper.newByteArrayOutput()) {
|
||||
try (HOutput configOutput = new HOutput(configArray)) {
|
||||
new LauncherConfig(server.config.netty.address, server.publicKey, runtime)
|
||||
new LauncherConfig(server.config.netty.address, server.publicKey, runtime, server.config.projectName)
|
||||
.write(configOutput);
|
||||
}
|
||||
launcherConfigBytes = configArray.toByteArray();
|
||||
|
|
|
@ -33,7 +33,7 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
|
|||
LauncherEngine.modulesManager = new ClientModuleManager();
|
||||
LauncherConfig.getAutogenConfig().initModules();
|
||||
|
||||
LogHelper.info("Launcher for project %s", config.projectname);
|
||||
LogHelper.info("Launcher for project %s", config.projectName);
|
||||
if (config.environment.equals(LauncherConfig.LauncherEnvironment.PROD)) {
|
||||
if (System.getProperty(LogHelper.DEBUG_PROPERTY) != null) {
|
||||
LogHelper.warning("Found -Dlauncher.debug=true");
|
||||
|
|
|
@ -102,7 +102,7 @@ public static void setUseLegacyDir(boolean b) {
|
|||
}
|
||||
|
||||
static {
|
||||
String projectName = Launcher.getConfig().projectname;
|
||||
String projectName = Launcher.getConfig().projectName;
|
||||
try {
|
||||
DirBridge.dir = getLauncherDir(projectName);
|
||||
if (!IOHelper.exists(DirBridge.dir)) Files.createDirectories(DirBridge.dir);
|
||||
|
|
|
@ -29,7 +29,7 @@ public String getName() {
|
|||
public Path getJavaBinPath() {
|
||||
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) {
|
||||
javaBinPath = ClientLauncher.getJavaBinPath();
|
||||
String projectName = Launcher.getConfig().projectname;
|
||||
String projectName = Launcher.getConfig().projectName;
|
||||
String wrapperUnpackName = (javaBinPath == null ? JVMHelper.JVM_BITS : JVMHelper.OS_BITS) == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe");
|
||||
return DirBridge.getGuardDir().resolve(wrapperUnpackName);
|
||||
} else
|
||||
|
@ -48,7 +48,7 @@ public int getClientJVMBits() {
|
|||
@Override
|
||||
public void init(boolean clientInstance) {
|
||||
try {
|
||||
String projectName = Launcher.getConfig().projectname;
|
||||
String projectName = Launcher.getConfig().projectName;
|
||||
UnpackHelper.unpack(Launcher.getResourceURL("wrapper64.exe", "guard"), DirBridge.getGuardDir().resolve(projectName.concat("64.exe")));
|
||||
UnpackHelper.unpack(Launcher.getResourceURL("AntiInject64.dll", "guard"), DirBridge.getGuardDir().resolve("AntiInject64.dll"));
|
||||
|
||||
|
@ -73,14 +73,9 @@ public void addCustomEnv(ClientLauncherContext context) {
|
|||
env.put("JAVA_HOME", javaBinPath.toAbsolutePath().toString());
|
||||
LauncherConfig config = Launcher.getConfig();
|
||||
env.put("GUARD_USERNAME", context.playerProfile.username);
|
||||
env.put("GUARD_PROJECTNAME", config.projectname);
|
||||
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
|
||||
|
|
|
@ -26,7 +26,7 @@ public String getName() {
|
|||
@Override
|
||||
public Path getJavaBinPath() {
|
||||
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) {
|
||||
String projectName = Launcher.getConfig().projectname;
|
||||
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
|
||||
|
@ -42,7 +42,7 @@ public int getClientJVMBits() {
|
|||
public void init(boolean clientInstance) {
|
||||
try {
|
||||
String wrapperName = JVMHelper.JVM_BITS == 64 ? "wrapper64.exe" : "wrapper32.exe";
|
||||
String projectName = Launcher.getConfig().projectname;
|
||||
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));
|
||||
|
@ -63,14 +63,9 @@ public void addCustomEnv(ClientLauncherContext context) {
|
|||
env.put("JAVA_HOME", System.getProperty("java.home"));
|
||||
LauncherConfig config = Launcher.getConfig();
|
||||
env.put("GUARD_USERNAME", context.playerProfile.username);
|
||||
env.put("GUARD_PROJECTNAME", config.projectname);
|
||||
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
|
||||
|
|
|
@ -7,9 +7,6 @@ public class AutogenConfig {
|
|||
public String guardType;
|
||||
public String secretKeyClient;
|
||||
public String oemUnlockKey;
|
||||
public String guardLicenseName;
|
||||
public String guardLicenseKey;
|
||||
public String guardLicenseEncryptKey;
|
||||
public String secureCheckHash;
|
||||
public String secureCheckSalt;
|
||||
public String passwordEncryptKey;
|
||||
|
|
|
@ -25,7 +25,7 @@ public static AutogenConfig getAutogenConfig() {
|
|||
// Instance
|
||||
public String address;
|
||||
@LauncherAPI
|
||||
public final String projectname;
|
||||
public final String projectName;
|
||||
public final int clientPort;
|
||||
public String secretKeyClient;
|
||||
public String oemUnlockKey;
|
||||
|
@ -39,9 +39,6 @@ public static AutogenConfig getAutogenConfig() {
|
|||
public boolean isNettyEnabled;
|
||||
public LauncherEnvironment environment;
|
||||
|
||||
public final String guardLicenseName;
|
||||
public final String guardLicenseKey;
|
||||
public final String guardLicenseEncryptKey;
|
||||
public final String guardType;
|
||||
|
||||
public final String secureCheckHash;
|
||||
|
@ -54,7 +51,7 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
|||
secureCheckHash = config.secureCheckHash;
|
||||
secureCheckSalt = config.secureCheckSalt;
|
||||
passwordEncryptKey = config.passwordEncryptKey;
|
||||
projectname = config.projectname;
|
||||
projectName = config.projectname;
|
||||
clientPort = config.clientPort;
|
||||
secretKeyClient = config.secretKeyClient;
|
||||
oemUnlockKey = config.oemUnlockKey;
|
||||
|
@ -65,10 +62,7 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
|||
}
|
||||
|
||||
isWarningMissArchJava = config.isWarningMissArchJava;
|
||||
guardLicenseEncryptKey = config.guardLicenseEncryptKey;
|
||||
guardLicenseKey = config.guardLicenseKey;
|
||||
guardType = config.guardType;
|
||||
guardLicenseName = config.guardLicenseName;
|
||||
address = config.address;
|
||||
LauncherEnvironment env;
|
||||
if (config.env == 0) env = LauncherEnvironment.DEV;
|
||||
|
@ -91,34 +85,11 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
|||
}
|
||||
|
||||
@LauncherAPI
|
||||
public LauncherConfig(String address, ECPublicKey publicKey, Map<String, byte[]> runtime, String projectname) {
|
||||
public LauncherConfig(String address, ECPublicKey publicKey, Map<String, byte[]> runtime, String projectName) {
|
||||
this.address = address;
|
||||
this.publicKey = Objects.requireNonNull(publicKey, "publicKey");
|
||||
this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime));
|
||||
this.projectname = projectname;
|
||||
this.clientPort = 32148;
|
||||
this.guardLicenseName = "FREE";
|
||||
this.guardLicenseKey = "AAAA-BBBB-CCCC-DDDD";
|
||||
this.guardLicenseEncryptKey = "12345";
|
||||
guardType = "no";
|
||||
isWarningMissArchJava = true;
|
||||
isNettyEnabled = false;
|
||||
environment = LauncherEnvironment.STD;
|
||||
secureCheckSalt = null;
|
||||
secureCheckHash = null;
|
||||
passwordEncryptKey = null;
|
||||
trustManager = null;
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public LauncherConfig(String address, ECPublicKey publicKey, Map<String, byte[]> runtime) {
|
||||
this.address = address;
|
||||
this.publicKey = Objects.requireNonNull(publicKey, "publicKey");
|
||||
this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime));
|
||||
this.projectname = "Minecraft";
|
||||
this.guardLicenseName = "FREE";
|
||||
this.guardLicenseKey = "AAAA-BBBB-CCCC-DDDD";
|
||||
this.guardLicenseEncryptKey = "12345";
|
||||
this.projectName = projectName;
|
||||
this.clientPort = 32148;
|
||||
guardType = "no";
|
||||
isWarningMissArchJava = true;
|
||||
|
|
Loading…
Reference in a new issue