summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--onionshare/onion.py5
-rw-r--r--onionshare_gui/settings_dialog.py31
2 files changed, 25 insertions, 11 deletions
diff --git a/onionshare/onion.py b/onionshare/onion.py
index 6066f059..6673f8ee 100644
--- a/onionshare/onion.py
+++ b/onionshare/onion.py
@@ -387,6 +387,7 @@ class Onion(object):
# Get the tor version
self.tor_version = self.c.get_version().version_str
+ self.common.log('Onion', 'connect', 'Connected to tor {}'.format(self.tor_version))
# Do the versions of stem and tor that I'm using support ephemeral onion services?
list_ephemeral_hidden_services = getattr(self.c, "list_ephemeral_hidden_services", None)
@@ -403,7 +404,9 @@ class Onion(object):
self.supports_stealth = False
# Does this version of Tor support next-gen ('v3') onions?
- self.supports_next_gen_onions = self.tor_version > Version('0.3.3.1')
+ # Note, this is the version of Tor where this bug was fixed:
+ # https://trac.torproject.org/projects/tor/ticket/28619
+ self.supports_v3_onions = self.tor_version > Version('0.4.0.0')
def is_authenticated(self):
"""
diff --git a/onionshare_gui/settings_dialog.py b/onionshare_gui/settings_dialog.py
index 37cc9105..53fd8351 100644
--- a/onionshare_gui/settings_dialog.py
+++ b/onionshare_gui/settings_dialog.py
@@ -164,15 +164,6 @@ class SettingsDialog(QtWidgets.QDialog):
onion_settings_widget = QtWidgets.QWidget()
onion_settings_widget.setLayout(onion_settings_layout)
- # If we're connected to Tor, show onion service settings, show label if not
- if self.onion.is_authenticated():
- connect_to_tor_label.hide()
- onion_settings_widget.show()
- else:
- connect_to_tor_label.show()
- onion_settings_widget.hide()
-
-
# General options layout
general_group_layout = QtWidgets.QVBoxLayout()
general_group_layout.addWidget(self.public_mode_widget)
@@ -480,6 +471,7 @@ class SettingsDialog(QtWidgets.QDialog):
self.setLayout(layout)
self.cancel_button.setFocus()
+
# Load settings, and fill them in
self.old_settings = Settings(self.common, self.config)
self.old_settings.load()
@@ -599,6 +591,25 @@ class SettingsDialog(QtWidgets.QDialog):
new_bridges = ''.join(new_bridges)
self.tor_bridges_use_custom_textbox.setPlainText(new_bridges)
+ # If we're connected to Tor, show onion service settings, show label if not
+ if self.onion.is_authenticated():
+ connect_to_tor_label.hide()
+ onion_settings_widget.show()
+
+ # If v3 onion services are supported, allow using legacy mode
+ if self.onion.supports_v3_onions:
+ self.common.log('SettingsDialog', '__init__', 'v3 onions are supported')
+ self.use_legacy_v2_onions_checkbox.show()
+ else:
+ self.common.log('SettingsDialog', '__init__', 'v3 onions are not supported')
+ self.use_legacy_v2_onions_checkbox.setCheckState(QtCore.Qt.Checked)
+ self.use_legacy_v2_onions_widget.hide()
+ self.use_legacy_v2_onions_checkbox_clicked(True)
+ else:
+ connect_to_tor_label.show()
+ onion_settings_widget.hide()
+
+
def connection_type_bundled_toggled(self, checked):
"""
Connection type bundled was toggled. If checked, hide authentication fields.
@@ -774,7 +785,7 @@ class SettingsDialog(QtWidgets.QDialog):
onion.connect(custom_settings=settings, config=self.config, tor_status_update_func=tor_status_update_func)
# If an exception hasn't been raised yet, the Tor settings work
- Alert(self.common, strings._('settings_test_success').format(onion.tor_version, onion.supports_ephemeral, onion.supports_stealth, onion.supports_next_gen_onions))
+ Alert(self.common, strings._('settings_test_success').format(onion.tor_version, onion.supports_ephemeral, onion.supports_stealth, onion.supports_v3_onions))
# Clean up
onion.cleanup()