From a3c9b106473552455ebf01793036b710c2643384 Mon Sep 17 00:00:00 2001 From: dece Date: Sun, 13 Jun 2021 01:54:56 +0200 Subject: [PATCH] gemini: show reason for certificate creation --- bebop/browser/gemini.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bebop/browser/gemini.py b/bebop/browser/gemini.py index a61e160..3c7f9dd 100644 --- a/bebop/browser/gemini.py +++ b/bebop/browser/gemini.py @@ -294,7 +294,7 @@ def _handle_cert_required( url_identities = get_identities_for_url(browser.identities, url) if not url_identities: - identity = create_identity(browser, url) + identity = create_identity(browser, url, reason=response.meta) if not identity: return None browser.identities[url] = [identity] @@ -317,13 +317,16 @@ def select_identity(identities: list): return identities[0] if identities else None -def create_identity(browser: Browser, url: str): +def create_identity(browser: Browser, url: str, reason: Optional[str] =None): """Walk the user through identity creation. Returns: The created identity on success (already registered in identities """ - key = browser.prompt("Create client certificate?") + prompt_text = "Create client certificate?" + if reason: + prompt_text += f" Reason: {reason}" + key = browser.prompt(prompt_text) if key != "y": browser.reset_status() return None