Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reading tsscheckerLog #66

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/main/java/com/airsquared/blobsaver/Background.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ private static void saveBackgroundBlobs(int preset) {
if (!"".equals(apnonce)) {
Collections.addAll(args, "--apnonce", apnonce);
}
tsscheckerLog = executeProgram(args.toArray(new String[0]));
tsscheckerLog = executeProgram(args.toArray(new String[0]))
.replaceAll(NON_PRINTABLE_NON_WHITESPACE, "");
} catch (IOException e) {
Notification notification = new Notification("Saving blobs failed", "There was an error starting tsschecker. Click here to report this error.", Notification.ERROR_ICON);
Notification.Notifier.INSTANCE.setPopupLifetime(Duration.minutes(1));
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/airsquared/blobsaver/Shared.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ class Shared {
static ButtonType redditPM = new ButtonType("PM on Reddit");
static ButtonType githubIssue = new ButtonType("Create Issue on Github");

// to remove weird symbols from tsscheckerLog output
// Otherwise, pasting the output in some applications (like Sublime Text) won't work
public static final String NON_PRINTABLE_NON_WHITESPACE = "[^\\p{Print}\n\r]+";

static String textToIdentifier(String deviceModel) {
String toReturn = Devices.getDeviceModelIdentifiersMap().getOrDefault(deviceModel, "");
if ("".equals(toReturn)) { // this will never happen in background
Expand Down
19 changes: 12 additions & 7 deletions src/main/java/com/airsquared/blobsaver/TSSChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,16 @@ private static void run(String device, String version) {
String tsscheckerLog;
try {
System.out.println("Running: " + args.toString());
tsscheckerLog = executeProgram(args.toArray(new String[0]));
System.out.println(tsscheckerLog);
tsscheckerLog = executeProgram(args.toArray(new String[0]))
.replaceAll(NON_PRINTABLE_NON_WHITESPACE, "");
} catch (IOException e) {
newReportableError("There was an error starting tsschecker.", e.toString());
e.printStackTrace();
deleteTempFiles(buildManifestPlist);
return;
}

if (containsIgnoreCase(tsscheckerLog, "Saved signing tickets")) {
if (containsIgnoreCase(tsscheckerLog, "Saved")) {
// 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 @@ -177,7 +177,7 @@ private static void run(String device, String version) {
resizeAlertButtons(alert);
alert.showAndWait();
reportError(alert);
} else if (containsIgnoreCase(tsscheckerLog, "[Error] [TSSC] ERROR: could not get url for device " + device + " on iOS " + version)) {
} else if (containsIgnoreCase(tsscheckerLog, "[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);
Expand All @@ -186,7 +186,8 @@ private static void run(String device, String version) {
controller.apnonceField.setEffect(errorBorder);
} 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] [TSSR] faild to build tssrequest")
|| containsIgnoreCase(tsscheckerLog, "[Error] [TSSR] faild to build TSS request")) //switched tssrequest -> TSS request in the latest version
&& 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.",
Expand All @@ -201,10 +202,14 @@ && containsIgnoreCase(tsscheckerLog, "Error] [TSSC] checking tss status failed!"
resizeAlertButtons(alert);
alert.showAndWait();
reportError(alert, tsscheckerLog);
} else if (containsIgnoreCase(tsscheckerLog, "[Error] [Error] can't save signing tickets at " + savePath)) {
}

//it can be "can't save signing tickets at [location]" or "can't save shsh blobs at [location]".
// This is the only place where the output "can't save" is present in tsschecker
else if (containsIgnoreCase(tsscheckerLog, "[Error] can't save")) {
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 (containsIgnoreCase(tsscheckerLog, "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!") || containsIgnoreCase(tsscheckerLog, "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 Down