mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
[ADD] LocalConsole showing STDOUT and STDERR
This commit is contained in:
@@ -75,6 +75,8 @@
|
|||||||
1FB96FCF292BBBCA007E68D1 /* SiriShortcutSetupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB96FCE292BBBC9007E68D1 /* SiriShortcutSetupView.swift */; };
|
1FB96FCF292BBBCA007E68D1 /* SiriShortcutSetupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB96FCE292BBBC9007E68D1 /* SiriShortcutSetupView.swift */; };
|
||||||
1FB96FEC292C171D007E68D1 /* NotificationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB96FEB292C171D007E68D1 /* NotificationManager.swift */; };
|
1FB96FEC292C171D007E68D1 /* NotificationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB96FEB292C171D007E68D1 /* NotificationManager.swift */; };
|
||||||
1FB96FF3292D0539007E68D1 /* PillButtonProgressViewStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB96FF2292D0539007E68D1 /* PillButtonProgressViewStyle.swift */; };
|
1FB96FF3292D0539007E68D1 /* PillButtonProgressViewStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB96FF2292D0539007E68D1 /* PillButtonProgressViewStyle.swift */; };
|
||||||
|
1FFA56C2299994390011B6F5 /* OutputCapturer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FFA56C1299994390011B6F5 /* OutputCapturer.swift */; };
|
||||||
|
1FFA56C52999978C0011B6F5 /* LocalConsole in Frameworks */ = {isa = PBXBuildFile; productRef = 1FFA56C42999978C0011B6F5 /* LocalConsole */; };
|
||||||
1FFEF104298552DB0098374C /* AppVersionHistoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FFEF103298552DB0098374C /* AppVersionHistoryView.swift */; };
|
1FFEF104298552DB0098374C /* AppVersionHistoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FFEF103298552DB0098374C /* AppVersionHistoryView.swift */; };
|
||||||
4879A95F2861046500FC1BBD /* AltSign in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A95E2861046500FC1BBD /* AltSign */; };
|
4879A95F2861046500FC1BBD /* AltSign in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A95E2861046500FC1BBD /* AltSign */; };
|
||||||
4879A9622861049C00FC1BBD /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A9612861049C00FC1BBD /* OpenSSL */; };
|
4879A9622861049C00FC1BBD /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A9612861049C00FC1BBD /* OpenSSL */; };
|
||||||
@@ -625,6 +627,7 @@
|
|||||||
1FB96FCE292BBBC9007E68D1 /* SiriShortcutSetupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SiriShortcutSetupView.swift; sourceTree = "<group>"; };
|
1FB96FCE292BBBC9007E68D1 /* SiriShortcutSetupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SiriShortcutSetupView.swift; sourceTree = "<group>"; };
|
||||||
1FB96FEB292C171D007E68D1 /* NotificationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = "<group>"; };
|
1FB96FEB292C171D007E68D1 /* NotificationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = "<group>"; };
|
||||||
1FB96FF2292D0539007E68D1 /* PillButtonProgressViewStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PillButtonProgressViewStyle.swift; sourceTree = "<group>"; };
|
1FB96FF2292D0539007E68D1 /* PillButtonProgressViewStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PillButtonProgressViewStyle.swift; sourceTree = "<group>"; };
|
||||||
|
1FFA56C1299994390011B6F5 /* OutputCapturer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OutputCapturer.swift; sourceTree = "<group>"; };
|
||||||
1FFEF103298552DB0098374C /* AppVersionHistoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppVersionHistoryView.swift; sourceTree = "<group>"; };
|
1FFEF103298552DB0098374C /* AppVersionHistoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppVersionHistoryView.swift; sourceTree = "<group>"; };
|
||||||
9961EC2D29BE9F2E00AF2C6F /* minimuxer-helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "minimuxer-helpers.swift"; path = "Dependencies/minimuxer/minimuxer-helpers.swift"; sourceTree = SOURCE_ROOT; };
|
9961EC2D29BE9F2E00AF2C6F /* minimuxer-helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "minimuxer-helpers.swift"; path = "Dependencies/minimuxer/minimuxer-helpers.swift"; sourceTree = SOURCE_ROOT; };
|
||||||
99F87D1629D8E4C900B40039 /* SwiftBridgeCore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftBridgeCore.swift; path = Dependencies/minimuxer/SwiftBridgeCore.swift; sourceTree = SOURCE_ROOT; };
|
99F87D1629D8E4C900B40039 /* SwiftBridgeCore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftBridgeCore.swift; path = Dependencies/minimuxer/SwiftBridgeCore.swift; sourceTree = SOURCE_ROOT; };
|
||||||
@@ -1048,6 +1051,7 @@
|
|||||||
BF1614F1250822F100767AEA /* Roxas.framework in Frameworks */,
|
BF1614F1250822F100767AEA /* Roxas.framework in Frameworks */,
|
||||||
B3C395F7284F362400DA9E2F /* AppCenterAnalytics in Frameworks */,
|
B3C395F7284F362400DA9E2F /* AppCenterAnalytics in Frameworks */,
|
||||||
1F07F5672955D16A00F7BE95 /* SFSafeSymbols in Frameworks */,
|
1F07F5672955D16A00F7BE95 /* SFSafeSymbols in Frameworks */,
|
||||||
|
1FFA56C52999978C0011B6F5 /* LocalConsole in Frameworks */,
|
||||||
BF66EE852501AE50007EE018 /* AltStoreCore.framework in Frameworks */,
|
BF66EE852501AE50007EE018 /* AltStoreCore.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -1249,6 +1253,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
1FB96FEB292C171D007E68D1 /* NotificationManager.swift */,
|
1FB96FEB292C171D007E68D1 /* NotificationManager.swift */,
|
||||||
|
1FFA56C1299994390011B6F5 /* OutputCapturer.swift */,
|
||||||
);
|
);
|
||||||
path = Manager;
|
path = Manager;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -2303,6 +2308,7 @@
|
|||||||
1F74FF1D295263510047C051 /* AsyncImage */,
|
1F74FF1D295263510047C051 /* AsyncImage */,
|
||||||
1F07F5662955D16A00F7BE95 /* SFSafeSymbols */,
|
1F07F5662955D16A00F7BE95 /* SFSafeSymbols */,
|
||||||
1F1295802989B51F0048FCB9 /* ExpandableText */,
|
1F1295802989B51F0048FCB9 /* ExpandableText */,
|
||||||
|
1FFA56C42999978C0011B6F5 /* LocalConsole */,
|
||||||
);
|
);
|
||||||
productName = AltStore;
|
productName = AltStore;
|
||||||
productReference = BFD2476A2284B9A500981D42 /* SideStore.app */;
|
productReference = BFD2476A2284B9A500981D42 /* SideStore.app */;
|
||||||
@@ -2379,6 +2385,7 @@
|
|||||||
1F74FF1C295263510047C051 /* XCRemoteSwiftPackageReference "AsyncImage" */,
|
1F74FF1C295263510047C051 /* XCRemoteSwiftPackageReference "AsyncImage" */,
|
||||||
1F07F5652955D16A00F7BE95 /* XCRemoteSwiftPackageReference "SFSafeSymbols" */,
|
1F07F5652955D16A00F7BE95 /* XCRemoteSwiftPackageReference "SFSafeSymbols" */,
|
||||||
1F12957F2989B51F0048FCB9 /* XCRemoteSwiftPackageReference "ExpandableText" */,
|
1F12957F2989B51F0048FCB9 /* XCRemoteSwiftPackageReference "ExpandableText" */,
|
||||||
|
1FFA56C32999978C0011B6F5 /* XCRemoteSwiftPackageReference "LocalConsole" */,
|
||||||
);
|
);
|
||||||
productRefGroup = BFD2476B2284B9A500981D42 /* Products */;
|
productRefGroup = BFD2476B2284B9A500981D42 /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
@@ -2821,6 +2828,7 @@
|
|||||||
D5DAE0942804B0B80034D8D4 /* ScreenshotProcessor.swift in Sources */,
|
D5DAE0942804B0B80034D8D4 /* ScreenshotProcessor.swift in Sources */,
|
||||||
1FB96FBE292A20E5007E68D1 /* ObservableScrollView.swift in Sources */,
|
1FB96FBE292A20E5007E68D1 /* ObservableScrollView.swift in Sources */,
|
||||||
BFD2476E2284B9A500981D42 /* AppDelegate.swift in Sources */,
|
BFD2476E2284B9A500981D42 /* AppDelegate.swift in Sources */,
|
||||||
|
1FFA56C2299994390011B6F5 /* OutputCapturer.swift in Sources */,
|
||||||
BF41B806233423AE00C593A3 /* TabBarController.swift in Sources */,
|
BF41B806233423AE00C593A3 /* TabBarController.swift in Sources */,
|
||||||
1FB96FC9292ABDD0007E68D1 /* AddSourceView.swift in Sources */,
|
1FB96FC9292ABDD0007E68D1 /* AddSourceView.swift in Sources */,
|
||||||
1F6E08DC292807D3005059C0 /* AppIconView.swift in Sources */,
|
1F6E08DC292807D3005059C0 /* AppIconView.swift in Sources */,
|
||||||
@@ -3760,6 +3768,14 @@
|
|||||||
kind = branch;
|
kind = branch;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
1FFA56C32999978C0011B6F5 /* XCRemoteSwiftPackageReference "LocalConsole" */ = {
|
||||||
|
isa = XCRemoteSwiftPackageReference;
|
||||||
|
repositoryURL = "https://github.com/duraidabdul/LocalConsole.git";
|
||||||
|
requirement = {
|
||||||
|
kind = upToNextMajorVersion;
|
||||||
|
minimumVersion = 1.0.0;
|
||||||
|
};
|
||||||
|
};
|
||||||
4879A95D2861046500FC1BBD /* XCRemoteSwiftPackageReference "AltSign" */ = {
|
4879A95D2861046500FC1BBD /* XCRemoteSwiftPackageReference "AltSign" */ = {
|
||||||
isa = XCRemoteSwiftPackageReference;
|
isa = XCRemoteSwiftPackageReference;
|
||||||
repositoryURL = "https://github.com/SideStore/AltSign";
|
repositoryURL = "https://github.com/SideStore/AltSign";
|
||||||
@@ -3873,6 +3889,11 @@
|
|||||||
package = 1F74FF1C295263510047C051 /* XCRemoteSwiftPackageReference "AsyncImage" */;
|
package = 1F74FF1C295263510047C051 /* XCRemoteSwiftPackageReference "AsyncImage" */;
|
||||||
productName = AsyncImage;
|
productName = AsyncImage;
|
||||||
};
|
};
|
||||||
|
1FFA56C42999978C0011B6F5 /* LocalConsole */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 1FFA56C32999978C0011B6F5 /* XCRemoteSwiftPackageReference "LocalConsole" */;
|
||||||
|
productName = LocalConsole;
|
||||||
|
};
|
||||||
4879A95E2861046500FC1BBD /* AltSign */ = {
|
4879A95E2861046500FC1BBD /* AltSign */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
package = 4879A95D2861046500FC1BBD /* XCRemoteSwiftPackageReference "AltSign" */;
|
package = 4879A95D2861046500FC1BBD /* XCRemoteSwiftPackageReference "AltSign" */;
|
||||||
|
|||||||
@@ -54,6 +54,15 @@
|
|||||||
"version" : "4.2.0"
|
"version" : "4.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"identity" : "localconsole",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/duraidabdul/LocalConsole.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "2c5d5e018acd4963fe6dfe858f6d6fecef7cbf2f",
|
||||||
|
"version" : "1.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"identity" : "nuke",
|
"identity" : "nuke",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
|
|
||||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
|
||||||
{
|
{
|
||||||
|
// Copy STDOUT and STDERR to the logging console
|
||||||
|
_ = OutputCapturer.shared
|
||||||
|
|
||||||
// Register default settings before doing anything else.
|
// Register default settings before doing anything else.
|
||||||
UserDefaults.registerDefaults()
|
UserDefaults.registerDefaults()
|
||||||
|
|
||||||
|
|||||||
49
AltStore/Manager/OutputCapturer.swift
Normal file
49
AltStore/Manager/OutputCapturer.swift
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
//
|
||||||
|
// OutputCapturer.swift
|
||||||
|
// SideStore
|
||||||
|
//
|
||||||
|
// Created by Fabian Thies on 12.02.23.
|
||||||
|
// Copyright © 2023 SideStore. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import LocalConsole
|
||||||
|
|
||||||
|
class OutputCapturer {
|
||||||
|
|
||||||
|
public static let shared = OutputCapturer()
|
||||||
|
|
||||||
|
private let consoleManager = LCManager.shared
|
||||||
|
|
||||||
|
private var inputPipe = Pipe()
|
||||||
|
private var errorPipe = Pipe()
|
||||||
|
|
||||||
|
private init() {
|
||||||
|
// Setup pipe file handlers
|
||||||
|
self.inputPipe.fileHandleForReading.readabilityHandler = { [weak self] fileHandle in
|
||||||
|
self?.handle(data: fileHandle.availableData)
|
||||||
|
}
|
||||||
|
self.errorPipe.fileHandleForReading.readabilityHandler = { [weak self] fileHandle in
|
||||||
|
self?.handle(data: fileHandle.availableData, isError: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intercept STDOUT and STDERR
|
||||||
|
dup2(self.inputPipe.fileHandleForWriting.fileDescriptor, STDOUT_FILENO)
|
||||||
|
dup2(self.errorPipe.fileHandleForWriting.fileDescriptor, STDERR_FILENO)
|
||||||
|
}
|
||||||
|
|
||||||
|
deinit {
|
||||||
|
try? self.inputPipe.fileHandleForReading.close()
|
||||||
|
try? self.errorPipe.fileHandleForReading.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handle(data: Data, isError: Bool = false) {
|
||||||
|
guard let string = String(data: data, encoding: .utf8) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.consoleManager.print(string)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
import AsyncImage
|
import AsyncImage
|
||||||
import SFSafeSymbols
|
import SFSafeSymbols
|
||||||
|
import LocalConsole
|
||||||
import AltStoreCore
|
import AltStoreCore
|
||||||
import Intents
|
import Intents
|
||||||
|
|
||||||
@@ -157,6 +158,10 @@ struct SettingsView: View {
|
|||||||
RefreshAttemptsView()
|
RefreshAttemptsView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SwiftUI.Button("Toggle Console") {
|
||||||
|
LCManager.shared.isVisible.toggle()
|
||||||
|
}
|
||||||
|
|
||||||
if MailComposeView.canSendMail {
|
if MailComposeView.canSendMail {
|
||||||
SwiftUI.Button("Send Feedback") {
|
SwiftUI.Button("Send Feedback") {
|
||||||
self.isShowingFeedbackMailView = true
|
self.isShowingFeedbackMailView = true
|
||||||
|
|||||||
Reference in New Issue
Block a user