From 06344f23ad7561bf0fc568d1b77d10578ade64b6 Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Fri, 27 Aug 2021 17:59:52 +1000 Subject: [PATCH] Clean up some inefficient code, and re-word the 'too old for stealth' dialog message --- desktop/src/onionshare/resources/locale/en.json | 2 +- desktop/src/onionshare/tab/mode/__init__.py | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/desktop/src/onionshare/resources/locale/en.json b/desktop/src/onionshare/resources/locale/en.json index 0d2bdd66..1e71bced 100644 --- a/desktop/src/onionshare/resources/locale/en.json +++ b/desktop/src/onionshare/resources/locale/en.json @@ -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": "Anyone with this OnionShare address and private key can download your files using the Tor Browser: ", "gui_share_url_public_description": "Anyone with this OnionShare address can download your files using the Tor Browser: ", diff --git a/desktop/src/onionshare/tab/mode/__init__.py b/desktop/src/onionshare/tab/mode/__init__.py index ed9191b0..c0c80368 100644 --- a/desktop/src/onionshare/tab/mode/__init__.py +++ b/desktop/src/onionshare/tab/mode/__init__.py @@ -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()