Add option for using main bundle's profile for app extensions, update AltSign & libmd (#1012)

This commit is contained in:
Huge_Black
2025-06-22 16:13:15 +08:00
committed by GitHub
parent 7057d59992
commit 00ed6e61be
9 changed files with 56 additions and 23 deletions

2
.gitmodules vendored
View File

@@ -30,7 +30,7 @@
url = https://github.com/rileytestut/Roxas.git url = https://github.com/rileytestut/Roxas.git
[submodule "Dependencies/libimobiledevice"] [submodule "Dependencies/libimobiledevice"]
path = Dependencies/libimobiledevice path = Dependencies/libimobiledevice
url = https://github.com/libimobiledevice/libimobiledevice url = https://github.com/SideStore/libimobiledevice
[submodule "Dependencies/libusbmuxd"] [submodule "Dependencies/libusbmuxd"]
path = Dependencies/libusbmuxd path = Dependencies/libusbmuxd
url = https://github.com/libimobiledevice/libusbmuxd.git url = https://github.com/libimobiledevice/libusbmuxd.git

View File

@@ -4158,8 +4158,8 @@
isa = XCRemoteSwiftPackageReference; isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SwiftPackageIndex/SemanticVersion"; repositoryURL = "https://github.com/SwiftPackageIndex/SemanticVersion";
requirement = { requirement = {
kind = upToNextMajorVersion; kind = exactVersion;
minimumVersion = 0.4.0; version = 0.4.0;
}; };
}; };
A8B645FD2D70C1AD00125819 /* XCRemoteSwiftPackageReference "MarkdownKit" */ = { A8B645FD2D70C1AD00125819 /* XCRemoteSwiftPackageReference "MarkdownKit" */ = {

View File

@@ -1519,6 +1519,24 @@ private extension AppManager
patchAppOperation.addDependency(deactivateAppsOperation) patchAppOperation.addDependency(deactivateAppsOperation)
let modifyAppExBundleIdOperation = RSTAsyncBlockOperation { operation in
if !context.useMainProfile {
operation.finish()
return
}
if let app = context.app, let profile = context.provisioningProfiles?[app.bundleIdentifier] {
var appexBundleIds: [String: String] = [:]
for appex in app.appExtensions {
appexBundleIds[appex.bundleIdentifier] = appex.bundleIdentifier.replacingOccurrences(of: app.bundleIdentifier, with: profile.bundleIdentifier)
}
context.appexBundleIds = appexBundleIds
}
operation.finish()
}
modifyAppExBundleIdOperation.addDependency(fetchProvisioningProfilesOperation)
/* Resign */ /* Resign */
let resignAppOperation = ResignAppOperation(context: context) let resignAppOperation = ResignAppOperation(context: context)
resignAppOperation.resultHandler = { (result) in resignAppOperation.resultHandler = { (result) in
@@ -1533,6 +1551,7 @@ private extension AppManager
} }
} }
resignAppOperation.addDependency(patchAppOperation) resignAppOperation.addDependency(patchAppOperation)
resignAppOperation.addDependency(modifyAppExBundleIdOperation)
progress.addChild(resignAppOperation.progress, withPendingUnitCount: 20) progress.addChild(resignAppOperation.progress, withPendingUnitCount: 20)
@@ -1586,6 +1605,7 @@ private extension AppManager
patchAppOperation, patchAppOperation,
refreshAnisetteDataOperation, refreshAnisetteDataOperation,
fetchProvisioningProfilesOperation, fetchProvisioningProfilesOperation,
modifyAppExBundleIdOperation,
resignAppOperation, resignAppOperation,
sendAppOperation, sendAppOperation,
installOperation installOperation

View File

@@ -67,6 +67,7 @@ class FetchProvisioningProfilesOperation: ResultOperation<[String: ALTProvisioni
let dispatchGroup = DispatchGroup() let dispatchGroup = DispatchGroup()
if !self.context.useMainProfile {
for appExtension in app.appExtensions for appExtension in app.appExtensions
{ {
dispatchGroup.enter() dispatchGroup.enter()
@@ -83,6 +84,7 @@ class FetchProvisioningProfilesOperation: ResultOperation<[String: ALTProvisioni
self.progress.completedUnitCount += 1 self.progress.completedUnitCount += 1
} }
} }
}
dispatchGroup.notify(queue: .global()) { dispatchGroup.notify(queue: .global()) {
if let error = error if let error = error

View File

@@ -66,6 +66,8 @@ class AppOperationContext
var app: ALTApplication? var app: ALTApplication?
var provisioningProfiles: [String: ALTProvisioningProfile]? var provisioningProfiles: [String: ALTProvisioningProfile]?
var appexBundleIds: [String: String]?
var useMainProfile = false
var isFinished = false var isFinished = false

View File

@@ -136,7 +136,11 @@ final class RemoveAppExtensionsOperation: ResultOperation<Void>
alertController.addAction(UIAlertAction(title: UIAlertAction.cancel.title, style: UIAlertAction.cancel.style, handler: { (action) in alertController.addAction(UIAlertAction(title: UIAlertAction.cancel.title, style: UIAlertAction.cancel.style, handler: { (action) in
self.finish(.failure(OperationError.cancelled)) self.finish(.failure(OperationError.cancelled))
})) }))
alertController.addAction(UIAlertAction(title: NSLocalizedString("Keep App Extensions", comment: ""), style: .default) { (action) in alertController.addAction(UIAlertAction(title: NSLocalizedString("Keep App Extensions (Use Main Profile)", comment: ""), style: .default) { (action) in
self.context.useMainProfile = true
self.finish(.success(()))
})
alertController.addAction(UIAlertAction(title: NSLocalizedString("Keep App Extensions (Register App ID for Each Extension)", comment: ""), style: .default) { (action) in
self.finish(.success(())) self.finish(.success(()))
}) })
alertController.addAction(UIAlertAction(title: NSLocalizedString("Remove App Extensions", comment: ""), style: .destructive) { (action) in alertController.addAction(UIAlertAction(title: NSLocalizedString("Remove App Extensions", comment: ""), style: .destructive) { (action) in

View File

@@ -55,7 +55,7 @@ final class ResignAppOperation: ResultOperation<ALTApplication>
let prepareAppProgress = Progress.discreteProgress(totalUnitCount: 2) let prepareAppProgress = Progress.discreteProgress(totalUnitCount: 2)
self.progress.addChild(prepareAppProgress, withPendingUnitCount: 3) self.progress.addChild(prepareAppProgress, withPendingUnitCount: 3)
let prepareAppBundleProgress = self.prepareAppBundle(for: app, profiles: profiles) { (result) in let prepareAppBundleProgress = self.prepareAppBundle(for: app, profiles: profiles, appexBundleIds: context.appexBundleIds ?? [:]) { (result) in
guard let appBundleURL = self.process(result) else { return } guard let appBundleURL = self.process(result) else { return }
// Resign app bundle // Resign app bundle
@@ -107,7 +107,7 @@ final class ResignAppOperation: ResultOperation<ALTApplication>
private extension ResignAppOperation private extension ResignAppOperation
{ {
func prepareAppBundle(for app: ALTApplication, profiles: [String: ALTProvisioningProfile], completionHandler: @escaping (Result<URL, Error>) -> Void) -> Progress func prepareAppBundle(for app: ALTApplication, profiles: [String: ALTProvisioningProfile], appexBundleIds: [String: String], completionHandler: @escaping (Result<URL, Error>) -> Void) -> Progress
{ {
let progress = Progress.discreteProgress(totalUnitCount: 1) let progress = Progress.discreteProgress(totalUnitCount: 1)
@@ -119,10 +119,15 @@ private extension ResignAppOperation
func prepare(_ bundle: Bundle, additionalInfoDictionaryValues: [String: Any] = [:]) throws func prepare(_ bundle: Bundle, additionalInfoDictionaryValues: [String: Any] = [:]) throws
{ {
guard let identifier = bundle.bundleIdentifier else { throw ALTError(.missingAppBundle) } guard let identifier = bundle.bundleIdentifier else { throw ALTError(.missingAppBundle) }
guard let profile = profiles[identifier] else { throw ALTError(.missingProvisioningProfile) } guard let profile = context.useMainProfile ? profiles.values.first : profiles[identifier] else { throw ALTError(.missingProvisioningProfile) }
guard var infoDictionary = bundle.completeInfoDictionary else { throw ALTError(.missingInfoPlist) } guard var infoDictionary = bundle.completeInfoDictionary else { throw ALTError(.missingInfoPlist) }
if let forcedBundleIdentifier = appexBundleIds[identifier] {
infoDictionary[kCFBundleIdentifierKey as String] = forcedBundleIdentifier
} else {
infoDictionary[kCFBundleIdentifierKey as String] = profile.bundleIdentifier infoDictionary[kCFBundleIdentifierKey as String] = profile.bundleIdentifier
}
infoDictionary[Bundle.Info.altBundleID] = identifier infoDictionary[Bundle.Info.altBundleID] = identifier
infoDictionary[Bundle.Info.devicePairingString] = "<insert pairing file here>" infoDictionary[Bundle.Info.devicePairingString] = "<insert pairing file here>"
infoDictionary.removeValue(forKey: "DTXcode") infoDictionary.removeValue(forKey: "DTXcode")