Improve biometric socket path detection

This commit is contained in:
Bernd Schoolmann 2024-02-17 12:11:30 +01:00
parent 5cc502580f
commit 3b2d1fcf11
No known key found for this signature in database
1 changed files with 15 additions and 7 deletions

22
main.go
View File

@ -41,15 +41,18 @@ func main() {
panic(err)
}
if runtimeConfig.SSHAgentSocketPath == "" {
runtimeConfig.SSHAgentSocketPath = home + "/.goldwarden-ssh-agent.sock"
if _, err := os.Stat(home + "/.ssh-agent-socket"); err == nil {
runtimeConfig.SSHAgentSocketPath = home + "/.ssh-agent-socket"
} else if _, err := os.Stat(home + "/.var/app/com.quexten.Goldwarden/data/ssh-auth-sock"); err == nil {
runtimeConfig.SSHAgentSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/ssh-auth-sock"
}
}
if runtimeConfig.GoldwardenSocketPath == "" {
runtimeConfig.GoldwardenSocketPath = home + "/.goldwarden.sock"
}
if len(os.Args) > 1 && (strings.Contains(os.Args[1], "com.8bit.bitwarden.json") || strings.Contains(os.Args[1], "chrome-extension://")) {
browserbiometrics.Main(&runtimeConfig)
return
if _, err := os.Stat(home + "/.goldwarden.sock"); err == nil {
runtimeConfig.GoldwardenSocketPath = home + "/.goldwarden.sock"
} else if _, err := os.Stat(home + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"); err == nil {
runtimeConfig.GoldwardenSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"
}
}
_, err = os.Stat("/.flatpak-info")
@ -62,5 +65,10 @@ func main() {
runtimeConfig.GoldwardenSocketPath = userHome + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"
}
if len(os.Args) > 1 && (strings.Contains(os.Args[1], "com.8bit.bitwarden.json") || strings.Contains(os.Args[1], "chrome-extension://")) {
browserbiometrics.Main(&runtimeConfig)
return
}
cmd.Execute(runtimeConfig)
}