mirror of
https://github.com/onionshare/onionshare.git
synced 2025-03-14 18:06:30 -04:00
Only show onion settings if there is a Tor connection
This commit is contained in:
parent
73fdc0ffc4
commit
00cbc2ff4b
@ -373,6 +373,11 @@ class Common(object):
|
||||
'settings_whats_this': """
|
||||
QLabel {
|
||||
font-size: 12px;
|
||||
}""",
|
||||
|
||||
'settings_connect_to_tor': """
|
||||
QLabel {
|
||||
font-style: italic;
|
||||
}"""
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,10 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
self.shutdown_timeout_widget = QtWidgets.QWidget()
|
||||
self.shutdown_timeout_widget.setLayout(shutdown_timeout_layout)
|
||||
|
||||
# Label telling user to connect to Tor for onion service settings
|
||||
connect_to_tor_label = QtWidgets.QLabel(strings._("gui_connect_to_tor_for_onion_settings"))
|
||||
connect_to_tor_label.setStyleSheet(self.common.css['settings_connect_to_tor'])
|
||||
|
||||
# Whether or not to use legacy v2 onions
|
||||
self.use_legacy_v2_onions_checkbox = QtWidgets.QCheckBox()
|
||||
self.use_legacy_v2_onions_checkbox.setCheckState(QtCore.Qt.Unchecked)
|
||||
@ -149,16 +153,32 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
self.hidservauth_copy_button.clicked.connect(self.hidservauth_copy_button_clicked)
|
||||
self.hidservauth_copy_button.hide()
|
||||
|
||||
# Onion settings widget
|
||||
onion_settings_layout = QtWidgets.QVBoxLayout()
|
||||
onion_settings_layout.setContentsMargins(0, 0, 0, 0)
|
||||
onion_settings_layout.addWidget(self.use_legacy_v2_onions_widget)
|
||||
onion_settings_layout.addWidget(self.save_private_key_widget)
|
||||
onion_settings_layout.addWidget(self.use_stealth_widget)
|
||||
onion_settings_layout.addWidget(hidservauth_details)
|
||||
onion_settings_layout.addWidget(self.hidservauth_copy_button)
|
||||
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)
|
||||
general_group_layout.addWidget(self.shutdown_timeout_widget)
|
||||
general_group_layout.addWidget(self.use_legacy_v2_onions_widget)
|
||||
general_group_layout.addWidget(self.save_private_key_widget)
|
||||
general_group_layout.addWidget(self.use_stealth_widget)
|
||||
general_group_layout.addWidget(hidservauth_details)
|
||||
general_group_layout.addWidget(self.hidservauth_copy_button)
|
||||
|
||||
general_group_layout.addWidget(connect_to_tor_label)
|
||||
general_group_layout.addWidget(onion_settings_widget)
|
||||
general_group = QtWidgets.QGroupBox(strings._("gui_settings_general_label"))
|
||||
general_group.setLayout(general_group_layout)
|
||||
|
||||
|
@ -135,6 +135,7 @@
|
||||
"gui_server_started_after_timeout": "The auto-stop timer ran out before the server started.\nPlease make a new share.",
|
||||
"gui_server_timeout_expired": "The auto-stop timer already ran out.\nPlease update it to start sharing.",
|
||||
"share_via_onionshare": "OnionShare it",
|
||||
"gui_connect_to_tor_for_onion_settings": "Connect to Tor to see onion service settings",
|
||||
"gui_use_legacy_v2_onions_checkbox": "Use legacy addresses",
|
||||
"gui_save_private_key_checkbox": "Use a persistent address (legacy)",
|
||||
"gui_share_url_description": "<b>Anyone</b> with this OnionShare address can <b>download</b> your files using the <b>Tor Browser</b>: <img src='{}' />",
|
||||
|
Loading…
x
Reference in New Issue
Block a user