mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[FIX] public.key больше не требуется для ServerWrapper
This commit is contained in:
parent
085924c831
commit
c0b476a494
3 changed files with 6 additions and 12 deletions
|
@ -87,7 +87,7 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
|||
@LauncherAPI
|
||||
public LauncherConfig(String address, ECPublicKey publicKey, Map<String, byte[]> runtime, String projectName) {
|
||||
this.address = address;
|
||||
this.publicKey = Objects.requireNonNull(publicKey, "publicKey");
|
||||
this.publicKey = publicKey;
|
||||
this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime));
|
||||
this.projectName = projectName;
|
||||
this.clientPort = 32148;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
import java.net.URL;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.interfaces.ECPublicKey;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
@ -190,7 +191,10 @@ public void updateLauncherConfig() {
|
|||
|
||||
LauncherConfig cfg = null;
|
||||
try {
|
||||
cfg = new LauncherConfig(config.address, SecurityHelper.toPublicECKey(IOHelper.read(publicKeyFile)), new HashMap<>(), config.projectname);
|
||||
ECPublicKey publicKey = null;
|
||||
if(IOHelper.isFile(publicKeyFile))
|
||||
publicKey = SecurityHelper.toPublicECKey(IOHelper.read(publicKeyFile));
|
||||
cfg = new LauncherConfig(config.address, publicKey, new HashMap<>(), config.projectname);
|
||||
cfg.isNettyEnabled = true;
|
||||
cfg.address = config.address;
|
||||
} catch (InvalidKeySpecException | IOException e) {
|
||||
|
|
|
@ -46,16 +46,6 @@ public void run() throws IOException {
|
|||
String address = commands.commandHandler.readLine();
|
||||
wrapper.config.mainclass = mainClassName;
|
||||
wrapper.config.address = address;
|
||||
if (!Files.exists(ServerWrapper.publicKeyFile)) {
|
||||
LogHelper.error("public.key not found");
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
System.out.println("Print F to continue:");
|
||||
String printF = commands.commandHandler.readLine();
|
||||
if (printF.equals("stop")) return;
|
||||
if (Files.exists(ServerWrapper.publicKeyFile)) break;
|
||||
else LogHelper.error("public.key not found");
|
||||
}
|
||||
}
|
||||
boolean stopOnError = wrapper.config.stopOnError;
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
System.out.println("Print server account login:");
|
||||
|
|
Loading…
Reference in a new issue