Skip to content

Commit

Permalink
Fix reading tsschecker output, update tsschecker executable if alread…
Browse files Browse the repository at this point in the history
…y in .blobsaver_bin
  • Loading branch information
airsquared committed Mar 24, 2019
1 parent 604efc3 commit 725fcf7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/airsquared/blobsaver/Shared.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static String makeRequest(URL url) throws IOException {
static File getTsschecker() throws IOException {
File executablesFolder = getExecutablesFolder();
File tsschecker = new File(executablesFolder, "tsschecker");
if (tsschecker.exists() && appPrefs.getBoolean("tsschecker last update v2.2.3", false)) {
if (tsschecker.exists() && appPrefs.getBoolean("tsschecker last update v2.3.1", false)) {
return tsschecker;
} else {
if (tsschecker.exists()) {
Expand Down
31 changes: 16 additions & 15 deletions src/main/java/com/airsquared/blobsaver/TSSChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,15 @@ private static void run(String device, String version) {
try {
System.out.println("Running: " + args.toString());
tsscheckerLog = executeProgram(args.toArray(new String[0]));
System.out.println(tsscheckerLog);
} catch (IOException e) {
newReportableError("There was an error starting tsschecker.", e.toString());
e.printStackTrace();
deleteTempFiles(buildManifestPlist);
return;
}

if (tsscheckerLog.contains("Saved shsh blobs")) {
if (containsIgnoreCase(tsscheckerLog, "Saved signing tickets")) {
// if multiple versions are being saved at the same time, do not show success message multiple times
// the success message will be shown after saving everything is completed
if (!controller.versionCheckBox.isSelected()) {
Expand All @@ -167,43 +168,43 @@ private static void run(String device, String version) {
}
deleteTempFiles(buildManifestPlist);
return;
} else if (tsscheckerLog.contains("[Error] [TSSC] manually specified ecid=" + ecid + ", but parsing failed")) {
} else if (containsIgnoreCase(tsscheckerLog, "[Error] [TSSC] manually specified ecid=" + ecid + ", but parsing failed")) {
newUnreportableError("\"" + ecid + "\"" + " is not a valid ECID. Try getting it from iTunes.\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again.");
controller.ecidField.setEffect(errorBorder);
} else if (tsscheckerLog.contains("[Error] [TSSC] device " + device + " could not be found in devicelist")) {
} else if (containsIgnoreCase(tsscheckerLog, "[Error] [TSSC] device " + device + " could not be found in devicelist")) {
Alert alert = new Alert(Alert.AlertType.ERROR, "tsschecker could not find device: \"" + device +
"\"\n\nPlease create a new Github issue or PM me on Reddit if you used the dropdown menu.\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again.", githubIssue, redditPM, ButtonType.CANCEL);
resizeAlertButtons(alert);
alert.showAndWait();
reportError(alert);
} else if (tsscheckerLog.contains("[Error] [TSSC] ERROR: could not get url for device " + device + " on iOS " + version)) {
} else if (containsIgnoreCase(tsscheckerLog, "[Error] [TSSC] ERROR: could not get url for device " + device + " on iOS " + version)) {
newUnreportableError("Could not find device \"" + device + "\" on iOS/tvOS " + version +
"\n\nThe version doesn't exist or isn't compatible with the device");
controller.versionField.setEffect(errorBorder);
} else if (tsscheckerLog.contains("[Error] [TSSC] manually specified apnonce=" + apnonce + ", but parsing failed")) {
} else if (containsIgnoreCase(tsscheckerLog, "[Error] [TSSC] manually specified apnonce=" + apnonce + ", but parsing failed")) {
newUnreportableError("\"" + apnonce + "\" is not a valid apnonce");
controller.apnonceField.setEffect(errorBorder);
} else if (tsscheckerLog.contains("[WARNING] [TSSC] could not get id0 for installType=Erase. Using fallback installType=Update since user did not specify installType manually")
&& tsscheckerLog.contains("[Error] [TSSR] Error: could not get id0 for installType=Update")
&& tsscheckerLog.contains("[Error] [TSSR] faild to build tssrequest")
&& tsscheckerLog.contains("Error] [TSSC] checking tss status failed!")) {
} else if (containsIgnoreCase(tsscheckerLog, "[WARNING] [TSSC] could not get id0 for installType=Erase. Using fallback installType=Update since user did not specify installType manually")
&& containsIgnoreCase(tsscheckerLog, "[Error] [TSSR] Error: could not get id0 for installType=Update")
&& containsIgnoreCase(tsscheckerLog, "[Error] [TSSR] faild to build TSS request")
&& containsIgnoreCase(tsscheckerLog, "Error] [TSSC] checking tss status failed!")) {
Alert alert = new Alert(Alert.AlertType.ERROR,
"Saving blobs failed. Check the board configuration or try again later.\n\nIf this doesn't work, please create a new issue on Github or PM me on Reddit. The log has been copied to your clipboard.\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again.",
githubIssue, redditPM, ButtonType.OK);
resizeAlertButtons(alert);
alert.showAndWait();
reportError(alert, tsscheckerLog);
} else if (tsscheckerLog.contains("[Error] ERROR: TSS request failed: Could not resolve host:")) {
} else if (containsIgnoreCase(tsscheckerLog, "[Error] ERROR: TSS request failed: Could not resolve host:")) {
Alert alert = new Alert(Alert.AlertType.ERROR,
"Saving blobs failed. Check your internet connection.\n\nIf your internet is working and you can connect to apple.com in your browser, please create a new issue on Github or PM me on Reddit. The log has been copied to your clipboard.\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again.",
githubIssue, redditPM, ButtonType.OK);
resizeAlertButtons(alert);
alert.showAndWait();
reportError(alert, tsscheckerLog);
} else if (tsscheckerLog.contains("[Error] [Error] can't save shsh at " + savePath)) {
} else if (containsIgnoreCase(tsscheckerLog, "[Error] [Error] can't save signing tickets at " + savePath)) {
newUnreportableError("\'" + savePath + "\' is not a valid path\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again.");
controller.pathField.setEffect(errorBorder);
} else if (tsscheckerLog.contains("iOS " + version + " for device " + device + " IS NOT being signed!") || tsscheckerLog.contains("Build " + controller.buildIDField.getText() + " for device" + device + "IS NOT being signed!")) {
} else if (containsIgnoreCase(tsscheckerLog, "iOS " + version + " for device " + device + " IS NOT being signed!") || tsscheckerLog.contains("Build " + controller.buildIDField.getText() + " for device" + device + "IS NOT being signed!")) {
newUnreportableError("iOS/tvOS " + version + " is not being signed for device " + device);
if (version.equals(controller.versionField.getText())) {
controller.versionField.setEffect(errorBorder);
Expand All @@ -212,16 +213,16 @@ private static void run(String device, String version) {
controller.buildIDField.setEffect(errorBorder);
controller.ipswField.setEffect(errorBorder);
}
} else if (tsscheckerLog.contains("[Error] [TSSC] failed to load manifest")) {
} else if (containsIgnoreCase(tsscheckerLog, "[Error] [TSSC] failed to load manifest")) {
Alert alert = new Alert(Alert.AlertType.ERROR,
"Failed to load manifest.\n\n \"" + ipswURL + "\" might not be a valid URL.\n\nMake sure it starts with \"http://\" or \"https://\", has \"apple\" in it, and ends with \".ipsw\"\n\nIf the URL is fine, please create a new issue on Github or PM me on Reddit. The log has been copied to your clipboard",
githubIssue, redditPM, ButtonType.OK);
resizeAlertButtons(alert);
alert.showAndWait();
reportError(alert, tsscheckerLog);
} else if (tsscheckerLog.contains("[Error] [TSSC] selected device can't be used with that buildmanifest")) {
} else if (containsIgnoreCase(tsscheckerLog, "[Error] [TSSC] selected device can't be used with that buildmanifest")) {
newUnreportableError("Device and build manifest don't match.");
} else if (tsscheckerLog.contains("[Error]")) {
} else if (containsIgnoreCase(tsscheckerLog, "[Error]")) {
newReportableError("Saving blobs failed.\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again.", tsscheckerLog);
} else {
newReportableError("Unknown result.\n\nIf this was done to test whether the preset works in the background, please cancel that preset, fix the error, and try again.", tsscheckerLog);
Expand Down

0 comments on commit 725fcf7

Please sign in to comment.