Compare commits

..

No commits in common. "e9ef79e80b2cc24815a29c1497a5199400e8693f" and "4c72346aa6eec5a2c55799ad37256538a67f1ddf" have entirely different histories.

5 changed files with 28 additions and 43 deletions

View file

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

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

View file

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