[AltServer] Supports enabling JIT on devices running iOS 17

AltServer embeds the AltJIT CLI tool in its app bundle and runs it as an admin subprocess.
This commit is contained in:
Riley Testut
2023-09-08 14:15:55 -05:00
parent 1f499e77d3
commit dd761daed6
8 changed files with 382 additions and 92 deletions

View File

@@ -15,11 +15,17 @@ extension JITError
typealias Error = JITError
case processNotRunning
case dependencyNotFound
}
static func processNotRunning(_ process: AppProcess, file: StaticString = #file, line: Int = #line) -> JITError {
JITError(code: .processNotRunning, process: process, sourceFile: file, sourceLine: UInt(line))
}
static func dependencyNotFound(_ dependency: String?, file: StaticString = #file, line: Int = #line) -> JITError {
let errorFailure = NSLocalizedString("AltServer requires additional dependencies to enable JIT on iOS 17.", comment: "")
return JITError(code: .dependencyNotFound, errorFailure: errorFailure, dependency: dependency, faq: "https://faq.altstore.io/how-to-use-altstore/altjit", sourceFile: file, sourceLine: UInt(line))
}
}
struct JITError: ALTLocalizedError
@@ -31,6 +37,9 @@ struct JITError: ALTLocalizedError
@UserInfoValue var process: AppProcess?
@UserInfoValue var dependency: String?
@UserInfoValue var faq: String? // Show user FAQ URL in AltStore error log.
var sourceFile: StaticString?
var sourceLine: UInt?
@@ -40,6 +49,10 @@ struct JITError: ALTLocalizedError
case .processNotRunning:
let targetName = self.process?.description ?? NSLocalizedString("The target app", comment: "")
return String(format: NSLocalizedString("%@ is not running.", comment: ""), targetName)
case .dependencyNotFound:
let dependencyName = self.dependency.map { "'\($0)'" } ?? NSLocalizedString("A required dependency", comment: "")
return String(format: NSLocalizedString("%@ is not installed.", comment: ""), dependencyName)
}
}
@@ -47,6 +60,7 @@ struct JITError: ALTLocalizedError
switch self.code
{
case .processNotRunning: return NSLocalizedString("Make sure the app is running in the foreground on your device then try again.", comment: "")
case .dependencyNotFound: return NSLocalizedString("Please follow the instructions on the AltStore FAQ to install all required dependencies, then try again.", comment: "")
}
}
}