mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-08 07:18:47 +00:00
Enhance fingerprint headers
This commit is contained in:
64
src/main.py
64
src/main.py
@@ -587,10 +587,16 @@ def handle_toggle_secret_mode(pm: PasswordManager) -> None:
|
||||
def handle_profiles_menu(password_manager: PasswordManager) -> None:
|
||||
"""Submenu for managing seed profiles."""
|
||||
while True:
|
||||
fp, parent_fp, child_fp = getattr(
|
||||
password_manager,
|
||||
"header_fingerprint_args",
|
||||
(getattr(password_manager, "current_fingerprint", None), None, None),
|
||||
)
|
||||
clear_and_print_fingerprint(
|
||||
getattr(password_manager, "header_fingerprint", None)
|
||||
or getattr(password_manager, "current_fingerprint", None),
|
||||
fp,
|
||||
"Main Menu > Settings > Profiles",
|
||||
parent_fingerprint=parent_fp,
|
||||
child_fingerprint=child_fp,
|
||||
)
|
||||
print(color_text("\nProfiles:", "menu"))
|
||||
print(color_text("1. Switch Seed Profile", "menu"))
|
||||
@@ -627,10 +633,16 @@ def handle_nostr_menu(password_manager: PasswordManager) -> None:
|
||||
return
|
||||
|
||||
while True:
|
||||
fp, parent_fp, child_fp = getattr(
|
||||
password_manager,
|
||||
"header_fingerprint_args",
|
||||
(getattr(password_manager, "current_fingerprint", None), None, None),
|
||||
)
|
||||
clear_and_print_fingerprint(
|
||||
getattr(password_manager, "header_fingerprint", None)
|
||||
or getattr(password_manager, "current_fingerprint", None),
|
||||
fp,
|
||||
"Main Menu > Settings > Nostr",
|
||||
parent_fingerprint=parent_fp,
|
||||
child_fingerprint=child_fp,
|
||||
)
|
||||
print(color_text("\nNostr Settings:", "menu"))
|
||||
print(color_text("1. Backup to Nostr", "menu"))
|
||||
@@ -665,10 +677,16 @@ def handle_nostr_menu(password_manager: PasswordManager) -> None:
|
||||
def handle_settings(password_manager: PasswordManager) -> None:
|
||||
"""Interactive settings menu with submenus for profiles and Nostr."""
|
||||
while True:
|
||||
fp, parent_fp, child_fp = getattr(
|
||||
password_manager,
|
||||
"header_fingerprint_args",
|
||||
(getattr(password_manager, "current_fingerprint", None), None, None),
|
||||
)
|
||||
clear_and_print_fingerprint(
|
||||
getattr(password_manager, "header_fingerprint", None)
|
||||
or getattr(password_manager, "current_fingerprint", None),
|
||||
fp,
|
||||
"Main Menu > Settings",
|
||||
parent_fingerprint=parent_fp,
|
||||
child_fingerprint=child_fp,
|
||||
)
|
||||
print(color_text("\nSettings:", "menu"))
|
||||
print(color_text("1. Profiles", "menu"))
|
||||
@@ -760,10 +778,16 @@ def display_menu(
|
||||
display_fn()
|
||||
pause()
|
||||
while True:
|
||||
fp, parent_fp, child_fp = getattr(
|
||||
password_manager,
|
||||
"header_fingerprint_args",
|
||||
(getattr(password_manager, "current_fingerprint", None), None, None),
|
||||
)
|
||||
clear_and_print_fingerprint(
|
||||
getattr(password_manager, "header_fingerprint", None)
|
||||
or getattr(password_manager, "current_fingerprint", None),
|
||||
fp,
|
||||
"Main Menu",
|
||||
parent_fingerprint=parent_fp,
|
||||
child_fingerprint=child_fp,
|
||||
)
|
||||
if time.time() - password_manager.last_activity > inactivity_timeout:
|
||||
print(colored("Session timed out. Vault locked.", "yellow"))
|
||||
@@ -803,10 +827,20 @@ def display_menu(
|
||||
sys.exit(0)
|
||||
if choice == "1":
|
||||
while True:
|
||||
fp, parent_fp, child_fp = getattr(
|
||||
password_manager,
|
||||
"header_fingerprint_args",
|
||||
(
|
||||
getattr(password_manager, "current_fingerprint", None),
|
||||
None,
|
||||
None,
|
||||
),
|
||||
)
|
||||
clear_and_print_fingerprint(
|
||||
getattr(password_manager, "header_fingerprint", None)
|
||||
or getattr(password_manager, "current_fingerprint", None),
|
||||
fp,
|
||||
"Main Menu > Add Entry",
|
||||
parent_fingerprint=parent_fp,
|
||||
child_fingerprint=child_fp,
|
||||
)
|
||||
print(color_text("\nAdd Entry:", "menu"))
|
||||
print(color_text("1. Password", "menu"))
|
||||
@@ -852,10 +886,16 @@ def display_menu(
|
||||
elif choice == "2":
|
||||
password_manager.update_activity()
|
||||
password_manager.handle_retrieve_entry()
|
||||
fp, parent_fp, child_fp = getattr(
|
||||
password_manager,
|
||||
"header_fingerprint_args",
|
||||
(getattr(password_manager, "current_fingerprint", None), None, None),
|
||||
)
|
||||
clear_and_print_fingerprint(
|
||||
getattr(password_manager, "header_fingerprint", None)
|
||||
or getattr(password_manager, "current_fingerprint", None),
|
||||
fp,
|
||||
"Main Menu",
|
||||
parent_fingerprint=parent_fp,
|
||||
child_fingerprint=child_fp,
|
||||
)
|
||||
elif choice == "3":
|
||||
password_manager.update_activity()
|
||||
|
Reference in New Issue
Block a user