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
|
@ -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/"
|
||||||
|
]
|
||||||
|
}
|
|
@ -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
|
package browserbiometrics
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -10,6 +11,15 @@ import (
|
||||||
"github.com/quexten/goldwarden/browserbiometrics/logging"
|
"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{
|
var chromiumPaths = []string{
|
||||||
"~/.config/google-chrome/",
|
"~/.config/google-chrome/",
|
||||||
"~/.config/google-chrome-beta/",
|
"~/.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
|
|
||||||
`
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name": "com.8bit.bitwarden",
|
||||||
|
"description": "Bitwarden desktop <-> browser bridge",
|
||||||
|
"path": "@PATH@",
|
||||||
|
"type": "stdio",
|
||||||
|
"allowed_extensions": [
|
||||||
|
"{446900e4-71c2-419f-a6a7-df9c091e268b}"
|
||||||
|
]
|
||||||
|
}
|
|
@ -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
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
@ -81,15 +82,8 @@ var polkitCmd = &cobra.Command{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const SYSTEMD_SERVICE = `[Unit]
|
//go:embed goldwarden.service
|
||||||
Description="Goldwarden daemon"
|
var systemdService string
|
||||||
After=graphical-session.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=BINARY_PATH daemonize
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=graphical-session.target`
|
|
||||||
|
|
||||||
func setupSystemd() {
|
func setupSystemd() {
|
||||||
if isRoot() {
|
if isRoot() {
|
||||||
|
@ -107,7 +101,7 @@ func setupSystemd() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
file.WriteString(strings.ReplaceAll(SYSTEMD_SERVICE, "BINARY_PATH", path))
|
file.WriteString(strings.ReplaceAll(systemdService, "@BINARY_PATH@", path))
|
||||||
file.Close()
|
file.Close()
|
||||||
|
|
||||||
userDirectory := os.Getenv("HOME")
|
userDirectory := os.Getenv("HOME")
|
||||||
|
|
Loading…
Reference in New Issue