From 4c441077c71a6f56b8205cade9bfe0c07537d6e6 Mon Sep 17 00:00:00 2001 From: Nythepegasus Date: Sat, 3 Dec 2022 17:25:15 -0500 Subject: [PATCH] Add a bunch more "logging" throughout signing --- .../Operations/FetchAnisetteDataOperation.swift | 1 + AltStore/Operations/InstallAppOperation.swift | 5 +++++ AltStore/Operations/SendAppOperation.swift | 2 ++ AltStoreCore/Model/InstalledApp.swift | 13 ++++++++++--- AltStoreCore/Model/StoreApp.swift | 2 ++ Shared/Server Protocol/ServerProtocol.swift | 5 +++++ 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/AltStore/Operations/FetchAnisetteDataOperation.swift b/AltStore/Operations/FetchAnisetteDataOperation.swift index 298a8fe2..cd652722 100644 --- a/AltStore/Operations/FetchAnisetteDataOperation.swift +++ b/AltStore/Operations/FetchAnisetteDataOperation.swift @@ -47,6 +47,7 @@ class FetchAnisetteDataOperation: ResultOperation let formattedJSON: [String: String] = ["machineID": json["X-Apple-I-MD-M"]!, "oneTimePassword": json["X-Apple-I-MD"]!, "localUserID": json["X-Apple-I-MD-LU"]!, "routingInfo": json["X-Apple-I-MD-RINFO"]!, "deviceUniqueIdentifier": json["X-Mme-Device-Id"]!, "deviceDescription": json["X-MMe-Client-Info"]!, "date": json["X-Apple-I-Client-Time"]!, "locale": json["X-Apple-Locale"]!, "timeZone": json["X-Apple-I-TimeZone"]!, "deviceSerialNumber": "1"] if let anisette = ALTAnisetteData(json: formattedJSON) { + DLOG("Anisette used: %@", formattedJSON) self.finish(.success(anisette)) } } diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index c8b406a3..deaf8a50 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -86,6 +86,11 @@ class InstallAppOperation: ResultOperation let resignedBundleID = appExtension.bundleIdentifier let originalBundleID = resignedBundleID.replacingOccurrences(of: resignedParentBundleID, with: parentBundleID) + print("`parentBundleID`: \(parentBundleID)") + print("`resignedParentBundleID`: \(resignedParentBundleID)") + print("`resignedBundleID`: \(resignedBundleID)") + print("`originalBundleID`: \(originalBundleID)") + let installedExtension: InstalledExtension if let appExtension = installedApp.appExtensions.first(where: { $0.bundleIdentifier == originalBundleID }) diff --git a/AltStore/Operations/SendAppOperation.swift b/AltStore/Operations/SendAppOperation.swift index 90f6cbee..ffc43b38 100644 --- a/AltStore/Operations/SendAppOperation.swift +++ b/AltStore/Operations/SendAppOperation.swift @@ -42,6 +42,7 @@ class SendAppOperation: ResultOperation<()> let app = AnyApp(name: resignedApp.name, bundleIdentifier: self.context.bundleIdentifier, url: resignedApp.fileURL) let fileURL = InstalledApp.refreshedIPAURL(for: app) + print("AFC App `fileURL`: \(fileURL.absoluteString)") let ns_bundle = NSString(string: app.bundleIdentifier) let ns_bundle_ptr = UnsafeMutablePointer(mutating: ns_bundle.utf8String) @@ -59,6 +60,7 @@ class SendAppOperation: ResultOperation<()> attempts -= 1 } if res == 0 { + print("minimuxer_yeet_app_afc `res` == \(res)") self.progress.completedUnitCount += 1 self.finish(.success(())) } else { diff --git a/AltStoreCore/Model/InstalledApp.swift b/AltStoreCore/Model/InstalledApp.swift index 06645a13..3720c528 100644 --- a/AltStoreCore/Model/InstalledApp.swift +++ b/AltStoreCore/Model/InstalledApp.swift @@ -79,6 +79,8 @@ public class InstalledApp: NSManagedObject, InstalledAppProtocol self.bundleIdentifier = originalBundleIdentifier + print("InstalledApp `self.bundleIdentifier`: \(self.bundleIdentifier)") + self.refreshedDate = Date() self.installedDate = Date() @@ -154,13 +156,14 @@ public extension InstalledApp { let fetchRequest = InstalledApp.fetchRequest() as NSFetchRequest fetchRequest.predicate = NSPredicate(format: "%K == YES", #keyPath(InstalledApp.isActive)) + print("Active Apps Fetch Request: \(String(describing: fetchRequest.predicate))") return fetchRequest } class func fetchAltStore(in context: NSManagedObjectContext) -> InstalledApp? { let predicate = NSPredicate(format: "%K == %@", #keyPath(InstalledApp.bundleIdentifier), StoreApp.altstoreAppID) - + print("Fetch 'AltStore' Predicate: \(String(describing: predicate))") let altStore = InstalledApp.first(satisfying: predicate, in: context) return altStore } @@ -174,6 +177,7 @@ public extension InstalledApp class func fetchAppsForRefreshingAll(in context: NSManagedObjectContext) -> [InstalledApp] { var predicate = NSPredicate(format: "%K == YES AND %K != %@", #keyPath(InstalledApp.isActive), #keyPath(InstalledApp.bundleIdentifier), StoreApp.altstoreAppID) + print("Fetch Apps for Refreshing All 'AltStore' predicate: \(String(describing: predicate))") // if let patreonAccount = DatabaseManager.shared.patreonAccount(in: context), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated // { @@ -207,6 +211,7 @@ public extension InstalledApp #keyPath(InstalledApp.isActive), #keyPath(InstalledApp.refreshedDate), date as NSDate, #keyPath(InstalledApp.bundleIdentifier), StoreApp.altstoreAppID) + print("Active Apps For Background Refresh 'AltStore' predicate: \(String(describing: predicate))") // if let patreonAccount = DatabaseManager.shared.patreonAccount(in: context), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated // { @@ -253,14 +258,15 @@ public extension InstalledApp let appsDirectoryURL = baseDirectory.appendingPathComponent("Apps") do { try FileManager.default.createDirectory(at: appsDirectoryURL, withIntermediateDirectories: true, attributes: nil) } - catch { print(error) } - + catch { print("Creating App Directory Error: \(error)") } + print("`appsDirectoryURL` is set to: \(appsDirectoryURL.absoluteString)") return appsDirectoryURL } class var legacyAppsDirectoryURL: URL { let baseDirectory = FileManager.default.applicationSupportDirectory let appsDirectoryURL = baseDirectory.appendingPathComponent("Apps") + print("legacy `appsDirectoryURL` is set to: \(appsDirectoryURL.absoluteString)") return appsDirectoryURL } @@ -273,6 +279,7 @@ public extension InstalledApp class func refreshedIPAURL(for app: AppProtocol) -> URL { let ipaURL = self.directoryURL(for: app).appendingPathComponent("Refreshed.ipa") + print("`ipaURL`: \(ipaURL.absoluteString)") return ipaURL } diff --git a/AltStoreCore/Model/StoreApp.swift b/AltStoreCore/Model/StoreApp.swift index c1f0e32c..fc522538 100644 --- a/AltStoreCore/Model/StoreApp.swift +++ b/AltStoreCore/Model/StoreApp.swift @@ -361,6 +361,8 @@ public extension StoreApp in: context) app.setVersions([appVersion]) + print("makeAltStoreApp StoreApp: \(String(describing: app))") + #if BETA app.isBeta = true #endif diff --git a/Shared/Server Protocol/ServerProtocol.swift b/Shared/Server Protocol/ServerProtocol.swift index 2b0041c9..cbe9d857 100644 --- a/Shared/Server Protocol/ServerProtocol.swift +++ b/Shared/Server Protocol/ServerProtocol.swift @@ -305,6 +305,8 @@ public struct BeginInstallationRequest: ServerMessageProtocol { self.activeProfiles = activeProfiles self.bundleIdentifier = bundleIdentifier + print("BeginInstallationRequest `activeProfiles`: \(String(describing: activeProfiles))") + print("BeginInstallationRequest `bundleIdentifier`: \(String(describing: bundleIdentifier))") } } @@ -346,6 +348,9 @@ public struct InstallProvisioningProfilesRequest: ServerMessageProtocol self.udid = udid self.provisioningProfiles = provisioningProfiles self.activeProfiles = activeProfiles + print("InstallProvisioningProfilesRequest `self.udid`: \(self.udid)") + print("InstallProvisioningProfilesRequest `self.provisioningProfiles`: \(self.provisioningProfiles)") + print("InstallProvisioningProfilesRequest `self.activeProfiles`: \(String(describing: self.activeProfiles))") } public init(from decoder: Decoder) throws