From 2eeaeca8f42d99b498a3bda6506ef7533dd53bcc Mon Sep 17 00:00:00 2001 From: Magesh K <47920326+mahee96@users.noreply.github.com> Date: Wed, 18 Dec 2024 02:50:50 +0530 Subject: [PATCH] [Beta-Updates]: fix verify step for beta artifact verifications --- AltStore/Operations/VerifyAppOperation.swift | 10 +++++++--- .../AltStore 17.xcdatamodel/contents | 1 + AltStoreCore/Model/AppVersion.swift | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/AltStore/Operations/VerifyAppOperation.swift b/AltStore/Operations/VerifyAppOperation.swift index ca44334d..db18d586 100644 --- a/AltStore/Operations/VerifyAppOperation.swift +++ b/AltStore/Operations/VerifyAppOperation.swift @@ -129,9 +129,13 @@ private extension VerifyAppOperation { let (version, buildVersion) = await $appVersion.perform { ($0.version, $0.buildVersion) } - let downloadedIpaRevision = Bundle.init(url: app.fileURL)!.object(forInfoDictionaryKey: "BuildRevision") as? String ?? "" - - guard version == app.version else { throw VerificationError.mismatchedVersion(app.version, expectedVersion: version, app: app) } + let downloadedIpaRevision = Bundle(url: app.fileURL)!.object(forInfoDictionaryKey: "BuildRevision") as? String ?? "" + let sourceJsonIpaRevision = appVersion.revision + + // if not beta but version matches, then accept it, else compare revisions between source and downloaded + if version != app.version || (appVersion.isBeta && downloadedIpaRevision != sourceJsonIpaRevision) { + throw VerificationError.mismatchedVersion(app.version, expectedVersion: version, app: app) + } if let buildVersion { diff --git a/AltStoreCore/Model/AltStore.xcdatamodeld/AltStore 17.xcdatamodel/contents b/AltStoreCore/Model/AltStore.xcdatamodeld/AltStore 17.xcdatamodel/contents index 65d011fe..7b4dbf97 100644 --- a/AltStoreCore/Model/AltStore.xcdatamodeld/AltStore 17.xcdatamodel/contents +++ b/AltStoreCore/Model/AltStore.xcdatamodeld/AltStore 17.xcdatamodel/contents @@ -64,6 +64,7 @@ + diff --git a/AltStoreCore/Model/AppVersion.swift b/AltStoreCore/Model/AppVersion.swift index 74e5e6b2..b6a8c2b9 100644 --- a/AltStoreCore/Model/AppVersion.swift +++ b/AltStoreCore/Model/AppVersion.swift @@ -98,8 +98,8 @@ public class AppVersion: NSManagedObject, Decodable, Fetchable self._minOSVersion = try container.decodeIfPresent(String.self, forKey: .minOSVersion) self._maxOSVersion = try container.decodeIfPresent(String.self, forKey: .maxOSVersion) -// self.isBeta = try container.decodeIfPresent(Bool.self, forKey: .isBeta) ?? false -// self.revision = try container.decodeIfPresent(String.self, forKey: .revision) + self.isBeta = try container.decodeIfPresent(Bool.self, forKey: .isBeta) ?? false + self.revision = try container.decodeIfPresent(String.self, forKey: .revision) } catch {