aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Jacq <mig@mig5.net>2021-05-06 15:06:36 +1000
committerMiguel Jacq <mig@mig5.net>2021-05-06 15:06:36 +1000
commitcde46b676e89a27e7f5cec97ab67c020bde601a6 (patch)
tree871380b0ea509fc1c8e0146e03de03d2d82823ae
parentea4466262d3734834e1162f395b3d70d8c794557 (diff)
downloadonionshare-cde46b676e89a27e7f5cec97ab67c020bde601a6.tar.gz
onionshare-cde46b676e89a27e7f5cec97ab67c020bde601a6.zip
Allow setting a 'fake' ClientAuth in local-only mode - which will help with tests
-rw-r--r--cli/onionshare_cli/onionshare.py2
-rw-r--r--desktop/src/onionshare/tab/mode/__init__.py21
2 files changed, 17 insertions, 6 deletions
diff --git a/cli/onionshare_cli/onionshare.py b/cli/onionshare_cli/onionshare.py
index bd94100f..d055b639 100644
--- a/cli/onionshare_cli/onionshare.py
+++ b/cli/onionshare_cli/onionshare.py
@@ -74,6 +74,8 @@ class OnionShare(object):
if self.local_only:
self.onion_host = f"127.0.0.1:{self.port}"
+ if mode_settings.get("general", "client_auth"):
+ self.auth_string = "E2GOT5LTUTP3OAMRCRXO4GSH6VKJEUOXZQUC336SRKAHTTT5OVSA"
return
self.onion_host = self.onion.start_onion_service(
diff --git a/desktop/src/onionshare/tab/mode/__init__.py b/desktop/src/onionshare/tab/mode/__init__.py
index 66f9279a..2b78ffd0 100644
--- a/desktop/src/onionshare/tab/mode/__init__.py
+++ b/desktop/src/onionshare/tab/mode/__init__.py
@@ -241,12 +241,15 @@ 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
- if not self.app.onion.supports_stealth and self.settings.get("general", "client_auth"):
- self.stop_server()
- self.start_server_error(
- strings._("gui_server_doesnt_support_stealth")
- )
- else:
+ can_start = True
+ if (
+ not self.server_status.local_only
+ and not self.app.onion.supports_stealth
+ and self.settings.get("general", "client_auth")
+ ):
+ can_start = False
+
+ if can_start:
self.common.log("Mode", "start_server", "Starting an onion thread")
self.obtain_onion_early = obtain_onion_early
self.onion_thread = OnionThread(self)
@@ -255,6 +258,12 @@ 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()