Add flatpak biometric setup
This commit is contained in:
parent
3b2d1fcf11
commit
623fdcb719
|
@ -108,19 +108,40 @@ func detectAndInstallBrowsers(startPath string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
binPath, err := os.Executable()
|
if info.IsDir() && info.Name() == "native-messaging-hosts" {
|
||||||
|
fmt.Printf("Found mozilla-like browser: %s\n", path)
|
||||||
|
|
||||||
|
os.Chown(path+"/com.8bit.bitwarden.json", 7, 7)
|
||||||
|
os.Remove(path + "/com.8bit.bitwarden.json")
|
||||||
|
os.Chown(path+"/goldwarden-proxy.sh", 7, 7)
|
||||||
|
os.Remove(path + "/goldwarden-proxy.sh")
|
||||||
|
|
||||||
|
manifest := strings.Replace(templateMozilla, "PATH", path+"/goldwarden-proxy.sh", 1)
|
||||||
|
err = os.WriteFile(path+"/com.8bit.bitwarden.json", []byte(manifest), 0444)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = os.WriteFile(path+"/goldwarden-proxy.sh", []byte(proxyScript), 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.IsDir() && info.Name() == "native-messaging-hosts" {
|
|
||||||
fmt.Printf("Found mozilla-like browser: %s\n", path)
|
|
||||||
manifest := strings.Replace(templateMozilla, "PATH", binPath, 1)
|
|
||||||
err = os.WriteFile(path+"/com.8bit.bitwarden.json", []byte(manifest), 0644)
|
|
||||||
} else if info.IsDir() && info.Name() == "NativeMessagingHosts" {
|
} else if info.IsDir() && info.Name() == "NativeMessagingHosts" {
|
||||||
fmt.Printf("Found chrome-like browser: %s\n", path)
|
fmt.Printf("Found chrome-like browser: %s\n", path)
|
||||||
manifest := strings.Replace(templateChrome, "PATH", binPath, 1)
|
|
||||||
err = os.WriteFile(path+"/com.8bit.bitwarden.json", []byte(manifest), 0644)
|
os.Chown(path+"/com.8bit.bitwarden.json", 7, 7)
|
||||||
|
os.Remove(path + "/com.8bit.bitwarden.json")
|
||||||
|
os.Chown(path+"/goldwarden-proxy.sh", 7, 7)
|
||||||
|
os.Remove(path + "/goldwarden-proxy.sh")
|
||||||
|
|
||||||
|
manifest := strings.Replace(templateChrome, "PATH", path+"/goldwarden-proxy.sh", 1)
|
||||||
|
err = os.WriteFile(path+"/com.8bit.bitwarden.json", []byte(manifest), 0444)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = os.WriteFile(path+"/goldwarden-proxy.sh", []byte(proxyScript), 0755)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -21,3 +21,14 @@ const templateChrome = `{
|
||||||
"chrome-extension://ccnckbpmaceehanjmeomladnmlffdjgn/"
|
"chrome-extension://ccnckbpmaceehanjmeomladnmlffdjgn/"
|
||||||
]
|
]
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
const proxyScript = `#!/bin/bash
|
||||||
|
|
||||||
|
# Check if the "com.quexten.Goldwarden" Flatpak is installed
|
||||||
|
if flatpak list | grep -q "com.quexten.Goldwarden"; then
|
||||||
|
flatpak run --command=goldwarden com.quexten.Goldwarden "$@"
|
||||||
|
else
|
||||||
|
# If not installed, attempt to run the local version
|
||||||
|
goldwarden "$@"
|
||||||
|
fi
|
||||||
|
`
|
||||||
|
|
Loading…
Reference in New Issue