Allow setting a 'fake' ClientAuth in local-only mode - which will help with tests

This commit is contained in:
Miguel Jacq 2021-05-06 15:06:36 +10:00
parent ea4466262d
commit cde46b676e
No known key found for this signature in database
GPG Key ID: EEA4341C6D97A0B6
2 changed files with 17 additions and 6 deletions

View File

@ -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(

View File

@ -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()