mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
[debug]: added export capability for resigned apps and makefile cleanup
This commit is contained in:
@@ -1389,10 +1389,7 @@ private extension AppManager
|
||||
group.beginInstallationHandler?(installedApp)
|
||||
}
|
||||
|
||||
// TODO: @mahee96: retire excessive completion handlers in the callback for each operation
|
||||
// These spam the Error log since they don't prematurely flush the operation pipeline when an error occurs
|
||||
// Need to investigate why premature flush isn't hapenning.
|
||||
|
||||
|
||||
var downloadingApp = app
|
||||
|
||||
if let installedApp = app as? InstalledApp
|
||||
@@ -1678,7 +1675,10 @@ private extension AppManager
|
||||
{
|
||||
case .failure(let error):
|
||||
context.error = error
|
||||
case .success(let resignedApp): context.resignedApp = resignedApp
|
||||
case .success(let resignedApp):
|
||||
context.resignedApp = resignedApp
|
||||
|
||||
self.exportResginedAppsToDocsDir(resignedApp)
|
||||
}
|
||||
}
|
||||
resignAppOperation.addDependency(patchAppOperation)
|
||||
@@ -1760,6 +1760,50 @@ private extension AppManager
|
||||
return progress
|
||||
}
|
||||
|
||||
private func exportResginedAppsToDocsDir(_ resignedApp: ALTApplication)
|
||||
{
|
||||
|
||||
let sourceURL = resignedApp.fileURL
|
||||
|
||||
let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
|
||||
let resignedAppsURL = documentsURL.appendingPathComponent("ResignedApps")
|
||||
// Create the ResignedApps subfolder if it doesn't exist
|
||||
do {
|
||||
if !FileManager.default.fileExists(atPath: resignedAppsURL.path) {
|
||||
try FileManager.default.createDirectory(at: resignedAppsURL, withIntermediateDirectories: true, attributes: nil)
|
||||
}
|
||||
} catch {
|
||||
print("Failed to create ResignedApps folder: \(error)")
|
||||
return
|
||||
}
|
||||
|
||||
// let destinationURL = resignedAppsURL.appendingPathComponent(sourceURL.lastPathComponent)
|
||||
let utis = Bundle(url: resignedApp.fileURL)?.infoDictionary?[Bundle.Info.exportedUTIs] as? [[String: Any]]
|
||||
let isAltBackup = utis?.first?["UTTypeDescription"] as? String == "AltStore Backup App"
|
||||
|
||||
let destPath = isAltBackup ? resignedApp.name + "-altbackup" : resignedApp.name
|
||||
let destinationURL = resignedAppsURL.appendingPathComponent(destPath + ".app")
|
||||
|
||||
// Delete the existing file if it exists
|
||||
do {
|
||||
if FileManager.default.fileExists(atPath: destinationURL.path) {
|
||||
try FileManager.default.removeItem(at: destinationURL)
|
||||
}
|
||||
} catch {
|
||||
print("Failed to delete existing file at destination: \(error)")
|
||||
return
|
||||
}
|
||||
|
||||
// Copy the file to the ResignedApps folder
|
||||
do {
|
||||
try FileManager.default.copyItem(at: sourceURL, to: destinationURL)
|
||||
print("File copied to: \(destinationURL.path)")
|
||||
} catch {
|
||||
print("Failed to copy file: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func _refresh(_ app: InstalledApp, operation: AppOperation, group: RefreshGroup, completionHandler: @escaping (Result<InstalledApp, Error>) -> Void) -> Progress
|
||||
{
|
||||
let progress = Progress.discreteProgress(totalUnitCount: 100)
|
||||
|
||||
6
Makefile
6
Makefile
@@ -202,11 +202,12 @@ build: print_release_type
|
||||
BUNDLE_ID_SUFFIX=
|
||||
# DWARF_DSYM_FOLDER_PATH="."
|
||||
|
||||
fakesign:
|
||||
fakesign-apps:
|
||||
rm -rf SideStore.xcarchive/Products/Applications/SideStore.app/Frameworks/AltStoreCore.framework/Frameworks/
|
||||
ldid -SAltStore/Resources/ReleaseEntitlements.plist SideStore.xcarchive/Products/Applications/SideStore.app/SideStore
|
||||
ldid -SAltWidget/Resources/ReleaseEntitlements.plist SideStore.xcarchive/Products/Applications/SideStore.app/PlugIns/AltWidgetExtension.appex/AltWidgetExtension
|
||||
|
||||
fakesign-altbackup:
|
||||
@unzip -q -o SideStore.xcarchive/Products/Applications/SideStore.app/AltBackup.ipa -d SideStore.xcarchive/Products/Applications/SideStore.app/
|
||||
ldid -SAltBackup/Resources/ReleaseEntitlements.plist SideStore.xcarchive/Products/Applications/SideStore.app/Payload/AltBackup.app/AltBackup
|
||||
@pushd "SideStore.xcarchive/Products/Applications/SideStore.app/" \
|
||||
@@ -214,6 +215,9 @@ fakesign:
|
||||
popd > /dev/null
|
||||
rm -rf SideStore.xcarchive/Products/Applications/SideStore.app/Payload
|
||||
|
||||
fakesign: fakesign-apps fakesign-altbackup
|
||||
|
||||
|
||||
ipa:
|
||||
mkdir -p Payload/SideStore.app
|
||||
cp -R SideStore.xcarchive/Products/Applications/SideStore.app/ Payload/SideStore.app/
|
||||
|
||||
Reference in New Issue
Block a user