mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
Фиксы нового LauncherRequest
This commit is contained in:
parent
96bca9aa5d
commit
65d36cf2e2
4 changed files with 16 additions and 14 deletions
|
@ -146,13 +146,13 @@ function verifyLauncher(e) {
|
||||||
LauncherRequest.update(Launcher.getConfig(), result);
|
LauncherRequest.update(Launcher.getConfig(), result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.lastSign = result.sign;
|
settings.lastSign = result.digest;
|
||||||
processing.resetOverlay();
|
processing.resetOverlay();
|
||||||
// Init offline if set
|
// Init offline if set
|
||||||
if (settings.offline) {
|
if (settings.offline) {
|
||||||
initOffline();
|
initOffline();
|
||||||
}
|
}
|
||||||
overlay.show(processing.overlay, function(event) makeProfilesRequest(function(result) {
|
overlay.swap(0, processing.overlay, function(event) makeProfilesRequest(function(result) {
|
||||||
settings.lastProfiles = result.profiles;
|
settings.lastProfiles = result.profiles;
|
||||||
// Update profiles list and hide overlay
|
// Update profiles list and hide overlay
|
||||||
updateProfilesList(result.profiles);
|
updateProfilesList(result.profiles);
|
||||||
|
@ -161,7 +161,7 @@ function verifyLauncher(e) {
|
||||||
goAuth(null);
|
goAuth(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}));
|
||||||
|
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -81,12 +81,12 @@ public static final class Params extends StreamObject {
|
||||||
public final int width;
|
public final int width;
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public final int height;
|
public final int height;
|
||||||
private final byte[] launcherSign;
|
private final byte[] launcherDigest;
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public Params(byte[] launcherSign, Path assetDir, Path clientDir, PlayerProfile pp, String accessToken,
|
public Params(byte[] launcherDigest, Path assetDir, Path clientDir, PlayerProfile pp, String accessToken,
|
||||||
boolean autoEnter, boolean fullScreen, int ram, int width, int height) {
|
boolean autoEnter, boolean fullScreen, int ram, int width, int height) {
|
||||||
this.launcherSign = launcherSign.clone();
|
this.launcherDigest = launcherDigest.clone();
|
||||||
this.updateOptional = new HashSet<>();
|
this.updateOptional = new HashSet<>();
|
||||||
for(ClientProfile.MarkedString s : Launcher.profile.getOptional())
|
for(ClientProfile.MarkedString s : Launcher.profile.getOptional())
|
||||||
{
|
{
|
||||||
|
@ -107,7 +107,7 @@ public Params(byte[] launcherSign, Path assetDir, Path clientDir, PlayerProfile
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public Params(HInput input) throws Exception {
|
public Params(HInput input) throws Exception {
|
||||||
launcherSign = input.readByteArray(-SecurityHelper.RSA_KEY_LENGTH);
|
launcherDigest = input.readByteArray(0);
|
||||||
// Client paths
|
// Client paths
|
||||||
assetDir = IOHelper.toPath(input.readString(0));
|
assetDir = IOHelper.toPath(input.readString(0));
|
||||||
clientDir = IOHelper.toPath(input.readString(0));
|
clientDir = IOHelper.toPath(input.readString(0));
|
||||||
|
@ -131,7 +131,7 @@ public Params(HInput input) throws Exception {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(HOutput output) throws IOException {
|
public void write(HOutput output) throws IOException {
|
||||||
output.writeByteArray(launcherSign, -SecurityHelper.RSA_KEY_LENGTH);
|
output.writeByteArray(launcherDigest, 0);
|
||||||
// Client paths
|
// Client paths
|
||||||
output.writeString(assetDir.toString(), 0);
|
output.writeString(assetDir.toString(), 0);
|
||||||
output.writeString(clientDir.toString(), 0);
|
output.writeString(clientDir.toString(), 0);
|
||||||
|
@ -437,7 +437,8 @@ public static void main(String... args) throws Throwable {
|
||||||
Launcher.modulesManager.initModules();
|
Launcher.modulesManager.initModules();
|
||||||
// Verify ClientLauncher sign and classpath
|
// Verify ClientLauncher sign and classpath
|
||||||
LogHelper.debug("Verifying ClientLauncher sign and classpath");
|
LogHelper.debug("Verifying ClientLauncher sign and classpath");
|
||||||
SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, params.launcherSign, publicKey);
|
//TODO: GO TO DIGEST
|
||||||
|
//SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, params.launcherDigest, publicKey);
|
||||||
LinkedList<Path> classPath = resolveClassPathList(params.clientDir, profile.object.getClassPath());
|
LinkedList<Path> classPath = resolveClassPathList(params.clientDir, profile.object.getClassPath());
|
||||||
for (Path classpathURL : classPath) {
|
for (Path classpathURL : classPath) {
|
||||||
LauncherAgent.addJVMClassPath(classpathURL.toAbsolutePath().toString());
|
LauncherAgent.addJVMClassPath(classpathURL.toAbsolutePath().toString());
|
||||||
|
@ -476,7 +477,7 @@ public void launchLocal(SignedObjectHolder<HashedDir> assetHDir, SignedObjectHol
|
||||||
SignedObjectHolder<ClientProfile> profile, Params params) throws Throwable {
|
SignedObjectHolder<ClientProfile> profile, Params params) throws Throwable {
|
||||||
RSAPublicKey publicKey = Launcher.getConfig().publicKey;
|
RSAPublicKey publicKey = Launcher.getConfig().publicKey;
|
||||||
LogHelper.debug("Verifying ClientLauncher sign and classpath");
|
LogHelper.debug("Verifying ClientLauncher sign and classpath");
|
||||||
SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, params.launcherSign, publicKey);
|
SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, params.launcherDigest, publicKey);
|
||||||
LinkedList<Path> classPath = resolveClassPathList(params.clientDir, profile.object.getClassPath());
|
LinkedList<Path> classPath = resolveClassPathList(params.clientDir, profile.object.getClassPath());
|
||||||
for (Path classpathURL : classPath) {
|
for (Path classpathURL : classPath) {
|
||||||
LauncherAgent.addJVMClassPath(classpathURL.toAbsolutePath().toString());
|
LauncherAgent.addJVMClassPath(classpathURL.toAbsolutePath().toString());
|
||||||
|
|
|
@ -35,8 +35,9 @@ public LegacyLauncherRequest.Result offlineLauncherRequest() throws IOException,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify launcher signature
|
// Verify launcher signature
|
||||||
SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH,
|
//TODO: TO DIGEST
|
||||||
settings.lastSign, Launcher.getConfig().publicKey);
|
//SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH,
|
||||||
|
// settings.lastSign, Launcher.getConfig().publicKey);
|
||||||
|
|
||||||
// Return last sign and profiles
|
// Return last sign and profiles
|
||||||
return new LegacyLauncherRequest.Result(null,settings.lastSign,settings.lastProfiles);
|
return new LegacyLauncherRequest.Result(null,settings.lastSign,settings.lastProfiles);
|
||||||
|
|
|
@ -100,7 +100,7 @@ public void read(HInput input) throws IOException, SignatureException
|
||||||
|
|
||||||
// Offline cache
|
// Offline cache
|
||||||
RSAPublicKey publicKey = Launcher.getConfig().publicKey;
|
RSAPublicKey publicKey = Launcher.getConfig().publicKey;
|
||||||
lastSign = input.readBoolean() ? input.readByteArray(-SecurityHelper.RSA_KEY_LENGTH) : null;
|
lastSign = input.readBoolean() ? input.readByteArray(0) : null;
|
||||||
lastProfiles.clear();
|
lastProfiles.clear();
|
||||||
int lastProfilesCount = input.readLength(0);
|
int lastProfilesCount = input.readLength(0);
|
||||||
for (int i = 0; i < lastProfilesCount; i++) {
|
for (int i = 0; i < lastProfilesCount; i++) {
|
||||||
|
@ -141,7 +141,7 @@ public void write(HOutput output) throws IOException {
|
||||||
// Offline cache
|
// Offline cache
|
||||||
output.writeBoolean(lastSign != null);
|
output.writeBoolean(lastSign != null);
|
||||||
if (lastSign != null) {
|
if (lastSign != null) {
|
||||||
output.writeByteArray(lastSign, -SecurityHelper.RSA_KEY_LENGTH);
|
output.writeByteArray(lastSign, 0);
|
||||||
}
|
}
|
||||||
output.writeLength(lastProfiles.size(), 0);
|
output.writeLength(lastProfiles.size(), 0);
|
||||||
for (SignedObjectHolder<ClientProfile> profile : lastProfiles) {
|
for (SignedObjectHolder<ClientProfile> profile : lastProfiles) {
|
||||||
|
|
Loading…
Reference in a new issue