diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/update/UpdateResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/update/UpdateResponse.java index e24e3eac..890b2a6e 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/update/UpdateResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/update/UpdateResponse.java @@ -10,7 +10,7 @@ import ru.gravit.launchserver.socket.websocket.json.JsonResponseInterface; public class UpdateResponse implements JsonResponseInterface { - public String dir; + public String dirName; @Override public String getType() { @@ -32,6 +32,6 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client } } } - service.sendObject(ctx, new UpdateRequestEvent(LaunchServer.server.updatesDirMap.get(dir).object, LaunchServer.server.config.netty.downloadURL.concat(dir))); + service.sendObject(ctx, new UpdateRequestEvent(LaunchServer.server.updatesDirMap.get(dirName).object, LaunchServer.server.config.netty.downloadURL.replace("%dirname%",dirName))); } } diff --git a/LaunchServerConsole/src/main/java/ru/gravit/launchserver/console/ConsoleMain.java b/LaunchServerConsole/src/main/java/ru/gravit/launchserver/console/ConsoleMain.java index 751766cc..96d8079e 100644 --- a/LaunchServerConsole/src/main/java/ru/gravit/launchserver/console/ConsoleMain.java +++ b/LaunchServerConsole/src/main/java/ru/gravit/launchserver/console/ConsoleMain.java @@ -10,7 +10,7 @@ public class ConsoleMain { public static CommandHandler commandHandler; public static void main(String[] args) throws IOException { - if (ServerWrapper.wrapper.config == null) { + if (ServerWrapper.wrapper.config == null) { LogHelper.warning("ServerWrapper not found"); } if (!ServerWrapper.wrapper.permissions.canAdmin) { diff --git a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java index a1a1972a..aeded6fd 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java @@ -76,14 +76,12 @@ public static final class Params extends StreamObject { public final int width; @LauncherAPI public final int height; - private final byte[] launcherDigest; @LauncherAPI public final long session; @LauncherAPI public Params(byte[] launcherDigest, Path assetDir, Path clientDir, PlayerProfile pp, String accessToken, boolean autoEnter, boolean fullScreen, int ram, int width, int height) { - this.launcherDigest = launcherDigest.clone(); // Client paths this.assetDir = assetDir; this.clientDir = clientDir; @@ -100,7 +98,6 @@ public Params(byte[] launcherDigest, Path assetDir, Path clientDir, PlayerProfil @LauncherAPI public Params(HInput input) throws Exception { - launcherDigest = input.readByteArray(0); session = input.readLong(); // Client paths assetDir = IOHelper.toPath(input.readString(0)); @@ -119,7 +116,6 @@ public Params(HInput input) throws Exception { @Override public void write(HOutput output) throws IOException { - output.writeByteArray(launcherDigest, 0); output.writeLong(session); // Client paths output.writeString(assetDir.toString(), 0); @@ -454,7 +450,6 @@ public static void main(String... args) throws Throwable { // Verify ClientLauncher sign and classpath LogHelper.debug("Verifying ClientLauncher sign and classpath"); //Warning - experimental. - SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, params.launcherDigest, Launcher.getConfig().publicKey); LinkedList classPath = resolveClassPathList(params.clientDir, profile.getClassPath()); for (Path classpathURL : classPath) { LauncherAgent.addJVMClassPath(classpathURL.toAbsolutePath().toString()); 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 0071f231..21d57482 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/downloader/ListDownloader.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/downloader/ListDownloader.java @@ -8,6 +8,7 @@ import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.LaxRedirectStrategy; import ru.gravit.utils.helper.IOHelper; +import ru.gravit.utils.helper.LogHelper; import java.io.IOException; import java.io.InputStream; @@ -26,6 +27,7 @@ public void download(String base, List applies, Path dstDirFile) throws HttpGet get = null; for (String apply : applies) { URI u = new URL(base.concat(apply)).toURI(); + LogHelper.debug("Download URL: %s", u.toString()); if (get == null) get = new HttpGet(u); else { get.reset(); 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 36bc18d2..ea1cfabf 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 @@ -20,6 +20,7 @@ import ru.gravit.launcher.serialize.SerializeLimits; import ru.gravit.launcher.serialize.signed.SignedObjectHolder; import ru.gravit.utils.helper.IOHelper; +import ru.gravit.utils.helper.LogHelper; import ru.gravit.utils.helper.SecurityHelper; import ru.gravit.utils.helper.SecurityHelper.DigestAlgorithm; @@ -199,7 +200,9 @@ private static void fillActionsQueue(Queue queue, HashedDir mismat @Override public UpdateRequestEvent requestWebSockets() throws Exception { + LogHelper.debug("Start update request"); UpdateRequestEvent e = (UpdateRequestEvent) LegacyRequestBridge.sendRequest(this); + LogHelper.debug("Start update"); Launcher.profile.pushOptionalFile(e.hdir, !Launcher.profile.isUpdateFastCheck()); HashedDir.Diff diff = e.hdir.diff(localDir, matcher); final List adds = new ArrayList<>(); @@ -207,26 +210,29 @@ public UpdateRequestEvent requestWebSockets() throws Exception { adds.add(a.getKey()); }); totalSize = diff.mismatch.size(); + startTime = Instant.now(); + updateState("UnknownFile", 0L, 100); ListDownloader listDownloader = new ListDownloader(); listDownloader.download(e.url, adds, dir); deleteExtraDir(dir, diff.extra, diff.extra.flag); + LogHelper.debug("Update success"); return e; } // Instance private final String dirName; - private final Path dir; - private final FileNameMatcher matcher; + private transient final Path dir; + private transient final FileNameMatcher matcher; - private final boolean digest; - private volatile Callback stateCallback; + private transient final boolean digest; + private transient volatile Callback stateCallback; // State - private HashedDir localDir; - private long totalDownloaded; + private transient HashedDir localDir; + private transient long totalDownloaded; - private long totalSize; + private transient long totalSize; - private Instant startTime; + private transient Instant startTime; @LauncherAPI public UpdateRequest(LauncherConfig config, String dirName, Path dir, FileNameMatcher matcher, boolean digest) {