[AltServer] Downloads AltStore, no longer includes in app bundle

This commit is contained in:
Riley Testut
2019-06-26 17:05:52 -07:00
parent de238c95a0
commit 8960fb18f2
3 changed files with 48 additions and 33 deletions

Binary file not shown.

View File

@@ -44,7 +44,7 @@ class ViewController: NSViewController
switch state
{
case .notRunning: self.view.window?.title = ""
case .connecting: self.view.window?.title = "Connecting..."
case .connecting: self.view.window?.title = "Connecting...."
case .running(let service): self.view.window?.title = service.name ?? ""
case .failed(let error): self.view.window?.title = error.localizedDescription
}
@@ -135,24 +135,6 @@ private extension ViewController
try? FileManager.default.removeItem(at: destinationDirectoryURL)
}
let ipaURL = Bundle.main.url(forResource: "App", withExtension: ".ipa")!
let application: ALTApplication
do
{
try FileManager.default.createDirectory(at: destinationDirectoryURL, withIntermediateDirectories: true, attributes: nil)
let appBundleURL = try FileManager.default.unzipAppBundle(at: ipaURL, toDirectory: destinationDirectoryURL)
guard let app = ALTApplication(fileURL: appBundleURL) else { throw ALTError(.invalidApp) }
application = app
}
catch
{
finish(error, title: "Failed to Install App")
return
}
self.authenticate() { (result) in
do
{
@@ -172,6 +154,17 @@ private extension ViewController
{
let certificate = try result.get()
self.downloadApp { (result) in
do
{
let fileURL = try result.get()
try FileManager.default.createDirectory(at: destinationDirectoryURL, withIntermediateDirectories: true, attributes: nil)
let appBundleURL = try FileManager.default.unzipAppBundle(at: fileURL, toDirectory: destinationDirectoryURL)
guard let application = ALTApplication(fileURL: appBundleURL) else { throw ALTError(.invalidApp) }
self.registerAppID(name: "AltStore", identifier: "com.rileytestut.AltStore", team: team) { (result) in
do
{
@@ -210,6 +203,13 @@ private extension ViewController
}
}
catch
{
finish(error, title: "Failed to Download AltStore")
return
}
}
}
catch
{
finish(error, title: "Failed to Fetch Certificate")
}
@@ -234,6 +234,25 @@ private extension ViewController
}
}
func downloadApp(completionHandler: @escaping (Result<URL, Error>) -> Void)
{
let appURL = URL(string: "https://www.dropbox.com/s/w1gn9iztlqvltyp/AltStore.ipa?dl=1")!
let downloadTask = URLSession.shared.downloadTask(with: appURL) { (fileURL, response, error) in
do
{
let (fileURL, _) = try Result((fileURL, response), error).get()
completionHandler(.success(fileURL))
}
catch
{
completionHandler(.failure(error))
}
}
downloadTask.resume()
}
func authenticate(completionHandler: @escaping (Result<ALTAccount, Error>) -> Void)
{
ALTAppleAPI.shared.authenticate(appleID: self.emailAddressTextField.stringValue, password: self.passwordTextField.stringValue) { (account, error) in

View File

@@ -164,7 +164,6 @@
BFE6326822A858F300F30809 /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFE6326722A858F300F30809 /* Account.swift */; };
BFE6326A22A85DAF00F30809 /* ReplaceCertificateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFE6326922A85DAF00F30809 /* ReplaceCertificateViewController.swift */; };
BFE6326C22A86FF300F30809 /* AuthenticationOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFE6326B22A86FF300F30809 /* AuthenticationOperation.swift */; };
BFFC044E22A204F40066B31F /* App.ipa in Resources */ = {isa = PBXBuildFile; fileRef = BFFC044D22A204F30066B31F /* App.ipa */; };
DBAC68F8EC03F4A41D62EDE1 /* Pods_AltStore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1039C07E517311FC499A0B64 /* Pods_AltStore.framework */; };
/* End PBXBuildFile section */
@@ -394,7 +393,6 @@
BFE6326722A858F300F30809 /* Account.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Account.swift; sourceTree = "<group>"; };
BFE6326922A85DAF00F30809 /* ReplaceCertificateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReplaceCertificateViewController.swift; sourceTree = "<group>"; };
BFE6326B22A86FF300F30809 /* AuthenticationOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationOperation.swift; sourceTree = "<group>"; };
BFFC044D22A204F30066B31F /* App.ipa */ = {isa = PBXFileReference; lastKnownFileType = file; path = App.ipa; sourceTree = "<group>"; };
EA79A60285C6AF5848AA16E9 /* Pods-AltStore.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AltStore.debug.xcconfig"; path = "Target Support Files/Pods-AltStore/Pods-AltStore.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -619,7 +617,6 @@
isa = PBXGroup;
children = (
BF458693229872EA00BD7491 /* Assets.xcassets */,
BFFC044D22A204F30066B31F /* App.ipa */,
);
name = Resources;
sourceTree = "<group>";
@@ -1034,7 +1031,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BFFC044E22A204F40066B31F /* App.ipa in Resources */,
BF458694229872EA00BD7491 /* Assets.xcassets in Resources */,
BF458697229872EA00BD7491 /* Main.storyboard in Resources */,
);