mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
Anisette URL convenience methods and logging
Signed-off-by: Joseph Mattello <mail@joemattiello.com>
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
4879A9622861049C00FC1BBD /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A9612861049C00FC1BBD /* OpenSSL */; };
|
4879A9622861049C00FC1BBD /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A9612861049C00FC1BBD /* OpenSSL */; };
|
||||||
B3146ED2284F581E00BBC3FD /* Roxas.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3146ECD284F580500BBC3FD /* Roxas.framework */; };
|
B3146ED2284F581E00BBC3FD /* Roxas.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3146ECD284F580500BBC3FD /* Roxas.framework */; };
|
||||||
B3146ED3284F581E00BBC3FD /* Roxas.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B3146ECD284F580500BBC3FD /* Roxas.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
B3146ED3284F581E00BBC3FD /* Roxas.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B3146ECD284F580500BBC3FD /* Roxas.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
|
B376FE3E29258C8900E18883 /* OSLog+SideStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B376FE3D29258C8900E18883 /* OSLog+SideStore.swift */; };
|
||||||
B39575F5284F29E20080B4FF /* Roxas.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B39575F4284F29E20080B4FF /* Roxas.framework */; };
|
B39575F5284F29E20080B4FF /* Roxas.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B39575F4284F29E20080B4FF /* Roxas.framework */; };
|
||||||
B39F16132918D7C5002E9404 /* Consts.swift in Sources */ = {isa = PBXBuildFile; fileRef = B39F16122918D7C5002E9404 /* Consts.swift */; };
|
B39F16132918D7C5002E9404 /* Consts.swift in Sources */ = {isa = PBXBuildFile; fileRef = B39F16122918D7C5002E9404 /* Consts.swift */; };
|
||||||
B39F16152918D7DA002E9404 /* Consts+Proxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B39F16142918D7DA002E9404 /* Consts+Proxy.swift */; };
|
B39F16152918D7DA002E9404 /* Consts+Proxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B39F16142918D7DA002E9404 /* Consts+Proxy.swift */; };
|
||||||
@@ -564,6 +565,7 @@
|
|||||||
1920B04E2924AC8300744F60 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
|
1920B04E2924AC8300744F60 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
|
||||||
19B9B7442845E6DF0076EF69 /* SelectTeamViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectTeamViewController.swift; sourceTree = "<group>"; };
|
19B9B7442845E6DF0076EF69 /* SelectTeamViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectTeamViewController.swift; sourceTree = "<group>"; };
|
||||||
B3146EC6284F580500BBC3FD /* Roxas.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Roxas.xcodeproj; path = Dependencies/Roxas/Roxas.xcodeproj; sourceTree = "<group>"; };
|
B3146EC6284F580500BBC3FD /* Roxas.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Roxas.xcodeproj; path = Dependencies/Roxas/Roxas.xcodeproj; sourceTree = "<group>"; };
|
||||||
|
B376FE3D29258C8900E18883 /* OSLog+SideStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OSLog+SideStore.swift"; sourceTree = "<group>"; };
|
||||||
B39575F4284F29E20080B4FF /* Roxas.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Roxas.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
B39575F4284F29E20080B4FF /* Roxas.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Roxas.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
B39F16122918D7C5002E9404 /* Consts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Consts.swift; sourceTree = "<group>"; };
|
B39F16122918D7C5002E9404 /* Consts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Consts.swift; sourceTree = "<group>"; };
|
||||||
B39F16142918D7DA002E9404 /* Consts+Proxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Consts+Proxy.swift"; sourceTree = "<group>"; };
|
B39F16142918D7DA002E9404 /* Consts+Proxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Consts+Proxy.swift"; sourceTree = "<group>"; };
|
||||||
@@ -1795,6 +1797,7 @@
|
|||||||
BF8CAE4D248AEABA004D6CCE /* UIDevice+Jailbreak.swift */,
|
BF8CAE4D248AEABA004D6CCE /* UIDevice+Jailbreak.swift */,
|
||||||
BFE00A1F2503097F00EB4D0C /* INInteraction+AltStore.swift */,
|
BFE00A1F2503097F00EB4D0C /* INInteraction+AltStore.swift */,
|
||||||
D57F2C9326E01BC700B9FA39 /* UIDevice+Vibration.swift */,
|
D57F2C9326E01BC700B9FA39 /* UIDevice+Vibration.swift */,
|
||||||
|
B376FE3D29258C8900E18883 /* OSLog+SideStore.swift */,
|
||||||
);
|
);
|
||||||
path = Extensions;
|
path = Extensions;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -2764,6 +2767,7 @@
|
|||||||
BF18B0F122E25DF9005C4CF5 /* ToastView.swift in Sources */,
|
BF18B0F122E25DF9005C4CF5 /* ToastView.swift in Sources */,
|
||||||
BF3D649F22E7B24C00E9056B /* CollapsingTextView.swift in Sources */,
|
BF3D649F22E7B24C00E9056B /* CollapsingTextView.swift in Sources */,
|
||||||
BF02419622F2199300129732 /* RefreshAttemptsViewController.swift in Sources */,
|
BF02419622F2199300129732 /* RefreshAttemptsViewController.swift in Sources */,
|
||||||
|
B376FE3E29258C8900E18883 /* OSLog+SideStore.swift in Sources */,
|
||||||
BF08858322DE795100DE9F1E /* MyAppsViewController.swift in Sources */,
|
BF08858322DE795100DE9F1E /* MyAppsViewController.swift in Sources */,
|
||||||
BFC84A4D2421A19100853474 /* SourcesViewController.swift in Sources */,
|
BFC84A4D2421A19100853474 /* SourcesViewController.swift in Sources */,
|
||||||
BFF0B696232242D3007A79E1 /* LicensesViewController.swift in Sources */,
|
BFF0B696232242D3007A79E1 /* LicensesViewController.swift in Sources */,
|
||||||
|
|||||||
65
AltStore/Extensions/OSLog+SideStore.swift
Normal file
65
AltStore/Extensions/OSLog+SideStore.swift
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
//
|
||||||
|
// OSLog+SideStore.swift
|
||||||
|
// SideStore
|
||||||
|
//
|
||||||
|
// Created by Joseph Mattiello on 11/16/22.
|
||||||
|
// Copyright © 2022 Riley Testut. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import OSLog
|
||||||
|
|
||||||
|
let customLog = OSLog(subsystem: "org.sidestore.sidestore",
|
||||||
|
category: "ios")
|
||||||
|
|
||||||
|
|
||||||
|
public extension OSLog {
|
||||||
|
/// Error logger extension
|
||||||
|
/// - Parameters:
|
||||||
|
/// - message: String or format string
|
||||||
|
/// - args: optional args for format string
|
||||||
|
static func error(_ message: StaticString, _ args: CVarArg...) {
|
||||||
|
os_log(message, log: customLog, type: .error, args)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Info logger extension
|
||||||
|
/// - Parameters:
|
||||||
|
/// - message: String or format string
|
||||||
|
/// - args: optional args for format string
|
||||||
|
static func info(_ message: StaticString, _ args: CVarArg...) {
|
||||||
|
os_log(message, log: customLog, type: .info, args)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Debug logger extension
|
||||||
|
/// - Parameters:
|
||||||
|
/// - message: String or format string
|
||||||
|
/// - args: optional args for format string
|
||||||
|
static func debug(_ message: StaticString, _ args: CVarArg...) {
|
||||||
|
os_log(message, log: customLog, type: .debug, args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Error logger convenience method for SideStore logging
|
||||||
|
/// - Parameters:
|
||||||
|
/// - message: String or format string
|
||||||
|
/// - args: optional args for format string
|
||||||
|
public func ELOG(_ message: StaticString, _ args: CVarArg...) {
|
||||||
|
OSLog.error(message, args)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Info logger convenience method for SideStore logging
|
||||||
|
/// - Parameters:
|
||||||
|
/// - message: String or format string
|
||||||
|
/// - args: optional args for format string
|
||||||
|
public func ILOG(_ message: StaticString, _ args: CVarArg...) {
|
||||||
|
OSLog.info(message, args)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Debug logger convenience method for SideStore logging
|
||||||
|
/// - Parameters:
|
||||||
|
/// - message: String or format string
|
||||||
|
/// - args: optional args for format string
|
||||||
|
public func DLOG(_ message: StaticString, _ args: CVarArg...) {
|
||||||
|
OSLog.debug(message, args)
|
||||||
|
}
|
||||||
@@ -13,6 +13,8 @@
|
|||||||
<string>1F7D5B55-79CE-4546-A029-D4DDC4AF3B6D</string>
|
<string>1F7D5B55-79CE-4546-A029-D4DDC4AF3B6D</string>
|
||||||
<key>ALTPairingFile</key>
|
<key>ALTPairingFile</key>
|
||||||
<string><insert pairing file here></string>
|
<string><insert pairing file here></string>
|
||||||
|
<key>ALTAnisetteURL</key>
|
||||||
|
<string>https://sideloadly.io/anisette/irGb3Quww8zrhgqnzmrx</string>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleDocumentTypes</key>
|
<key>CFBundleDocumentTypes</key>
|
||||||
|
|||||||
@@ -13,6 +13,33 @@ import minimuxer
|
|||||||
|
|
||||||
import AltStoreCore
|
import AltStoreCore
|
||||||
import UniformTypeIdentifiers
|
import UniformTypeIdentifiers
|
||||||
|
import OSLog
|
||||||
|
|
||||||
|
public struct AnisetteManager {
|
||||||
|
|
||||||
|
/// User defined URL from Settings/UserDefaults
|
||||||
|
static var userURL: String? {
|
||||||
|
guard let urlString = UserDefaults.shared.customAnisetteURL else { return nil }
|
||||||
|
// Test it's a valid URL
|
||||||
|
guard URL(string: urlString) != nil else {
|
||||||
|
ELOG("UserDefaults has invalid `customAnisetteURL`")
|
||||||
|
assertionFailure("UserDefaults has invalid `customAnisetteURL`")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return urlString
|
||||||
|
}
|
||||||
|
static var defaultURL: String {
|
||||||
|
guard let url = Bundle.main.object(forInfoDictionaryKey: "ALTAnisetteURL") as? String else {
|
||||||
|
assertionFailure("Info.plist has invalid `ALTAnisetteURL`")
|
||||||
|
}
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
static var currentURLString: String { userURL ?? defaultURL }
|
||||||
|
// Force unwrap is safe here since we check validity before hand -- @JoeMatt
|
||||||
|
|
||||||
|
/// User url or default from plist if none specified
|
||||||
|
static var currentURL: URL { URL(string: currentURLString)! }
|
||||||
|
}
|
||||||
|
|
||||||
class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDelegate
|
class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDelegate
|
||||||
{
|
{
|
||||||
@@ -48,7 +75,6 @@ class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDelegate
|
|||||||
override func viewDidAppear(_ animated: Bool) {
|
override func viewDidAppear(_ animated: Bool) {
|
||||||
super.viewDidAppear(true)
|
super.viewDidAppear(true)
|
||||||
start_em_proxy(bind_addr: Consts.Proxy.serverURL)
|
start_em_proxy(bind_addr: Consts.Proxy.serverURL)
|
||||||
setAnisetteServer()
|
|
||||||
|
|
||||||
guard let pf = fetchPairingFile() else {
|
guard let pf = fetchPairingFile() else {
|
||||||
displayError("Device pairing file not found.")
|
displayError("Device pairing file not found.")
|
||||||
@@ -78,7 +104,7 @@ class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDelegate
|
|||||||
} else {
|
} else {
|
||||||
// Show an alert explaining the pairing file
|
// Show an alert explaining the pairing file
|
||||||
// Create new Alert
|
// Create new Alert
|
||||||
var dialogMessage = UIAlertController(title: "Pairing File", message: "Select the pairing file for your device. For more information, go to https://youtu.be/dQw4w9WgXcQ", preferredStyle: .alert)
|
let dialogMessage = UIAlertController(title: "Pairing File", message: "Select the pairing file for your device. For more information, go to https://youtu.be/dQw4w9WgXcQ", preferredStyle: .alert)
|
||||||
|
|
||||||
// Create OK button with action handler
|
// Create OK button with action handler
|
||||||
let ok = UIAlertAction(title: "OK", style: .default, handler: { (action) -> Void in
|
let ok = UIAlertAction(title: "OK", style: .default, handler: { (action) -> Void in
|
||||||
@@ -99,13 +125,7 @@ class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDelegate
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func setAnisetteServer() {
|
|
||||||
if let anisetteUrl = Bundle.main.object(forInfoDictionaryKey: "customAnisetteURL") as? String {
|
|
||||||
UserDefaults.standard.set(anisetteUrl, forKey: "customAnisetteURL")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func displayError(_ msg: String) {
|
func displayError(_ msg: String) {
|
||||||
print(msg)
|
print(msg)
|
||||||
// Create a new alert
|
// Create a new alert
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<key>Key</key>
|
<key>Key</key>
|
||||||
<string>customAnisetteURL</string>
|
<string>customAnisetteURL</string>
|
||||||
<key>DefaultValue</key>
|
<key>DefaultValue</key>
|
||||||
<string>https://sideloadly.io/anisette/irGb3Quww8zrhgqnzmrx</string>
|
<string></string>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
// AltStore
|
// AltStore
|
||||||
//
|
//
|
||||||
// Created by Riley Testut on 6/4/19.
|
// Created by Riley Testut on 6/4/19.
|
||||||
// Copyright © 2019 Riley Testut. All rights reserved.
|
// Copyright © 2019 SideStore. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|||||||
Reference in New Issue
Block a user