feat: double Esc to exit main menu; fix Cryptgeon test for new payload schema

- First Esc in main screen shows "Press Esc again to quit" in footer;
  second Esc exits. Any other key resets the pending state.
- Update test_posts_to_correct_endpoint to expect contents as base64 string
  and presence of meta field, matching the updated Cryptgeon API payload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vlad Doloman
2026-06-24 15:31:12 +03:00
parent 90af568755
commit f3e1471d1a
2 changed files with 15 additions and 2 deletions

View File

@@ -745,6 +745,7 @@ def show_main_screen(
n_items = n_certs + len(_MENU_ITEMS)
checked: set[str] = set(initial_checked) if initial_checked else set()
cursor = clamp(initial_cursor, 0, max(0, n_items - 1))
esc_pending = False
def is_cert(idx): return idx < n_certs
def menu_item(idx): return _MENU_ITEMS[idx - n_certs] if idx >= n_certs else None
@@ -763,7 +764,10 @@ def show_main_screen(
pass
# Footer hint
hint = " ↑↓:Navigate Space:Check Enter:Confirm R:Revoke A:Toggle view Q:Quit"
if esc_pending:
hint = " Press Esc again to quit"
else:
hint = " ↑↓:Navigate Space:Check Enter:Confirm R:Revoke A:Toggle view Q:Quit"
try:
stdscr.addstr(sh - 1, 0, hint[:sw], curses.color_pair(COLOR_DISABLED))
except curses.error:
@@ -810,6 +814,14 @@ def show_main_screen(
draw()
key = stdscr.getch()
if key == 27: # Esc
if esc_pending:
return ScreenResult(action=Action.EXIT)
esc_pending = True
continue
esc_pending = False
if key in (ord("q"), ord("Q")):
return ScreenResult(action=Action.EXIT)