mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
[AltServer] Supports processName in EnableUnsignedCodeExecutionRequest
Process names will be used as a fallback if the processID cannot be determined, such as when enabling JIT for another app from within AltStore.
This commit is contained in:
@@ -155,21 +155,35 @@ struct ServerRequestHandler: RequestHandler
|
||||
case .success:
|
||||
ALTDeviceManager.shared.startDebugConnection(to: device) { (connection, error) in
|
||||
guard let connection = connection else { return completionHandler(.failure(error!)) }
|
||||
|
||||
connection.enableUnsignedCodeExecutionForProcess(withID: request.processID) { (success, error) in
|
||||
|
||||
func finish(success: Bool, error: Error?)
|
||||
{
|
||||
if let error = error, !success
|
||||
{
|
||||
print("Failed to enable unsigned code execution for process \(request.processID):", error)
|
||||
print("Failed to enable unsigned code execution for process \(request.processID?.description ?? request.processName ?? "nil"):", error)
|
||||
completionHandler(.failure(ALTServerError(error)))
|
||||
}
|
||||
else
|
||||
{
|
||||
print("Enabled unsigned code execution for process:", request.processID)
|
||||
print("Enabled unsigned code execution for process:", request.processID ?? request.processName ?? "nil")
|
||||
|
||||
let response = EnableUnsignedCodeExecutionResponse()
|
||||
completionHandler(.success(response))
|
||||
}
|
||||
}
|
||||
|
||||
if let processID = request.processID
|
||||
{
|
||||
connection.enableUnsignedCodeExecutionForProcess(withID: processID, completionHandler: finish)
|
||||
}
|
||||
else if let processName = request.processName
|
||||
{
|
||||
connection.enableUnsignedCodeExecutionForProcess(withName: processName, completionHandler: finish)
|
||||
}
|
||||
else
|
||||
{
|
||||
finish(success: false, error: ALTServerError(.invalidRequest))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,12 +445,14 @@ public struct EnableUnsignedCodeExecutionRequest: ServerMessageProtocol
|
||||
public var identifier = "EnableUnsignedCodeExecutionRequest"
|
||||
|
||||
public var udid: String
|
||||
public var processID: Int
|
||||
public var processID: Int?
|
||||
public var processName: String?
|
||||
|
||||
public init(udid: String, processID: Int)
|
||||
public init(udid: String, processID: Int? = nil, processName: String? = nil)
|
||||
{
|
||||
self.udid = udid
|
||||
self.processID = processID
|
||||
self.processName = processName
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user