Make the new --download option play nicely with --tls_cert and --tls_key.

This commit is contained in:
Solderpunk 2023-11-19 16:23:36 +01:00
parent 203ffaea90
commit 3abf44d18c
1 changed files with 8 additions and 4 deletions

12
av98.py
View File

@ -1413,6 +1413,13 @@ def main():
# Instantiate client
gc = GeminiClient(args.restricted)
# Activate client certs now in case they are needed for --download below
if args.tls_cert and args.tls_key:
gc.client_cert_manager._activate_client_cert(args.tls_cert, args.tls_key)
for url in args.url:
gi = GeminiItem(url)
gc.client_cert_manager.active_cert_domains.append(gi.host)
# Handle --download
if args.dl:
gc.onecmd("set debug True")
@ -1455,10 +1462,7 @@ def main():
print("Restricted mode engaged!")
print("Enjoy your patrol through Geminispace...")
# Act on args
if args.tls_cert:
# If tls_key is None, python will attempt to load the key from tls_cert.
gc.client_cert_manager._activate_client_cert(args.tls_cert, args.tls_key)
# Add commands to the queue based on command line arguments
if args.bookmarks:
gc.cmdqueue.append("bookmarks")
elif args.url: