Allow inputting fingerprint check

This commit is contained in:
Kovid Goyal 2022-03-12 08:23:10 +05:30
parent 9687318b22
commit d5c48ddb94
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 10 additions and 3 deletions

View File

@ -154,6 +154,7 @@ class Password(Handler):
self.line_edit = LineEdit(is_password=True)
def initialize(self) -> None:
self.cmd.set_cursor_shape('beam')
self.draw_screen()
@Handler.atomic_update

View File

@ -14,7 +14,7 @@ combine_as_imports = True
multi_line_output = 5
[mypy]
files = kitty,kittens,glfw,*.py,docs/conf.py
files = kitty,kittens,glfw,*.py,docs/conf.py,shell-integration/ssh/askpass.py
no_implicit_optional = True
sqlite_cache = True
cache_fine_grained = True

View File

@ -10,11 +10,12 @@ from kitty.shm import SharedMemory
msg = sys.argv[-1]
prompt = os.environ.get('SSH_ASKPASS_PROMPT', '')
is_confirm = prompt == 'confirm' or 'continue connecting' in msg
is_confirm = prompt == 'confirm'
is_fingerprint_check = '(yes/no/[fingerprint])' in msg
q = {
'message': msg,
'type': 'confirm' if is_confirm else 'get_line',
'is_password': True,
'is_password': not is_fingerprint_check,
}
data = json.dumps(q)
@ -35,5 +36,10 @@ with SharedMemory(
response = json.loads(shm.read_data_with_size())
if is_confirm:
response = 'yes' if response else 'no'
elif is_fingerprint_check:
if response.lower() in ('y', 'yes'):
response = 'yes'
if response.lower() in ('n', 'no'):
response = 'no'
if response:
print(response, flush=True)