mirror of
https://github.com/quexten/goldwarden.git
synced 2025-01-20 23:36:51 +01:00
Use go's embed to have access to the plain files
This makes it pretty easy for distros to install the files already to the correct positions
This commit is contained in:
parent
c134a0e61d
commit
86d4f907fb
11
browserbiometrics/chrome-com.8bit.bitwarden.json
Normal file
11
browserbiometrics/chrome-com.8bit.bitwarden.json
Normal file
@ -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/"
|
||||
]
|
||||
}
|
9
browserbiometrics/goldwarden-proxy.sh
Normal file
9
browserbiometrics/goldwarden-proxy.sh
Normal file
@ -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
|
@ -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/",
|
||||
|
@ -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
|
||||
`
|
9
browserbiometrics/mozilla-com.8bit.bitwarden.json
Normal file
9
browserbiometrics/mozilla-com.8bit.bitwarden.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "com.8bit.bitwarden",
|
||||
"description": "Bitwarden desktop <-> browser bridge",
|
||||
"path": "@PATH@",
|
||||
"type": "stdio",
|
||||
"allowed_extensions": [
|
||||
"{446900e4-71c2-419f-a6a7-df9c091e268b}"
|
||||
]
|
||||
}
|
9
cmd/goldwarden.service
Normal file
9
cmd/goldwarden.service
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description="Goldwarden daemon"
|
||||
After=graphical-session.target
|
||||
|
||||
[Service]
|
||||
ExecStart=@BINARY_PATH@ daemonize
|
||||
|
||||
[Install]
|
||||
WantedBy=graphical-session.target
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user