Compare commits

...

2 commits

5 changed files with 43 additions and 28 deletions

View file

@ -1,3 +1,9 @@
## 0.1.0a11 (2025-02-19)
### Fix
- if mock is active, do not search rbw or bw
## 0.1.0a10 (2025-02-17)
### Fix

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail.user_data_bitwarden"
version = "0.1.0a10"
version = "0.1.0a11"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "Rougail user_data Bitwarden"

View file

@ -55,33 +55,34 @@ class RougailUserDataBitwarden:
self.leader_informations = {}
bitwarden_command_line = None
one_is_find = False
if which('rbw'):
one_is_find = True
try:
cpe = run(['rbw', 'unlocked'], capture_output=True)
except Exception as exc:
pass
else:
if cpe.returncode == 0:
bitwarden_command_line = 'rbw'
if bitwarden_command_line is None and which('bw'):
one_is_find = True
try:
cpe = run(['bw', 'status'], capture_output=True)
except Exception as exc:
pass
else:
if cpe.returncode == 0:
try:
data = loads(cpe.stdout.decode('utf8'))
if data["status"] == "unlocked":
bitwarden_command_line = 'bw'
except:
pass
if bitwarden_command_line is None:
if one_is_find:
raise ExtentionError(_('please unlock Bitwarden password database'))
raise ExtentionError(_('cannot find Bitwarden command (rbw or bw) please install it'))
if 'ROUGAIL_BITWARDEN_MOCK_ENABLE' not in environ:
if which('rbw'):
one_is_find = True
try:
cpe = run(['rbw', 'unlocked'], capture_output=True)
except Exception as exc:
pass
else:
if cpe.returncode == 0:
bitwarden_command_line = 'rbw'
if bitwarden_command_line is None and which('bw'):
one_is_find = True
try:
cpe = run(['bw', 'status'], capture_output=True)
except Exception as exc:
pass
else:
if cpe.returncode == 0:
try:
data = loads(cpe.stdout.decode('utf8'))
if data["status"] == "unlocked":
bitwarden_command_line = 'bw'
except:
pass
if bitwarden_command_line is None:
if one_is_find:
raise ExtentionError(_('please unlock Bitwarden password database'))
raise ExtentionError(_('cannot find Bitwarden command (rbw or bw) please install it'))
self.bitwarden_command_line = bitwarden_command_line
def run(self):

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1,4 @@
{
"rougail.username": "bitwarden_username",
"rougail.secret": "bitwarden_password"
}