mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 00:41:31 +00:00
replace SSL checkbox in GUI with command line option
This commit is contained in:
parent
5c6544a296
commit
dc388d4c7c
3 changed files with 8 additions and 13 deletions
|
@ -193,8 +193,8 @@ class NetworkChoiceLayout(object):
|
||||||
proxy_tab = QWidget()
|
proxy_tab = QWidget()
|
||||||
blockchain_tab = QWidget()
|
blockchain_tab = QWidget()
|
||||||
tabs.addTab(blockchain_tab, _('Overview'))
|
tabs.addTab(blockchain_tab, _('Overview'))
|
||||||
tabs.addTab(proxy_tab, _('Connection'))
|
|
||||||
tabs.addTab(server_tab, _('Server'))
|
tabs.addTab(server_tab, _('Server'))
|
||||||
|
tabs.addTab(proxy_tab, _('Proxy'))
|
||||||
|
|
||||||
# server tab
|
# server tab
|
||||||
grid = QGridLayout(server_tab)
|
grid = QGridLayout(server_tab)
|
||||||
|
@ -204,13 +204,11 @@ class NetworkChoiceLayout(object):
|
||||||
self.server_host.setFixedWidth(200)
|
self.server_host.setFixedWidth(200)
|
||||||
self.server_port = QLineEdit()
|
self.server_port = QLineEdit()
|
||||||
self.server_port.setFixedWidth(60)
|
self.server_port.setFixedWidth(60)
|
||||||
self.ssl_cb = QCheckBox(_('Use SSL'))
|
|
||||||
self.autoconnect_cb = QCheckBox(_('Select server automatically'))
|
self.autoconnect_cb = QCheckBox(_('Select server automatically'))
|
||||||
self.autoconnect_cb.setEnabled(self.config.is_modifiable('auto_connect'))
|
self.autoconnect_cb.setEnabled(self.config.is_modifiable('auto_connect'))
|
||||||
|
|
||||||
self.server_host.editingFinished.connect(self.set_server)
|
self.server_host.editingFinished.connect(self.set_server)
|
||||||
self.server_port.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.set_server)
|
||||||
self.autoconnect_cb.clicked.connect(self.update)
|
self.autoconnect_cb.clicked.connect(self.update)
|
||||||
|
|
||||||
|
@ -269,8 +267,6 @@ class NetworkChoiceLayout(object):
|
||||||
self.tor_cb.hide()
|
self.tor_cb.hide()
|
||||||
self.tor_cb.clicked.connect(self.use_tor_proxy)
|
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.tor_cb, 1, 0, 1, 3)
|
||||||
grid.addWidget(self.proxy_cb, 2, 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)
|
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.server_port.setEnabled(enabled)
|
||||||
self.servers_list.setEnabled(enabled)
|
self.servers_list.setEnabled(enabled)
|
||||||
else:
|
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)
|
w.setEnabled(False)
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
host, port, protocol, proxy_config, auto_connect = self.network.get_parameters()
|
host, port, protocol, proxy_config, auto_connect = self.network.get_parameters()
|
||||||
self.server_host.setText(host)
|
self.server_host.setText(host)
|
||||||
self.server_port.setText(port)
|
self.server_port.setText(port)
|
||||||
self.ssl_cb.setChecked(protocol=='s')
|
|
||||||
self.autoconnect_cb.setChecked(auto_connect)
|
self.autoconnect_cb.setChecked(auto_connect)
|
||||||
|
|
||||||
host = self.network.interface.host if self.network.interface else _('None')
|
host = self.network.interface.host if self.network.interface else _('None')
|
||||||
|
@ -438,7 +433,6 @@ class NetworkChoiceLayout(object):
|
||||||
port = pp.get(protocol)
|
port = pp.get(protocol)
|
||||||
self.server_host.setText(host)
|
self.server_host.setText(host)
|
||||||
self.server_port.setText(port)
|
self.server_port.setText(port)
|
||||||
self.ssl_cb.setChecked(protocol=='s')
|
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
pass
|
pass
|
||||||
|
@ -447,7 +441,7 @@ class NetworkChoiceLayout(object):
|
||||||
host, port, protocol, proxy, auto_connect = self.network.get_parameters()
|
host, port, protocol, proxy, auto_connect = self.network.get_parameters()
|
||||||
host = str(self.server_host.text())
|
host = str(self.server_host.text())
|
||||||
port = str(self.server_port.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()
|
auto_connect = self.autoconnect_cb.isChecked()
|
||||||
self.network.set_parameters(host, port, protocol, proxy, auto_connect)
|
self.network.set_parameters(host, port, protocol, proxy, auto_connect)
|
||||||
|
|
||||||
|
|
|
@ -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("-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("-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("--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():
|
def get_parser():
|
||||||
# create main parser
|
# create main parser
|
||||||
|
|
|
@ -170,16 +170,17 @@ class Network(util.DaemonThread):
|
||||||
self.blockchain_index = config.get('blockchain_index', 0)
|
self.blockchain_index = config.get('blockchain_index', 0)
|
||||||
if self.blockchain_index not in self.blockchains.keys():
|
if self.blockchain_index not in self.blockchains.keys():
|
||||||
self.blockchain_index = 0
|
self.blockchain_index = 0
|
||||||
|
self.protocol = 't' if self.config.get('nossl') else 's'
|
||||||
# Server for addresses and transactions
|
# Server for addresses and transactions
|
||||||
self.default_server = self.config.get('server')
|
self.default_server = self.config.get('server')
|
||||||
# Sanitize default server
|
# Sanitize default server
|
||||||
try:
|
try:
|
||||||
deserialize_server(self.default_server)
|
host, port, protocol = deserialize_server(self.default_server)
|
||||||
|
assert protocol == self.protocol
|
||||||
except:
|
except:
|
||||||
self.default_server = None
|
self.default_server = None
|
||||||
if not self.default_server:
|
if not self.default_server:
|
||||||
self.default_server = pick_random_server()
|
self.default_server = pick_random_server()
|
||||||
|
|
||||||
self.lock = threading.Lock()
|
self.lock = threading.Lock()
|
||||||
self.pending_sends = []
|
self.pending_sends = []
|
||||||
self.message_id = 0
|
self.message_id = 0
|
||||||
|
@ -217,8 +218,7 @@ class Network(util.DaemonThread):
|
||||||
self.auto_connect = self.config.get('auto_connect', True)
|
self.auto_connect = self.config.get('auto_connect', True)
|
||||||
self.connecting = set()
|
self.connecting = set()
|
||||||
self.socket_queue = queue.Queue()
|
self.socket_queue = queue.Queue()
|
||||||
self.start_network(deserialize_server(self.default_server)[2],
|
self.start_network(self.protocol, deserialize_proxy(self.config.get('proxy')))
|
||||||
deserialize_proxy(self.config.get('proxy')))
|
|
||||||
|
|
||||||
def register_callback(self, callback, events):
|
def register_callback(self, callback, events):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
|
|
Loading…
Add table
Reference in a new issue