mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-09 15:58:48 +00:00
cli: avoid fingerprint prompt when option provided
This commit is contained in:
@@ -51,9 +51,10 @@ def start_server(fingerprint: str | None = None) -> str:
|
||||
Optional seed profile fingerprint to select before starting the server.
|
||||
"""
|
||||
global _pm, _token
|
||||
_pm = PasswordManager()
|
||||
if fingerprint:
|
||||
_pm.select_fingerprint(fingerprint)
|
||||
if fingerprint is None:
|
||||
_pm = PasswordManager()
|
||||
else:
|
||||
_pm = PasswordManager(fingerprint=fingerprint)
|
||||
_token = secrets.token_urlsafe(16)
|
||||
print(f"API token: {_token}")
|
||||
origins = [
|
||||
|
@@ -44,11 +44,11 @@ app.add_typer(api_app, name="api")
|
||||
|
||||
def _get_pm(ctx: typer.Context) -> PasswordManager:
|
||||
"""Return a PasswordManager optionally selecting a fingerprint."""
|
||||
pm = PasswordManager()
|
||||
fp = ctx.obj.get("fingerprint")
|
||||
if fp:
|
||||
# `select_fingerprint` will initialize managers
|
||||
pm.select_fingerprint(fp)
|
||||
if fp is None:
|
||||
pm = PasswordManager()
|
||||
else:
|
||||
pm = PasswordManager(fingerprint=fp)
|
||||
return pm
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user