Clean up some inefficient code, and re-word the 'too old for stealth' dialog message

This commit is contained in:
Miguel Jacq 2021-08-27 17:59:52 +10:00
parent 41ddeb08b9
commit 06344f23ad
No known key found for this signature in database
GPG key ID: EEA4341C6D97A0B6
2 changed files with 6 additions and 11 deletions

View file

@ -87,7 +87,7 @@
"gui_server_autostop_timer_expired": "The auto-stop timer already ran out. Please adjust it to start sharing.",
"gui_server_autostart_timer_expired": "The scheduled time has already passed. Please adjust it to start sharing.",
"gui_autostop_timer_cant_be_earlier_than_autostart_timer": "The auto-stop time can't be the same or earlier than the auto-start time. Please adjust it to start sharing.",
"gui_server_doesnt_support_stealth": "Sorry, this version of Tor doesn't support stealth (Client Authorization). Please try with a newer version of Tor.",
"gui_server_doesnt_support_stealth": "Sorry, this version of Tor doesn't support stealth (Client Authentication). Please try with a newer version of Tor, or use 'public' mode if it doesn't need to be private.",
"share_via_onionshare": "Share via OnionShare",
"gui_share_url_description": "<b>Anyone</b> with this OnionShare address and private key can <b>download</b> your files using the <b>Tor Browser</b>: <img src='{}' />",
"gui_share_url_public_description": "<b>Anyone</b> with this OnionShare address can <b>download</b> your files using the <b>Tor Browser</b>: <img src='{}' />",

View file

@ -248,15 +248,16 @@ class Mode(QtWidgets.QWidget):
def start_onion_thread(self, obtain_onion_early=False):
# If we tried to start with Client Auth and our Tor is too old to support it,
# bail out early
can_start = True
if (
not self.server_status.local_only
and not self.app.onion.supports_stealth
and not self.settings.get("general", "public")
):
can_start = False
if can_start:
self.stop_server()
self.start_server_error(
strings._("gui_server_doesnt_support_stealth")
)
else:
self.common.log("Mode", "start_server", "Starting an onion thread")
self.obtain_onion_early = obtain_onion_early
self.onion_thread = OnionThread(self)
@ -265,12 +266,6 @@ class Mode(QtWidgets.QWidget):
self.onion_thread.error.connect(self.starting_server_error.emit)
self.onion_thread.start()
else:
self.stop_server()
self.start_server_error(
strings._("gui_server_doesnt_support_stealth")
)
def start_scheduled_service(self, obtain_onion_early=False):
# We start a new OnionThread with the saved scheduled key from settings
self.common.settings.load()