Update #30 - Fixed various client bugs

This commit is contained in:
lax1dude
2024-05-18 23:17:29 -07:00
parent 32fda35ace
commit c6ac781036
50 changed files with 798 additions and 446 deletions

View File

@ -64,7 +64,7 @@ public class RelayUpdateChecker {
for(net.lax1dude.eaglercraft.v1_8.sp.relay.RelayEntry etr : EagRuntime.getConfiguration().getRelays()) {
relaysList.add(new RelayEntry(etr.address));
}
byte[] b = PlatformApplication.getLocalStorage("lastRelayUpdate");
byte[] b = PlatformApplication.getLocalStorage("lastRelayUpdate", false);
if(b != null) {
try {
lastUpdateCheck = (new DataInputStream(new EaglerInputStream(b))).readLong();
@ -79,7 +79,7 @@ public class RelayUpdateChecker {
try {
EaglerOutputStream bao = new EaglerOutputStream(8);
(new DataOutputStream(bao)).writeLong(lastUpdateCheck);
PlatformApplication.setLocalStorage("lastRelayUpdate", bao.toByteArray());
PlatformApplication.setLocalStorage("lastRelayUpdate", bao.toByteArray(), false);
} catch (IOException e) {
}
for (int i = 0, l = relaysList.size(); i < l; ++i) {

View File

@ -148,7 +148,16 @@ public class UpdateCertificate {
throw new CertificateInvalidException("SHA256 checksum of signature payload is invalid!");
}
return new UpdateCertificate(certData, EaglerZLIB.newGZIPInputStream(new EaglerInputStream(signaturePayload)), vers);
UpdateCertificate cert;
try(InputStream gis = EaglerZLIB.newGZIPInputStream(new EaglerInputStream(signaturePayload))) {
cert = new UpdateCertificate(certData, gis, vers);
}
if(System.currentTimeMillis() < cert.sigTimestamp) {
throw new CertificateInvalidException("Update certificate timestamp is from the future!?");
}
return cert;
}
private UpdateCertificate(byte[] certData, InputStream is, int sigVers) throws IOException {

View File

@ -94,7 +94,7 @@ public class UpdateService {
}
}
}
byte[] latestUpdate = PlatformApplication.getLocalStorage(EaglercraftVersion.updateLatestLocalStorageKey);
byte[] latestUpdate = PlatformApplication.getLocalStorage(EaglercraftVersion.updateLatestLocalStorageKey, false);
if(latestUpdate != null) {
addCertificateToSet(latestUpdate, false);
}
@ -150,7 +150,7 @@ public class UpdateService {
latestUpdateFound = cert;
if (saveLatest) {
PlatformApplication.setLocalStorage(EaglercraftVersion.updateLatestLocalStorageKey,
certificateData);
certificateData, false);
}
}
}else if(EagRuntime.getConfiguration().isLogInvalidCerts()) {