mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-29 01:06:16 -05:00
Merge branch 'mig5-dont_revert_on_invalid_bridges' into develop
This commit is contained in:
commit
715e31b890
@ -660,57 +660,58 @@ class SettingsDialog(QtWidgets.QDialog):
|
|||||||
common.log('SettingsDialog', 'save_clicked')
|
common.log('SettingsDialog', 'save_clicked')
|
||||||
|
|
||||||
settings = self.settings_from_fields()
|
settings = self.settings_from_fields()
|
||||||
settings.save()
|
if settings:
|
||||||
|
settings.save()
|
||||||
|
|
||||||
# If Tor isn't connected, or if Tor settings have changed, Reinitialize
|
# If Tor isn't connected, or if Tor settings have changed, Reinitialize
|
||||||
# the Onion object
|
# the Onion object
|
||||||
reboot_onion = False
|
reboot_onion = False
|
||||||
if self.onion.is_authenticated():
|
if self.onion.is_authenticated():
|
||||||
common.log('SettingsDialog', 'save_clicked', 'Connected to Tor')
|
common.log('SettingsDialog', 'save_clicked', 'Connected to Tor')
|
||||||
def changed(s1, s2, keys):
|
def changed(s1, s2, keys):
|
||||||
"""
|
"""
|
||||||
Compare the Settings objects s1 and s2 and return true if any values
|
Compare the Settings objects s1 and s2 and return true if any values
|
||||||
have changed for the given keys.
|
have changed for the given keys.
|
||||||
"""
|
"""
|
||||||
for key in keys:
|
for key in keys:
|
||||||
if s1.get(key) != s2.get(key):
|
if s1.get(key) != s2.get(key):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if changed(settings, self.old_settings, [
|
if changed(settings, self.old_settings, [
|
||||||
'connection_type', 'control_port_address',
|
'connection_type', 'control_port_address',
|
||||||
'control_port_port', 'socks_address', 'socks_port',
|
'control_port_port', 'socks_address', 'socks_port',
|
||||||
'socket_file_path', 'auth_type', 'auth_password',
|
'socket_file_path', 'auth_type', 'auth_password',
|
||||||
'no_bridges', 'tor_bridges_use_obfs4',
|
'no_bridges', 'tor_bridges_use_obfs4',
|
||||||
'tor_bridges_use_meek_lite_amazon', 'tor_bridges_use_meek_lite_azure',
|
'tor_bridges_use_meek_lite_amazon', 'tor_bridges_use_meek_lite_azure',
|
||||||
'tor_bridges_use_custom_bridges']):
|
'tor_bridges_use_custom_bridges']):
|
||||||
|
|
||||||
|
reboot_onion = True
|
||||||
|
|
||||||
|
else:
|
||||||
|
common.log('SettingsDialog', 'save_clicked', 'Not connected to Tor')
|
||||||
|
# Tor isn't connected, so try connecting
|
||||||
reboot_onion = True
|
reboot_onion = True
|
||||||
|
|
||||||
else:
|
# Do we need to reinitialize Tor?
|
||||||
common.log('SettingsDialog', 'save_clicked', 'Not connected to Tor')
|
if reboot_onion:
|
||||||
# Tor isn't connected, so try connecting
|
# Reinitialize the Onion object
|
||||||
reboot_onion = True
|
common.log('SettingsDialog', 'save_clicked', 'rebooting the Onion')
|
||||||
|
self.onion.cleanup()
|
||||||
|
|
||||||
# Do we need to reinitialize Tor?
|
tor_con = TorConnectionDialog(self.qtapp, settings, self.onion)
|
||||||
if reboot_onion:
|
tor_con.start()
|
||||||
# Reinitialize the Onion object
|
|
||||||
common.log('SettingsDialog', 'save_clicked', 'rebooting the Onion')
|
|
||||||
self.onion.cleanup()
|
|
||||||
|
|
||||||
tor_con = TorConnectionDialog(self.qtapp, settings, self.onion)
|
common.log('SettingsDialog', 'save_clicked', 'Onion done rebooting, connected to Tor: {}'.format(self.onion.connected_to_tor))
|
||||||
tor_con.start()
|
|
||||||
|
|
||||||
common.log('SettingsDialog', 'save_clicked', 'Onion done rebooting, connected to Tor: {}'.format(self.onion.connected_to_tor))
|
if self.onion.is_authenticated() and not tor_con.wasCanceled():
|
||||||
|
self.settings_saved.emit()
|
||||||
|
self.close()
|
||||||
|
|
||||||
if self.onion.is_authenticated() and not tor_con.wasCanceled():
|
else:
|
||||||
self.settings_saved.emit()
|
self.settings_saved.emit()
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
else:
|
|
||||||
self.settings_saved.emit()
|
|
||||||
self.close()
|
|
||||||
|
|
||||||
def cancel_clicked(self):
|
def cancel_clicked(self):
|
||||||
"""
|
"""
|
||||||
Cancel button clicked.
|
Cancel button clicked.
|
||||||
@ -839,6 +840,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
|||||||
else:
|
else:
|
||||||
Alert(strings._('gui_settings_tor_bridges_invalid', True))
|
Alert(strings._('gui_settings_tor_bridges_invalid', True))
|
||||||
settings.set('no_bridges', True)
|
settings.set('no_bridges', True)
|
||||||
|
return False
|
||||||
|
|
||||||
return settings
|
return settings
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
"gui_settings_tor_bridges_meek_lite_azure_radio_option_no_obfs4proxy": "Use built-in meek_lite (Azure) pluggable transports (requires obfs4proxy)",
|
"gui_settings_tor_bridges_meek_lite_azure_radio_option_no_obfs4proxy": "Use built-in meek_lite (Azure) pluggable transports (requires obfs4proxy)",
|
||||||
"gui_settings_tor_bridges_custom_radio_option": "Use custom bridges",
|
"gui_settings_tor_bridges_custom_radio_option": "Use custom bridges",
|
||||||
"gui_settings_tor_bridges_custom_label": "You can get bridges from <a href=\"https://bridges.torproject.org/options\">https://bridges.torproject.org</a>",
|
"gui_settings_tor_bridges_custom_label": "You can get bridges from <a href=\"https://bridges.torproject.org/options\">https://bridges.torproject.org</a>",
|
||||||
"gui_settings_tor_bridges_invalid": "None of the bridges you supplied seem to be valid, so they've been ignored.\nPlease try again with valid bridges.",
|
"gui_settings_tor_bridges_invalid": "None of the bridges you supplied seem to be valid.\nPlease try again with valid bridges.",
|
||||||
"gui_settings_button_save": "Save",
|
"gui_settings_button_save": "Save",
|
||||||
"gui_settings_button_cancel": "Cancel",
|
"gui_settings_button_cancel": "Cancel",
|
||||||
"gui_settings_button_help": "Help",
|
"gui_settings_button_help": "Help",
|
||||||
|
Loading…
Reference in New Issue
Block a user