From ae2fafaa9ee1cb8d5aa05e6034507c20490cf70d Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 12 May 2022 15:52:49 -0700 Subject: [PATCH 01/13] Fixes authenticating Apple IDs with capital letters Also fixes repeatedly asking some users to sign in with Apple ID. --- Dependencies/AltSign | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/AltSign b/Dependencies/AltSign index b1116d5d..0e091011 160000 --- a/Dependencies/AltSign +++ b/Dependencies/AltSign @@ -1 +1 @@ -Subproject commit b1116d5dc631e95dc51a512c8262f3a669bceb3a +Subproject commit 0e091011167c7635372f65e0761ac9010da0d79a From c91c5dce8c047d45f8da080fb758a11e36bb08ea Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Mon, 16 May 2022 16:12:52 -0700 Subject: [PATCH 02/13] Supports 2FA Apple IDs with no trusted devices Falls back to sending 2FA code via SMS if there are no registered trusted devices. --- Dependencies/AltSign | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/AltSign b/Dependencies/AltSign index 0e091011..557d3733 160000 --- a/Dependencies/AltSign +++ b/Dependencies/AltSign @@ -1 +1 @@ -Subproject commit 0e091011167c7635372f65e0761ac9010da0d79a +Subproject commit 557d3733b85e51cc5eae4e24a66a5a0a6991468c From 7b973ac447f8cf740eda8817fde8cdb71cd3b6e4 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 25 May 2022 14:59:12 -0700 Subject: [PATCH 03/13] [AltServer] Fixes NetworkConnection strong reference cycle WirelessConnection.nwConnection.stateUpdateHandler maintains strong reference to WirelessConnection, resulting in strong reference cycle. To break it, we now explicitly set stateUpdateHandler to nil when disconnecting. --- AltServer/Connections/WirelessConnectionHandler.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AltServer/Connections/WirelessConnectionHandler.swift b/AltServer/Connections/WirelessConnectionHandler.swift index 9efb1d23..1db96c54 100644 --- a/AltServer/Connections/WirelessConnectionHandler.swift +++ b/AltServer/Connections/WirelessConnectionHandler.swift @@ -144,5 +144,10 @@ private extension WirelessConnectionHandler connection.disconnect() self.disconnectionHandler?(connection) + + if let networkConnection = connection as? NetworkConnection + { + networkConnection.nwConnection.stateUpdateHandler = nil + } } } From d3a8a89023407fe434e75a00b613387961355972 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 25 May 2022 15:07:38 -0700 Subject: [PATCH 04/13] =?UTF-8?q?[AltServer]=20Fixes=20disconnecting=20ALT?= =?UTF-8?q?WiredConnection=E2=80=99s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ALTWiredConnection.disconnect() doesn’t do anything if ALTWiredConnection.isConnected == NO. The problem is, we never set .isConnected to YES in the first place…which means disconnect() never actually did anything. Whoops. --- AltServer/Connections/ALTWiredConnection.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AltServer/Connections/ALTWiredConnection.mm b/AltServer/Connections/ALTWiredConnection.mm index aa674063..6ad1f3f8 100644 --- a/AltServer/Connections/ALTWiredConnection.mm +++ b/AltServer/Connections/ALTWiredConnection.mm @@ -20,6 +20,8 @@ { _device = [device copy]; _connection = connection; + + self.connected = YES; } return self; From 7bf813e7ecd3543a78b8595c3ce49d0cf7f40cd6 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 25 May 2022 15:17:58 -0700 Subject: [PATCH 05/13] [AltServer] Fixes installing AltPlugin after uninstalling it Bundle(url:) is cached, so even if AltPlugin is deleted Bundle(url:) will still return a non-nil value. Instead, we now directly check whether a directory exists at pluginURL to determine if AltPlugin is installed. --- AltServer/Plugin/PluginManager.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AltServer/Plugin/PluginManager.swift b/AltServer/Plugin/PluginManager.swift index bb0d99e4..fb2e9c09 100644 --- a/AltServer/Plugin/PluginManager.swift +++ b/AltServer/Plugin/PluginManager.swift @@ -66,10 +66,11 @@ class PluginManager do { // If Mail plug-in is not yet installed, then there is no update available. - guard let bundle = Bundle(url: pluginURL) else { return completionHandler(.success(false)) } + var isDirectory: ObjCBool = false + guard FileManager.default.fileExists(atPath: pluginURL.path, isDirectory: &isDirectory), isDirectory.boolValue else { return completionHandler(.success(false)) } // Load Info.plist from disk because Bundle.infoDictionary is cached by system. - let infoDictionaryURL = bundle.bundleURL.appendingPathComponent("Contents/Info.plist") + let infoDictionaryURL = pluginURL.appendingPathComponent("Contents/Info.plist") guard let infoDictionary = NSDictionary(contentsOf: infoDictionaryURL) as? [String: Any], let localVersion = infoDictionary["CFBundleShortVersionString"] as? String else { throw CocoaError(.fileReadCorruptFile, userInfo: [NSURLErrorKey: infoDictionaryURL]) } From 2244de0faf67b06373f47d574f81440516b3a824 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 25 May 2022 15:31:04 -0700 Subject: [PATCH 06/13] =?UTF-8?q?Fixes=20crash=20when=20presenting=20unrec?= =?UTF-8?q?ognized=20ALTServerError=E2=80=99s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Shared/Categories/NSError+ALTServerError.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Shared/Categories/NSError+ALTServerError.m b/Shared/Categories/NSError+ALTServerError.m index e22881d5..534bca30 100644 --- a/Shared/Categories/NSError+ALTServerError.m +++ b/Shared/Categories/NSError+ALTServerError.m @@ -145,6 +145,8 @@ NSErrorUserInfoKey const ALTOperatingSystemVersionErrorKey = @"ALTOperatingSyste return failureReason; } } + + return nil; } - (nullable NSString *)altserver_localizedRecoverySuggestion From 93d9645adc93c928020a563bc4120fb2c97566b2 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 25 May 2022 15:57:17 -0700 Subject: [PATCH 07/13] =?UTF-8?q?[AltServer]=20Fixes=20incorrect=20?= =?UTF-8?q?=E2=80=9CDeveloper=20Disk=20incompatible=20with=20[OS=20version?= =?UTF-8?q?]=E2=80=9D=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously we assumed that if there was an error installing the developer disk, it was incompatible with the device’s iOS version. Howevever, sometimes an iOS device needs to be rebooted before it can successfully mount a developer disk. We now explicitly check for the latter scenario, and present a different error message asking the user to reboot their device if that’s the case. --- AltServer/Devices/ALTDeviceManager.mm | 55 ++++++++++++++++++--------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/AltServer/Devices/ALTDeviceManager.mm b/AltServer/Devices/ALTDeviceManager.mm index ef6bedc7..a7d6aff7 100644 --- a/AltServer/Devices/ALTDeviceManager.mm +++ b/AltServer/Devices/ALTDeviceManager.mm @@ -1198,29 +1198,36 @@ NSNotificationName const ALTDeviceManagerDeviceDidDisconnectNotification = @"ALT { return finish([NSError errorWithMobileImageMounterError:err device:altDevice]); } - - if (result) + + plist_t errorDescriptionNode = plist_dict_get_item(result, "DetailedError"); + if (errorDescriptionNode != NULL) { - plist_free(result); - } - - // Verify the installed developer disk is compatible with altDevice's operating system version. - ALTDebugConnection *testConnection = [[ALTDebugConnection alloc] initWithDevice:altDevice]; - [testConnection connectWithCompletionHandler:^(BOOL success, NSError * _Nullable error) { - [testConnection disconnect]; + char *errorDescription = NULL; + plist_get_string_val(errorDescriptionNode, &errorDescription); - if (success) + NSString *nsErrorDescription = @(errorDescription); + plist_free(result); + + NSError *returnError = nil; + + if ([nsErrorDescription containsString:@"Failed to verify"]) { - // Connection succeeded, so we assume the developer disk is compatible. - finish(nil); + // iOS device needs to be rebooted in order to mount disk to /Developer. + NSString *recoverySuggestion = [NSString stringWithFormat:NSLocalizedString(@"Please reboot %@ and try again.", @""), altDevice.name]; + + // ALTServerErrorUnderlyingError uses its underlying error's failure reason as its error description (if one exists), + // so assign our recovery suggestion to NSLocalizedFailureReasonErrorKey to make sure it's always displayed on client. + NSError *underlyingError = [NSError errorWithDomain:AltServerConnectionErrorDomain code:ALTServerConnectionErrorUnknown userInfo:@{NSLocalizedFailureReasonErrorKey: recoverySuggestion}]; + + returnError = [NSError errorWithDomain:AltServerErrorDomain code:ALTServerErrorUnderlyingError userInfo:@{NSUnderlyingErrorKey: underlyingError}]; } - else if ([error.domain isEqualToString:AltServerConnectionErrorDomain] && error.code == ALTServerConnectionErrorUnknown) + else { - // Connection failed with .unknown error code, so we assume the developer disk is NOT compatible. + // Installation failed, so we assume the developer disk is NOT compatible with this iOS version. + NSMutableDictionary *userInfo = [@{ ALTOperatingSystemVersionErrorKey: NSStringFromOperatingSystemVersion(altDevice.osVersion), NSFilePathErrorKey: diskURL.path, - NSUnderlyingErrorKey: error, } mutableCopy]; NSString *osName = ALTOperatingSystemNameForDeviceType(altDevice.type); @@ -1229,8 +1236,22 @@ NSNotificationName const ALTDeviceManagerDeviceDidDisconnectNotification = @"ALT userInfo[ALTOperatingSystemNameErrorKey] = osName; } - NSError *returnError = [NSError errorWithDomain:AltServerErrorDomain code:ALTServerErrorIncompatibleDeveloperDisk userInfo:userInfo]; - finish(returnError); + returnError = [NSError errorWithDomain:AltServerErrorDomain code:ALTServerErrorIncompatibleDeveloperDisk userInfo:userInfo]; + } + + return finish(returnError); + } + + plist_free(result); + + // Verify that the developer disk has been successfully installed. + ALTDebugConnection *testConnection = [[ALTDebugConnection alloc] initWithDevice:altDevice]; + [testConnection connectWithCompletionHandler:^(BOOL success, NSError * _Nullable error) { + [testConnection disconnect]; + + if (success) + { + finish(nil); } else { From b0dd15e723755f2052eab80417887ce5fc8fabc9 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 25 May 2022 16:23:45 -0700 Subject: [PATCH 08/13] =?UTF-8?q?Fixes=20=E2=80=9CApplication=20is=20missi?= =?UTF-8?q?ng=20the=20application-identifier=20entitlement=E2=80=9D=20erro?= =?UTF-8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dependencies/AltSign | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/AltSign b/Dependencies/AltSign index 557d3733..3d6fbeac 160000 --- a/Dependencies/AltSign +++ b/Dependencies/AltSign @@ -1 +1 @@ -Subproject commit 557d3733b85e51cc5eae4e24a66a5a0a6991468c +Subproject commit 3d6fbeac25cf3cc3302ede5cee2888733eded399 From 070839b9e27479fe59afd9ebc0f9d87b6acc0fb3 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 25 May 2022 16:45:27 -0700 Subject: [PATCH 09/13] =?UTF-8?q?Fixes=20authenticating=20with=20old=20ema?= =?UTF-8?q?il=20address=20after=20changing=20Apple=20ID=E2=80=99s=20primar?= =?UTF-8?q?y=20email?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AltStore/Operations/AuthenticationOperation.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/AltStore/Operations/AuthenticationOperation.swift b/AltStore/Operations/AuthenticationOperation.swift index 6c717ea9..1aaf81bd 100644 --- a/AltStore/Operations/AuthenticationOperation.swift +++ b/AltStore/Operations/AuthenticationOperation.swift @@ -49,6 +49,7 @@ class AuthenticationOperation: ResultOperation<(ALTTeam, ALTCertificate, ALTAppl private lazy var storyboard = UIStoryboard(name: "Authentication", bundle: nil) + private var appleIDEmailAddress: String? private var appleIDPassword: String? private var shouldShowInstructions = false @@ -174,6 +175,13 @@ class AuthenticationOperation: ResultOperation<(ALTTeam, ALTCertificate, ALTAppl } account.update(account: altTeam.account) + + if let providedEmailAddress = self.appleIDEmailAddress + { + // Save the user's provided email address instead of the one associated with their account (which may be outdated). + account.appleID = providedEmailAddress + } + team.update(team: altTeam) try context.save() @@ -242,7 +250,7 @@ class AuthenticationOperation: ResultOperation<(ALTTeam, ALTCertificate, ALTAppl try context.save() // Update keychain - Keychain.shared.appleIDEmailAddress = altTeam.account.appleID + Keychain.shared.appleIDEmailAddress = self.appleIDEmailAddress ?? altTeam.account.appleID // Prefer the user's provided email address over the one associated with their account (which may be outdated). Keychain.shared.appleIDPassword = self.appleIDPassword Keychain.shared.signingCertificate = altCertificate.p12Data() @@ -359,6 +367,8 @@ private extension AuthenticationOperation func authenticate(appleID: String, password: String, completionHandler: @escaping (Result<(ALTAccount, ALTAppleAPISession), Swift.Error>) -> Void) { + self.appleIDEmailAddress = appleID + let fetchAnisetteDataOperation = FetchAnisetteDataOperation(context: self.context) fetchAnisetteDataOperation.resultHandler = { (result) in switch result From 79095453562912e1c43069a4bc409d171796fcd6 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 26 May 2022 18:11:57 -0700 Subject: [PATCH 10/13] [AltServer] Updates app version to 1.5.1b --- AltStore.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index 7eb3fbb0..0a10f4b0 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -2814,7 +2814,7 @@ CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 65; + CURRENT_PROJECT_VERSION = 66; DEVELOPMENT_TEAM = 6XVY5G3U44; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( @@ -2847,7 +2847,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14.4; - MARKETING_VERSION = 1.5; + MARKETING_VERSION = 1.5.1b; PRODUCT_BUNDLE_IDENTIFIER = com.rileytestut.AltServer; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; @@ -2867,7 +2867,7 @@ CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 65; + CURRENT_PROJECT_VERSION = 66; DEVELOPMENT_TEAM = 6XVY5G3U44; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( @@ -2900,7 +2900,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14.4; - MARKETING_VERSION = 1.5; + MARKETING_VERSION = 1.5.1b; PRODUCT_BUNDLE_IDENTIFIER = com.rileytestut.AltServer; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; From 8463e8f1ee7ce782ba9a633d2738cf17d789f9cf Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 26 May 2022 18:26:35 -0700 Subject: [PATCH 11/13] Updates ALTServerID to Purple M1 iMac --- AltStore/Info.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AltStore/Info.plist b/AltStore/Info.plist index a3c66dea..8b17b705 100644 --- a/AltStore/Info.plist +++ b/AltStore/Info.plist @@ -9,7 +9,7 @@ ALTDeviceID 00008110-000A68390A82801E ALTServerID - 1AAAB6FD-E8CE-4B70-8F26-4073215C03B0 + 1F7D5B55-79CE-4546-A029-D4DDC4AF3B6D CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDocumentTypes From 01c8d42790d051f978d48014c0f6900264f477d1 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 26 May 2022 18:27:14 -0700 Subject: [PATCH 12/13] Updates app version to 1.5.1b --- AltStore.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index 0a10f4b0..72cdeda3 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -3371,8 +3371,8 @@ "$(PROJECT_DIR)/Dependencies/fragmentzip", "$(PROJECT_DIR)/Dependencies/libcurl", ); - MARKETING_VERSION = 1.5; PRODUCT_BUNDLE_IDENTIFIER = com.rileytestut.AltStore; + MARKETING_VERSION = 1.5.1b; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "AltStore/AltStore-Bridging-Header.h"; @@ -3405,8 +3405,8 @@ "$(PROJECT_DIR)/Dependencies/fragmentzip", "$(PROJECT_DIR)/Dependencies/libcurl", ); - MARKETING_VERSION = 1.5; PRODUCT_BUNDLE_IDENTIFIER = com.rileytestut.AltStore; + MARKETING_VERSION = 1.5.1b; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "AltStore/AltStore-Bridging-Header.h"; From 0dc5557e68236ef8dce24c05f273ea84589eb425 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Fri, 27 May 2022 12:36:43 -0700 Subject: [PATCH 13/13] [Apps] Updates AltStore beta to 1.5.1b --- AltStore/Resources/apps.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/AltStore/Resources/apps.json b/AltStore/Resources/apps.json index 92c1e930..a321c16d 100644 --- a/AltStore/Resources/apps.json +++ b/AltStore/Resources/apps.json @@ -36,14 +36,14 @@ "bundleIdentifier": "com.rileytestut.AltStore.Beta", "developerName": "Riley Testut", "subtitle": "An alternative App Store for iOS.", - "version": "1.5rc", - "versionDate": "2022-04-19T13:00:00-07:00", - "versionDescription": "**AltStore 1.5 Release Candidate**\n\nTRUSTED SOURCES*\nTrusted Sources are sources that we've personally reviewed to make sure they meet our safety standards. You can view all Trusted Sources from the Sources page and add them with a single tap.\n\nIMPROVEMENTS\n• Loads “Friend Tier” Patrons much faster on Patreon screen.\n\n*Adding “untrusted” sources via the + button is still supported.", - "downloadURL": "https://cdn.altstore.io/file/altstore/apps/altstore/1_5_rc.ipa", + "version": "1.5.1b", + "versionDate": "2022-05-27T12:00:00-07:00", + "versionDescription": "This beta fixes the following issues:\n\n• Using Apple IDs that contain capital letters\n• Using Apple IDs with 2FA enabled without any trusted devices\n• Repeatedly asking some users to sign in every refresh\n• \"Incorrect Apple ID or password\" error after changing Apple ID email address\n• “Application is missing application-identifier” error when sideloading or (de-)activating certain apps", + "downloadURL": "https://cdn.altstore.io/file/altstore/apps/altstore/1_5_1_b.ipa", "localizedDescription": "AltStore is an alternative app store for non-jailbroken devices. \n\nThis beta release of AltStore adds support for 3rd party sources, allowing you to download apps from other developers directly through AltStore.", "iconURL": "https://user-images.githubusercontent.com/705880/65270980-1eb96f80-dad1-11e9-9367-78ccd25ceb02.png", "tintColor": "018084", - "size": 5458029, + "size": 5464776, "beta": true, "screenshotURLs": [ "https://user-images.githubusercontent.com/705880/78942028-acf54300-7a6d-11ea-821c-5bb7a9b3e73a.PNG",