diff --git a/StikDebug/App/AppBootstrapper.swift b/StikDebug/App/AppBootstrapper.swift index cc6260a..ffb94ac 100644 --- a/StikDebug/App/AppBootstrapper.swift +++ b/StikDebug/App/AppBootstrapper.swift @@ -21,6 +21,7 @@ enum AppBootstrapper { UserDefaults.standard.register(defaults: [ "enableAdvancedOptions": enableAdvancedOptions, UserDefaults.Keys.txmOverride: false, + UserDefaults.Keys.confirmExternalJITRequests: true, "keepAliveAudio": true, "keepAliveLocation": true ]) diff --git a/StikDebug/Support/UserDefaults+Keys.swift b/StikDebug/Support/UserDefaults+Keys.swift index 014ef21..c0ededa 100644 --- a/StikDebug/Support/UserDefaults+Keys.swift +++ b/StikDebug/Support/UserDefaults+Keys.swift @@ -9,6 +9,8 @@ extension UserDefaults { enum Keys { /// Forces the app to treat the current device as TXM-capable so scripts always run. static let txmOverride = "overrideTXMForScripts" + /// Requires confirmation before external links can enable JIT. + static let confirmExternalJITRequests = "confirmExternalJITRequests" static let bundleScriptMap = "BundleScriptMap" static let defaultScriptName = "DefaultScriptName" static let defaultScriptNameValue = "" diff --git a/StikDebug/Views/HomeView.swift b/StikDebug/Views/HomeView.swift index 1bea75b..a647853 100644 --- a/StikDebug/Views/HomeView.swift +++ b/StikDebug/Views/HomeView.swift @@ -10,6 +10,7 @@ import SwiftUI struct HomeView: View { @AppStorage("autoQuitAfterEnablingJIT") private var doAutoQuitAfterEnablingJIT = false @AppStorage("bundleID") private var bundleID: String = "" + @AppStorage(UserDefaults.Keys.confirmExternalJITRequests) private var confirmExternalJITRequests = true @ObservedObject private var mounting = MountingProgress.shared @@ -180,7 +181,12 @@ struct HomeView: View { config.scriptData = scriptInfo.data config.scriptName = scriptInfo.name } - pendingExternalURLAction = .enableJIT(config) + let action = HomeExternalAction.enableJIT(config) + if confirmExternalJITRequests { + pendingExternalURLAction = action + } else { + performExternalURLAction(action) + } case "kill-process": if let pidStr = queryValue(["pid"], in: components), let pid = Int(pidStr) { pendingExternalURLAction = .killProcess(pid) diff --git a/StikDebug/Views/SettingsView.swift b/StikDebug/Views/SettingsView.swift index 31f668e..bfa4043 100644 --- a/StikDebug/Views/SettingsView.swift +++ b/StikDebug/Views/SettingsView.swift @@ -15,6 +15,7 @@ private enum SettingsLinks { struct SettingsView: View { @AppStorage(UserDefaults.Keys.txmOverride) private var overrideTXMDetection = false + @AppStorage(UserDefaults.Keys.confirmExternalJITRequests) private var confirmExternalJITRequests = true @AppStorage("keepAliveAudio") private var keepAliveAudio = true @AppStorage("keepAliveLocation") private var keepAliveLocation = true @@ -112,6 +113,14 @@ struct SettingsView: View { } Section("Behavior") { + Toggle(isOn: $confirmExternalJITRequests) { + VStack(alignment: .leading, spacing: 2) { + Text("Confirm JIT Links") + Text("Ask before external links enable JIT or run scripts.") + .font(.caption).foregroundStyle(.secondary) + } + } + Toggle(isOn: $overrideTXMDetection) { VStack(alignment: .leading, spacing: 2) { Text("Always Run Scripts")