1
0
mirror of https://github.com/vwxyzjn/portwarden synced 2025-12-06 01:33:18 +00:00

API-19 # Add simple arguments to enable Portwarden not logging out of Bitwarden

This commit is contained in:
Costa Huang
2019-01-10 00:34:53 -05:00
parent 5281ef7324
commit 74a7e4e6e7
2 changed files with 12 additions and 3 deletions

View File

@@ -29,6 +29,7 @@ var (
passphrase string
filename string
sleepMilliseconds int
noLogout bool
)
func main() {
@@ -51,6 +52,11 @@ func main() {
Destination: &sleepMilliseconds,
Value: 300,
},
cli.BoolFlag{
Name: "no-logout",
Usage: "If set to true, then Portwarden won't log you out of the Bitwarden CLI",
Destination: &noLogout,
},
}
app.Commands = []cli.Command{
@@ -108,7 +114,7 @@ func EncryptBackupController(fileName, passphrase string) error {
if err != nil {
return err
}
return portwarden.CreateBackupFile(fileName, passphrase, sessionKey, sleepMilliseconds)
return portwarden.CreateBackupFile(fileName, passphrase, sessionKey, sleepMilliseconds, noLogout)
}
func DecryptBackupController(fileName, passphrase string) error {

View File

@@ -62,8 +62,11 @@ func CreateBackupBytesUsingBitwardenLocalJSON(dataJson []byte, BITWARDENCLI_APPD
return CreateBackupBytes(passphrase, sessionKey, sleepMilliseconds)
}
func CreateBackupFile(fileName, passphrase, sessionKey string, sleepMilliseconds int) error {
defer BWLogout()
func CreateBackupFile(fileName, passphrase, sessionKey string, sleepMilliseconds int, noLogout bool) error {
if !noLogout {
fmt.Println("true")
defer BWLogout()
}
if !strings.HasSuffix(fileName, ".portwarden") {
fileName += ".portwarden"
}