mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
Сохранение сессий лаунчера при старте клиента
This commit is contained in:
parent
0c9bb41bee
commit
ece52dd025
2 changed files with 16 additions and 1 deletions
|
@ -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");
|
||||
|
|
|
@ -13,7 +13,15 @@
|
|||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public abstract class Request<R> {
|
||||
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 {
|
||||
|
|
Loading…
Reference in a new issue