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) ## 0.1.0a10 (2025-02-17)
### Fix ### Fix

View file

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

View file

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