From c134a0e61d51079c44865f68ab65cfb3aea6f8f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 15 Mar 2024 15:29:55 +0100 Subject: [PATCH] Replace @PATH@, cleanup formatting a bit This makes it easier to replace the path to the script in NixOS --- browserbiometrics/main.go | 4 ++-- browserbiometrics/manifests.go | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/browserbiometrics/main.go b/browserbiometrics/main.go index b65b8d4..070f300 100644 --- a/browserbiometrics/main.go +++ b/browserbiometrics/main.go @@ -130,7 +130,7 @@ func detectAndInstallBrowsers(startPath string) error { } fmt.Println("Writing new manifest") - manifest := strings.Replace(templateMozilla, "PATH", path+"/goldwarden-proxy.sh", 1) + 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 @@ -163,7 +163,7 @@ func detectAndInstallBrowsers(startPath string) error { } fmt.Println("Writing new manifest") - manifest := strings.Replace(templateChrome, "PATH", path+"/goldwarden-proxy.sh", 1) + 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 diff --git a/browserbiometrics/manifests.go b/browserbiometrics/manifests.go index 5b54a70..94ee192 100644 --- a/browserbiometrics/manifests.go +++ b/browserbiometrics/manifests.go @@ -1,26 +1,26 @@ package browserbiometrics const templateMozilla = `{ - "name": "com.8bit.bitwarden", - "description": "Bitwarden desktop <-> browser bridge", - "path": "PATH", - "type": "stdio", - "allowed_extensions": [ - "{446900e4-71c2-419f-a6a7-df9c091e268b}" - ] + "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", + "path": "@PATH@", "type": "stdio", "allowed_origins": [ - "chrome-extension://nngceckbapebfimnlniiiahkandclblb/", - "chrome-extension://jbkfoedolllekgbhcbcoahefnbanhhlh/", - "chrome-extension://ccnckbpmaceehanjmeomladnmlffdjgn/" + "chrome-extension://nngceckbapebfimnlniiiahkandclblb/", + "chrome-extension://jbkfoedolllekgbhcbcoahefnbanhhlh/", + "chrome-extension://ccnckbpmaceehanjmeomladnmlffdjgn/" ] - }` +}` const proxyScript = `#!/usr/bin/env bash