electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit dc388d4c7c541fadb9869727e359edace4c9f6f0
parent 5c6544a296e929f6f7230b4f3a2ae4961126ad0f
Author: ThomasV <thomasv@electrum.org>
Date:   Mon, 18 Dec 2017 14:15:10 +0100

replace SSL checkbox in GUI with command line option

Diffstat:
Mgui/qt/network_dialog.py | 12+++---------
Mlib/commands.py | 1+
Mlib/network.py | 8++++----
3 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/gui/qt/network_dialog.py b/gui/qt/network_dialog.py @@ -193,8 +193,8 @@ class NetworkChoiceLayout(object): proxy_tab = QWidget() blockchain_tab = QWidget() tabs.addTab(blockchain_tab, _('Overview')) - tabs.addTab(proxy_tab, _('Connection')) tabs.addTab(server_tab, _('Server')) + tabs.addTab(proxy_tab, _('Proxy')) # server tab grid = QGridLayout(server_tab) @@ -204,13 +204,11 @@ class NetworkChoiceLayout(object): self.server_host.setFixedWidth(200) self.server_port = QLineEdit() self.server_port.setFixedWidth(60) - self.ssl_cb = QCheckBox(_('Use SSL')) self.autoconnect_cb = QCheckBox(_('Select server automatically')) self.autoconnect_cb.setEnabled(self.config.is_modifiable('auto_connect')) self.server_host.editingFinished.connect(self.set_server) self.server_port.editingFinished.connect(self.set_server) - self.ssl_cb.clicked.connect(self.change_protocol) self.autoconnect_cb.clicked.connect(self.set_server) self.autoconnect_cb.clicked.connect(self.update) @@ -269,8 +267,6 @@ class NetworkChoiceLayout(object): self.tor_cb.hide() self.tor_cb.clicked.connect(self.use_tor_proxy) - grid.addWidget(self.ssl_cb, 0, 0, 1, 3) - grid.addWidget(HelpButton(_('SSL is used to authenticate and encrypt your connections with Electrum servers.')), 0, 4) grid.addWidget(self.tor_cb, 1, 0, 1, 3) grid.addWidget(self.proxy_cb, 2, 0, 1, 3) grid.addWidget(HelpButton(_('Proxy settings apply to all connections: with Electrum servers, but also with third-party services.')), 2, 4) @@ -334,14 +330,13 @@ class NetworkChoiceLayout(object): self.server_port.setEnabled(enabled) self.servers_list.setEnabled(enabled) else: - for w in [self.autoconnect_cb, self.server_host, self.server_port, self.ssl_cb, self.servers_list]: + for w in [self.autoconnect_cb, self.server_host, self.server_port, self.servers_list]: w.setEnabled(False) def update(self): host, port, protocol, proxy_config, auto_connect = self.network.get_parameters() self.server_host.setText(host) self.server_port.setText(port) - self.ssl_cb.setChecked(protocol=='s') self.autoconnect_cb.setChecked(auto_connect) host = self.network.interface.host if self.network.interface else _('None') @@ -438,7 +433,6 @@ class NetworkChoiceLayout(object): port = pp.get(protocol) self.server_host.setText(host) self.server_port.setText(port) - self.ssl_cb.setChecked(protocol=='s') def accept(self): pass @@ -447,7 +441,7 @@ class NetworkChoiceLayout(object): host, port, protocol, proxy, auto_connect = self.network.get_parameters() host = str(self.server_host.text()) port = str(self.server_port.text()) - protocol = 's' if self.ssl_cb.isChecked() else 't' + protocol = 't' if self.config.get('nossl') else 's' auto_connect = self.autoconnect_cb.isChecked() self.network.set_parameters(host, port, protocol, proxy, auto_connect) diff --git a/lib/commands.py b/lib/commands.py @@ -825,6 +825,7 @@ def add_global_options(parser): group.add_argument("-P", "--portable", action="store_true", dest="portable", default=False, help="Use local 'electrum_data' directory") group.add_argument("-w", "--wallet", dest="wallet_path", help="wallet path") group.add_argument("--testnet", action="store_true", dest="testnet", default=False, help="Use Testnet") + group.add_argument("--nossl", action="store_true", dest="nossl", default=False, help="Disable SSL") def get_parser(): # create main parser diff --git a/lib/network.py b/lib/network.py @@ -170,16 +170,17 @@ class Network(util.DaemonThread): self.blockchain_index = config.get('blockchain_index', 0) if self.blockchain_index not in self.blockchains.keys(): self.blockchain_index = 0 + self.protocol = 't' if self.config.get('nossl') else 's' # Server for addresses and transactions self.default_server = self.config.get('server') # Sanitize default server try: - deserialize_server(self.default_server) + host, port, protocol = deserialize_server(self.default_server) + assert protocol == self.protocol except: self.default_server = None if not self.default_server: self.default_server = pick_random_server() - self.lock = threading.Lock() self.pending_sends = [] self.message_id = 0 @@ -217,8 +218,7 @@ class Network(util.DaemonThread): self.auto_connect = self.config.get('auto_connect', True) self.connecting = set() self.socket_queue = queue.Queue() - self.start_network(deserialize_server(self.default_server)[2], - deserialize_proxy(self.config.get('proxy'))) + self.start_network(self.protocol, deserialize_proxy(self.config.get('proxy'))) def register_callback(self, callback, events): with self.lock: