mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-11-24 03:00:56 +00:00
Merge branch 'main' into patch-smartcard-lacontext-cache
This commit is contained in:
commit
39b397f509
File diff suppressed because it is too large
Load Diff
@ -47,6 +47,7 @@ extension Agent {
|
|||||||
logger.debug("Agent returned \(SSHAgent.Response.agentSignResponse.debugDescription)")
|
logger.debug("Agent returned \(SSHAgent.Response.agentSignResponse.debugDescription)")
|
||||||
case .unknown(let value):
|
case .unknown(let value):
|
||||||
logger.error("Agent received unknown request of type \(value).")
|
logger.error("Agent received unknown request of type \(value).")
|
||||||
|
throw UnhandledRequestError()
|
||||||
default:
|
default:
|
||||||
logger.debug("Agent received valid request of type \(request.debugDescription), but not currently supported.")
|
logger.debug("Agent received valid request of type \(request.debugDescription), but not currently supported.")
|
||||||
throw UnhandledRequestError()
|
throw UnhandledRequestError()
|
||||||
|
|||||||
@ -17,7 +17,8 @@ struct Secretive: App {
|
|||||||
.onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in
|
.onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in
|
||||||
Task {
|
Task {
|
||||||
@AppStorage("defaultsHasRunSetup") var hasRunSetup = false
|
@AppStorage("defaultsHasRunSetup") var hasRunSetup = false
|
||||||
guard hasRunSetup else { return }
|
@AppStorage("explicitlyDisabled") var explicitlyDisabled = false
|
||||||
|
guard hasRunSetup && !explicitlyDisabled else { return }
|
||||||
agentLaunchController.check()
|
agentLaunchController.check()
|
||||||
guard !agentLaunchController.developmentBuild else { return }
|
guard !agentLaunchController.developmentBuild else { return }
|
||||||
if justUpdatedChecker.justUpdatedBuild || !agentLaunchController.running {
|
if justUpdatedChecker.justUpdatedBuild || !agentLaunchController.running {
|
||||||
|
|||||||
@ -40,7 +40,7 @@ import ServiceManagement
|
|||||||
|
|
||||||
// The process corresponding to this instance of Secretive
|
// The process corresponding to this instance of Secretive
|
||||||
var instanceSecretAgentProcess: NSRunningApplication? {
|
var instanceSecretAgentProcess: NSRunningApplication? {
|
||||||
// FIXME: CHECK VERSION
|
// TODO: CHECK VERSION
|
||||||
let agents = allSecretAgentProcesses
|
let agents = allSecretAgentProcesses
|
||||||
for agent in agents {
|
for agent in agents {
|
||||||
guard let url = agent.bundleURL else { continue }
|
guard let url = agent.bundleURL else { continue }
|
||||||
|
|||||||
@ -10,6 +10,7 @@ struct ToolConfigurationView: View {
|
|||||||
|
|
||||||
@State var creating = false
|
@State var creating = false
|
||||||
@State var selectedSecret: AnySecret?
|
@State var selectedSecret: AnySecret?
|
||||||
|
@State var email = ""
|
||||||
|
|
||||||
init(selectedInstruction: ConfigurationFileInstructions) {
|
init(selectedInstruction: ConfigurationFileInstructions) {
|
||||||
self.selectedInstruction = selectedInstruction
|
self.selectedInstruction = selectedInstruction
|
||||||
@ -48,6 +49,12 @@ struct ToolConfigurationView: View {
|
|||||||
.tag(secret)
|
.tag(secret)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TextField(text: $email, prompt: Text(.integrationsConfigureUsingEmailPlaceholder)) {
|
||||||
|
Text(.integrationsConfigureUsingEmailTitle)
|
||||||
|
Text(.integrationsConfigureUsingEmailSubtitle)
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
}
|
||||||
} header: {
|
} header: {
|
||||||
Text(.integrationsConfigureUsingSecretHeader)
|
Text(.integrationsConfigureUsingSecretHeader)
|
||||||
}
|
}
|
||||||
@ -102,9 +109,11 @@ struct ToolConfigurationView: View {
|
|||||||
func placeholdersReplaced(text: String) -> String {
|
func placeholdersReplaced(text: String) -> String {
|
||||||
guard let selectedSecret else { return text }
|
guard let selectedSecret else { return text }
|
||||||
let writer = OpenSSHPublicKeyWriter()
|
let writer = OpenSSHPublicKeyWriter()
|
||||||
|
let gitAllowedSignersString = [email.isEmpty ? String(localized: .integrationsConfigureUsingEmailPlaceholder) : email, writer.openSSHString(secret: selectedSecret)]
|
||||||
|
.joined(separator: " ")
|
||||||
let fileController = PublicKeyFileStoreController(homeDirectory: URL.agentHomeURL)
|
let fileController = PublicKeyFileStoreController(homeDirectory: URL.agentHomeURL)
|
||||||
return text
|
return text
|
||||||
.replacingOccurrences(of: Instructions.Constants.publicKeyPlaceholder, with: writer.openSSHString(secret: selectedSecret))
|
.replacingOccurrences(of: Instructions.Constants.publicKeyPlaceholder, with: gitAllowedSignersString)
|
||||||
.replacingOccurrences(of: Instructions.Constants.publicKeyPathPlaceholder, with: fileController.publicKeyPath(for: selectedSecret))
|
.replacingOccurrences(of: Instructions.Constants.publicKeyPathPlaceholder, with: fileController.publicKeyPath(for: selectedSecret))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@ struct AgentStatusView: View {
|
|||||||
struct AgentRunningView: View {
|
struct AgentRunningView: View {
|
||||||
|
|
||||||
@Environment(\.agentLaunchController) private var agentLaunchController: any AgentLaunchControllerProtocol
|
@Environment(\.agentLaunchController) private var agentLaunchController: any AgentLaunchControllerProtocol
|
||||||
|
@AppStorage("explicitlyDisabled") var explicitlyDisabled = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Form {
|
Form {
|
||||||
@ -53,6 +54,7 @@ struct AgentRunningView: View {
|
|||||||
Menu(.agentDetailsRestartAgentButton) {
|
Menu(.agentDetailsRestartAgentButton) {
|
||||||
Button(.agentDetailsDisableAgentButton) {
|
Button(.agentDetailsDisableAgentButton) {
|
||||||
Task {
|
Task {
|
||||||
|
explicitlyDisabled = true
|
||||||
try? await agentLaunchController
|
try? await agentLaunchController
|
||||||
.uninstall()
|
.uninstall()
|
||||||
}
|
}
|
||||||
@ -79,6 +81,7 @@ struct AgentNotRunningView: View {
|
|||||||
@Environment(\.agentLaunchController) private var agentLaunchController
|
@Environment(\.agentLaunchController) private var agentLaunchController
|
||||||
@State var triedRestart = false
|
@State var triedRestart = false
|
||||||
@State var loading = false
|
@State var loading = false
|
||||||
|
@AppStorage("explicitlyDisabled") var explicitlyDisabled = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Form {
|
Form {
|
||||||
@ -94,6 +97,7 @@ struct AgentNotRunningView: View {
|
|||||||
if !triedRestart {
|
if !triedRestart {
|
||||||
Spacer()
|
Spacer()
|
||||||
Button {
|
Button {
|
||||||
|
explicitlyDisabled = false
|
||||||
guard !loading else { return }
|
guard !loading else { return }
|
||||||
loading = true
|
loading = true
|
||||||
Task {
|
Task {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user