diff --git a/browserbiometrics/chrome-com.8bit.bitwarden.json b/browserbiometrics/chrome-com.8bit.bitwarden.json new file mode 100644 index 0000000..7564212 --- /dev/null +++ b/browserbiometrics/chrome-com.8bit.bitwarden.json @@ -0,0 +1,11 @@ +{ + "name": "com.8bit.bitwarden", + "description": "Bitwarden desktop <-> browser bridge", + "path": "@PATH@", + "type": "stdio", + "allowed_origins": [ + "chrome-extension://nngceckbapebfimnlniiiahkandclblb/", + "chrome-extension://jbkfoedolllekgbhcbcoahefnbanhhlh/", + "chrome-extension://ccnckbpmaceehanjmeomladnmlffdjgn/" + ] +} diff --git a/browserbiometrics/goldwarden-proxy.sh b/browserbiometrics/goldwarden-proxy.sh new file mode 100644 index 0000000..e81775d --- /dev/null +++ b/browserbiometrics/goldwarden-proxy.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env 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 diff --git a/browserbiometrics/main.go b/browserbiometrics/main.go index 070f300..93b18ea 100644 --- a/browserbiometrics/main.go +++ b/browserbiometrics/main.go @@ -1,6 +1,7 @@ package browserbiometrics import ( + _ "embed" "fmt" "os" "path/filepath" @@ -10,6 +11,15 @@ import ( "github.com/quexten/goldwarden/browserbiometrics/logging" ) +//go:embed mozilla-com.8bit.bitwarden.json +var templateMozilla string + +//go:embed chrome-com.8bit.bitwarden.json +var templateChrome string + +//go:embed goldwarden-proxy.sh +var proxyScript string + var chromiumPaths = []string{ "~/.config/google-chrome/", "~/.config/google-chrome-beta/", diff --git a/browserbiometrics/manifests.go b/browserbiometrics/manifests.go deleted file mode 100644 index 94ee192..0000000 --- a/browserbiometrics/manifests.go +++ /dev/null @@ -1,34 +0,0 @@ -package browserbiometrics - -const templateMozilla = `{ - "name": "com.8bit.bitwarden", - "description": "Bitwarden desktop <-> browser bridge", - "path": "@PATH@", - "type": "stdio", - "allowed_extensions": [ - "{446900e4-71c2-419f-a6a7-df9c091e268b}" - ] -}` - -const templateChrome = `{ - "name": "com.8bit.bitwarden", - "description": "Bitwarden desktop <-> browser bridge", - "path": "@PATH@", - "type": "stdio", - "allowed_origins": [ - "chrome-extension://nngceckbapebfimnlniiiahkandclblb/", - "chrome-extension://jbkfoedolllekgbhcbcoahefnbanhhlh/", - "chrome-extension://ccnckbpmaceehanjmeomladnmlffdjgn/" - ] -}` - -const proxyScript = `#!/usr/bin/env 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 -` diff --git a/browserbiometrics/mozilla-com.8bit.bitwarden.json b/browserbiometrics/mozilla-com.8bit.bitwarden.json new file mode 100644 index 0000000..8d6c356 --- /dev/null +++ b/browserbiometrics/mozilla-com.8bit.bitwarden.json @@ -0,0 +1,9 @@ +{ + "name": "com.8bit.bitwarden", + "description": "Bitwarden desktop <-> browser bridge", + "path": "@PATH@", + "type": "stdio", + "allowed_extensions": [ + "{446900e4-71c2-419f-a6a7-df9c091e268b}" + ] +} diff --git a/cmd/goldwarden.service b/cmd/goldwarden.service new file mode 100644 index 0000000..b59e93e --- /dev/null +++ b/cmd/goldwarden.service @@ -0,0 +1,9 @@ +[Unit] +Description="Goldwarden daemon" +After=graphical-session.target + +[Service] +ExecStart=@BINARY_PATH@ daemonize + +[Install] +WantedBy=graphical-session.target diff --git a/cmd/setup_linux.go b/cmd/setup_linux.go index 1407b04..a45a6ec 100644 --- a/cmd/setup_linux.go +++ b/cmd/setup_linux.go @@ -3,6 +3,7 @@ package cmd import ( + _ "embed" "fmt" "log" "os" @@ -81,15 +82,8 @@ var polkitCmd = &cobra.Command{ }, } -const SYSTEMD_SERVICE = `[Unit] -Description="Goldwarden daemon" -After=graphical-session.target - -[Service] -ExecStart=BINARY_PATH daemonize - -[Install] -WantedBy=graphical-session.target` +//go:embed goldwarden.service +var systemdService string func setupSystemd() { if isRoot() { @@ -107,7 +101,7 @@ func setupSystemd() { panic(err) } - file.WriteString(strings.ReplaceAll(SYSTEMD_SERVICE, "BINARY_PATH", path)) + file.WriteString(strings.ReplaceAll(systemdService, "@BINARY_PATH@", path)) file.Close() userDirectory := os.Getenv("HOME")