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 e597a3e3..dea50c57 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java @@ -9,6 +9,7 @@ import ru.gravit.launcher.hasher.HashedDir; import ru.gravit.launcher.profiles.ClientProfile; import ru.gravit.launcher.profiles.PlayerProfile; +import ru.gravit.launcher.request.Request; import ru.gravit.launcher.request.update.LegacyLauncherRequest; import ru.gravit.launcher.serialize.HInput; import ru.gravit.launcher.serialize.HOutput; @@ -80,6 +81,8 @@ public static final class Params extends StreamObject { @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, @@ -100,11 +103,13 @@ public Params(byte[] launcherDigest, Path assetDir, Path clientDir, PlayerProfil this.ram = ram; this.width = width; this.height = height; + this.session = Request.getSession(); } @LauncherAPI public Params(HInput input) throws Exception { launcherDigest = input.readByteArray(0); + session = input.readLong(); // Client paths assetDir = IOHelper.toPath(input.readString(0)); clientDir = IOHelper.toPath(input.readString(0)); @@ -128,6 +133,7 @@ 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); output.writeString(clientDir.toString(), 0); @@ -443,6 +449,7 @@ public static void main(String... args) throws Throwable { return; } Launcher.profile = profile; + Request.setSession(params.session); Launcher.modulesManager.initModules(); // Verify ClientLauncher sign and classpath LogHelper.debug("Verifying ClientLauncher sign and classpath"); diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/Request.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/Request.java index 405235d4..b184fc5e 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/Request.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/Request.java @@ -13,7 +13,15 @@ import java.util.concurrent.atomic.AtomicBoolean; public abstract class Request { - private static final long session = SecurityHelper.secureRandom.nextLong(); + private static long session = SecurityHelper.secureRandom.nextLong(); + + public static void setSession(long session) { + Request.session = session; + } + public static long getSession() + { + return Request.session; + } @LauncherAPI public static void requestError(String message) throws RequestException {