commit b891d3dc8580976887e3bb61be8b504257a949b6
parent fbc539e2cc0c6c679aba8adafa234a4947aa70d1
Author: ThomasV <thomasv@electrum.org>
Date: Sat, 9 May 2020 10:33:18 +0200
new command: get_ssl_domain
Diffstat:
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/electrum/commands.py b/electrum/commands.py
@@ -299,6 +299,12 @@ class Commands:
return True
@command('')
+ async def get_ssl_domain(self):
+ """Check and return the SSL domain set in ssl_keyfile and ssl_certfile
+ """
+ return self.config.get_ssl_domain()
+
+ @command('')
async def make_seed(self, nbits=132, language=None, seed_type=None):
"""Create a seed"""
from .mnemonic import Mnemonic
diff --git a/electrum/gui/qt/settings_dialog.py b/electrum/gui/qt/settings_dialog.py
@@ -564,17 +564,13 @@ that is always connected to the internet. Configure a port if you want it to be
self.check_ssl_config()
def check_ssl_config(self):
- if self.config.get('ssl_keyfile') and self.config.get('ssl_certfile'):
- try:
- SSL_identity = paymentrequest.check_ssl_config(self.config)
- SSL_error = None
- except BaseException as e:
- SSL_identity = "error"
- SSL_error = repr(e)
- else:
- SSL_identity = ""
+ try:
+ SSL_identity = self.config.get_ssl_domain()
SSL_error = None
- self.ssl_domain_e.setText(SSL_identity)
+ except BaseException as e:
+ SSL_identity = "error"
+ SSL_error = repr(e)
+ self.ssl_domain_e.setText(SSL_identity or "")
s = (ColorScheme.RED if SSL_error else ColorScheme.GREEN).as_stylesheet(True) if SSL_identity else ''
self.ssl_domain_e.setStyleSheet(s)
if SSL_error:
diff --git a/electrum/simple_config.py b/electrum/simple_config.py
@@ -584,6 +584,14 @@ class SimpleConfig(Logger):
ssl_context.load_cert_chain(ssl_certfile, ssl_keyfile)
return ssl_context
+ def get_ssl_domain(self):
+ from .paymentrequest import check_ssl_config
+ if self.get('ssl_keyfile') and self.get('ssl_certfile'):
+ SSL_identity = check_ssl_config(self)
+ else:
+ SSL_identity = None
+ return SSL_identity
+
def read_user_config(path):
"""Parse and store the user config settings in electrum.conf into user_config[]."""