mirror of
https://github.com/SideStore/SideStore.git
synced 2026-03-27 12:55:40 +01:00
MinimuxerWrapper: streamline the logging
This commit is contained in:
@@ -10,122 +10,149 @@ import Minimuxer
|
|||||||
|
|
||||||
var isMinimuxerReady: Bool {
|
var isMinimuxerReady: Bool {
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
print("isMinimuxerReady property is always true on simulator")
|
print("isMinimuxerReady = true on simulator")
|
||||||
return true
|
return true
|
||||||
#else
|
#else
|
||||||
IfManager.shared.query()
|
IfManager.shared.query()
|
||||||
let dest = IfManager.shared.nextProbableSideVPN?.destIP
|
let dest = IfManager.shared.nextProbableSideVPN?.destIP
|
||||||
|
var result = false
|
||||||
if #available(iOS 26.4, *) {
|
if #available(iOS 26.4, *) {
|
||||||
return Minimuxer.ready(ifaddr: dest) && IfManager.shared.sideVPNPatched
|
result = Minimuxer.ready(ifaddr: dest) && IfManager.shared.sideVPNPatched
|
||||||
} else {
|
} else {
|
||||||
return Minimuxer.ready(ifaddr: dest)
|
result = Minimuxer.ready(ifaddr: dest)
|
||||||
}
|
}
|
||||||
|
print("isMinimuxerReady = \(result)")
|
||||||
|
return result
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func minimuxerStartWithLogger(_ pairingFile: String, _ logPath: String, _ loggingEnabled: Bool) throws {
|
func minimuxerStartWithLogger(_ pairingFile: String, _ logPath: String, _ loggingEnabled: Bool) throws {
|
||||||
|
defer { print("minimuxerStartWithLogger(pairingFile, logPath, dest, loggingEnabled) completed") }
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
print("minimuxerStartWithLogger(\(pairingFile), \(logPath), \(loggingEnabled)) is no-op on simulator")
|
print("minimuxerStartWithLogger(pairingFile, logPath, loggingEnabled) is no-op on simulator")
|
||||||
#else
|
#else
|
||||||
IfManager.shared.query()
|
IfManager.shared.query()
|
||||||
let dest = IfManager.shared.nextProbableSideVPN?.destIP
|
let dest = IfManager.shared.nextProbableSideVPN?.destIP
|
||||||
print("minimuxerStartWithLogger(\(pairingFile), \(logPath), \(dest), \(loggingEnabled)) is no-op on simulator")
|
print("minimuxerStartWithLogger(pairingFile, logPath, dest, loggingEnabled) invoked")
|
||||||
try Minimuxer.startWithLogger(pairingFile: pairingFile, logPath: logPath, ifaddr: dest, isConsoleLoggingEnabled: loggingEnabled)
|
try Minimuxer.startWithLogger(pairingFile: pairingFile, logPath: logPath, ifaddr: dest, isConsoleLoggingEnabled: loggingEnabled)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func targetMinimuxerAddress() {
|
func targetMinimuxerAddress() {
|
||||||
|
defer { print("targetMinimuxerAddress() completed") }
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
print("targetMinimuxerAddress() is no-op on simulator")
|
print("targetMinimuxerAddress() is no-op on simulator")
|
||||||
#else
|
#else
|
||||||
|
print("targetMinimuxerAddress() invoked")
|
||||||
Minimuxer.targetMinimuxerAddress()
|
Minimuxer.targetMinimuxerAddress()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func installProvisioningProfiles(_ profileData: Data) throws {
|
func installProvisioningProfiles(_ profileData: Data) throws {
|
||||||
|
defer { print("installProvisioningProfiles(profileData) completed") }
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
print("installProvisioningProfiles(\(profileData)) is no-op on simulator")
|
print("installProvisioningProfiles(profileData) is no-op on simulator")
|
||||||
#else
|
#else
|
||||||
|
print("installProvisioningProfiles(profileData) invoked")
|
||||||
try Minimuxer.installProvisioningProfile(profile: profileData)
|
try Minimuxer.installProvisioningProfile(profile: profileData)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeProvisioningProfile(_ id: String) throws {
|
func removeProvisioningProfile(_ id: String) throws {
|
||||||
|
defer { print("removeProvisioningProfile(id) completed") }
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
print("removeProvisioningProfile(\(id)) is no-op on simulator")
|
print("removeProvisioningProfile(id) is no-op on simulator")
|
||||||
#else
|
#else
|
||||||
|
print("removeProvisioningProfile(id) invoked")
|
||||||
try Minimuxer.removeProvisioningProfile(id: id)
|
try Minimuxer.removeProvisioningProfile(id: id)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeApp(_ bundleId: String) throws {
|
func removeApp(_ bundleId: String) throws {
|
||||||
|
defer { print("removeApp(bundleId) completed") }
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
print("removeApp(\(bundleId)) is no-op on simulator")
|
print("removeApp(bundleId) is no-op on simulator")
|
||||||
#else
|
#else
|
||||||
|
print("removeApp(bundleId) invoked")
|
||||||
try Minimuxer.removeApp(bundleId: bundleId)
|
try Minimuxer.removeApp(bundleId: bundleId)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func yeetAppAFC(_ bundleId: String, _ rawBytes: Data) throws {
|
func yeetAppAFC(_ bundleId: String, _ rawBytes: Data) throws {
|
||||||
|
defer { print("yeetAppAFC(bundleId, rawBytes) completed") }
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
print("yeetAppAFC(\(bundleId), \(rawBytes)) is no-op on simulator")
|
print("yeetAppAFC(bundleId, rawBytes) is no-op on simulator")
|
||||||
#else
|
#else
|
||||||
|
print("yeetAppAFC(bundleId, rawBytes) invoked")
|
||||||
try Minimuxer.yeetAppAfc(bundleId: bundleId, ipaBytes: rawBytes)
|
try Minimuxer.yeetAppAfc(bundleId: bundleId, ipaBytes: rawBytes)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func installIPA(_ bundleId: String) throws {
|
func installIPA(_ bundleId: String) throws {
|
||||||
|
defer { print("installIPA(bundleId) completed") }
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
print("installIPA(\(bundleId)) is no-op on simulator")
|
print("installIPA(bundleId) is no-op on simulator")
|
||||||
#else
|
#else
|
||||||
|
print("installIPA(bundleId) invoked")
|
||||||
try Minimuxer.installIpa(bundleId: bundleId)
|
try Minimuxer.installIpa(bundleId: bundleId)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func fetchUDID() -> String? {
|
func fetchUDID() -> String? {
|
||||||
|
defer { print("fetchUDID() completed") }
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
print("fetchUDID() is no-op on simulator")
|
print("fetchUDID() is no-op on simulator")
|
||||||
return "XXXXX-XXXX-XXXXX-XXXX"
|
return "XXXXX-XXXX-XXXXX-XXXX"
|
||||||
#else
|
#else
|
||||||
|
print("fetchUDID() invoked")
|
||||||
return Minimuxer.fetchUDID()
|
return Minimuxer.fetchUDID()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func debugApp(_ appId: String) throws {
|
func debugApp(_ appId: String) throws {
|
||||||
|
defer { print("debugApp(appId) completed") }
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
print("debugApp(\(appId)) is no-op on simulator")
|
print("debugApp(appId) is no-op on simulator")
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
print("debugApp(appId) invoked")
|
||||||
try Minimuxer.debugApp(appId: appId)
|
try Minimuxer.debugApp(appId: appId)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func attachDebugger(_ pid: UInt32) throws {
|
func attachDebugger(_ pid: UInt32) throws {
|
||||||
|
defer { print("attachDebugger(pid) completed") }
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
print("attachDebugger(\(pid)) is no-op on simulator")
|
print("attachDebugger(pid) is no-op on simulator")
|
||||||
#else
|
#else
|
||||||
|
print("attachDebugger(pid) invoked")
|
||||||
try Minimuxer.attachDebugger(pid: pid)
|
try Minimuxer.attachDebugger(pid: pid)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func startAutoMounter(_ docsPath: String) {
|
func startAutoMounter(_ docsPath: String) {
|
||||||
|
defer { print("startAutoMounter(docsPath) completed") }
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
print("startAutoMounter(\(docsPath)) is no-op on simulator")
|
print("startAutoMounter(docsPath) is no-op on simulator")
|
||||||
#else
|
#else
|
||||||
|
print("startAutoMounter(docsPath) invoked")
|
||||||
Minimuxer.startAutoMounter(docsPath: docsPath)
|
Minimuxer.startAutoMounter(docsPath: docsPath)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func dumpProfiles(_ docsPath: String) throws -> String {
|
func dumpProfiles(_ docsPath: String) throws -> String {
|
||||||
|
defer { print("dumpProfiles(docsPath) completed") }
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
print("dumpProfiles(\(docsPath)) is no-op on simulator")
|
print("dumpProfiles(docsPath) is no-op on simulator")
|
||||||
return ""
|
return ""
|
||||||
#else
|
#else
|
||||||
|
print("dumpProfiles(docsPath) invoked")
|
||||||
return try Minimuxer.dumpProfiles(docsPath: docsPath)
|
return try Minimuxer.dumpProfiles(docsPath: docsPath)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func setMinimuxerDebug(_ debug: Bool) {
|
func setMinimuxerDebug(_ debug: Bool) {
|
||||||
|
defer { print("setMinimuxerDebug(debug) completed") }
|
||||||
|
print("setMinimuxerDebug(debug) invoked")
|
||||||
Minimuxer.setDebug(debug)
|
Minimuxer.setDebug(debug)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user