mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +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);
|
||||
return;
|
||||
}
|
||||
settings.lastSign = result.sign;
|
||||
settings.lastSign = result.digest;
|
||||
processing.resetOverlay();
|
||||
// Init offline if set
|
||||
if (settings.offline) {
|
||||
initOffline();
|
||||
}
|
||||
overlay.show(processing.overlay, function(event) makeProfilesRequest(function(result) {
|
||||
overlay.swap(0, processing.overlay, function(event) makeProfilesRequest(function(result) {
|
||||
settings.lastProfiles = result.profiles;
|
||||
// Update profiles list and hide overlay
|
||||
updateProfilesList(result.profiles);
|
||||
|
@ -161,7 +161,7 @@ function verifyLauncher(e) {
|
|||
goAuth(null);
|
||||
}
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
}));
|
||||
|
|
|
@ -81,12 +81,12 @@ public static final class Params extends StreamObject {
|
|||
public final int width;
|
||||
@LauncherAPI
|
||||
public final int height;
|
||||
private final byte[] launcherSign;
|
||||
private final byte[] launcherDigest;
|
||||
|
||||
@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) {
|
||||
this.launcherSign = launcherSign.clone();
|
||||
this.launcherDigest = launcherDigest.clone();
|
||||
this.updateOptional = new HashSet<>();
|
||||
for(ClientProfile.MarkedString s : Launcher.profile.getOptional())
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ public Params(byte[] launcherSign, Path assetDir, Path clientDir, PlayerProfile
|
|||
|
||||
@LauncherAPI
|
||||
public Params(HInput input) throws Exception {
|
||||
launcherSign = input.readByteArray(-SecurityHelper.RSA_KEY_LENGTH);
|
||||
launcherDigest = input.readByteArray(0);
|
||||
// Client paths
|
||||
assetDir = IOHelper.toPath(input.readString(0));
|
||||
clientDir = IOHelper.toPath(input.readString(0));
|
||||
|
@ -131,7 +131,7 @@ public Params(HInput input) throws Exception {
|
|||
|
||||
@Override
|
||||
public void write(HOutput output) throws IOException {
|
||||
output.writeByteArray(launcherSign, -SecurityHelper.RSA_KEY_LENGTH);
|
||||
output.writeByteArray(launcherDigest, 0);
|
||||
// Client paths
|
||||
output.writeString(assetDir.toString(), 0);
|
||||
output.writeString(clientDir.toString(), 0);
|
||||
|
@ -437,7 +437,8 @@ public static void main(String... args) throws Throwable {
|
|||
Launcher.modulesManager.initModules();
|
||||
// Verify 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());
|
||||
for (Path classpathURL : classPath) {
|
||||
LauncherAgent.addJVMClassPath(classpathURL.toAbsolutePath().toString());
|
||||
|
@ -476,7 +477,7 @@ public void launchLocal(SignedObjectHolder<HashedDir> assetHDir, SignedObjectHol
|
|||
SignedObjectHolder<ClientProfile> profile, Params params) throws Throwable {
|
||||
RSAPublicKey publicKey = Launcher.getConfig().publicKey;
|
||||
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());
|
||||
for (Path classpathURL : classPath) {
|
||||
LauncherAgent.addJVMClassPath(classpathURL.toAbsolutePath().toString());
|
||||
|
|
|
@ -35,8 +35,9 @@ public LegacyLauncherRequest.Result offlineLauncherRequest() throws IOException,
|
|||
}
|
||||
|
||||
// Verify launcher signature
|
||||
SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH,
|
||||
settings.lastSign, Launcher.getConfig().publicKey);
|
||||
//TODO: TO DIGEST
|
||||
//SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH,
|
||||
// settings.lastSign, Launcher.getConfig().publicKey);
|
||||
|
||||
// Return last sign and profiles
|
||||
return new LegacyLauncherRequest.Result(null,settings.lastSign,settings.lastProfiles);
|
||||
|
|
|
@ -100,7 +100,7 @@ public void read(HInput input) throws IOException, SignatureException
|
|||
|
||||
// Offline cache
|
||||
RSAPublicKey publicKey = Launcher.getConfig().publicKey;
|
||||
lastSign = input.readBoolean() ? input.readByteArray(-SecurityHelper.RSA_KEY_LENGTH) : null;
|
||||
lastSign = input.readBoolean() ? input.readByteArray(0) : null;
|
||||
lastProfiles.clear();
|
||||
int lastProfilesCount = input.readLength(0);
|
||||
for (int i = 0; i < lastProfilesCount; i++) {
|
||||
|
@ -141,7 +141,7 @@ public void write(HOutput output) throws IOException {
|
|||
// Offline cache
|
||||
output.writeBoolean(lastSign != null);
|
||||
if (lastSign != null) {
|
||||
output.writeByteArray(lastSign, -SecurityHelper.RSA_KEY_LENGTH);
|
||||
output.writeByteArray(lastSign, 0);
|
||||
}
|
||||
output.writeLength(lastProfiles.size(), 0);
|
||||
for (SignedObjectHolder<ClientProfile> profile : lastProfiles) {
|
||||
|
|
Loading…
Reference in a new issue