React to Meek client binary not found

This commit is contained in:
Miguel Jacq 2021-10-25 11:12:38 +11:00
parent 3a715346af
commit 6f0674afd8
No known key found for this signature in database
GPG Key ID: EEA4341C6D97A0B6
2 changed files with 26 additions and 7 deletions

View File

@ -72,6 +72,12 @@ class Meek(object):
queue.put(line)
out.close()
# Abort early if we can't find the Meek client
# common.get_tor_paths() has already checked it's a file
# so just abort if it's a NoneType object
if self.meek_client_file_path is None:
raise MeekNotFound()
# Start the Meek Client as a subprocess.
if self.common.platform == "Windows":
@ -179,3 +185,8 @@ class MeekNotRunning(Exception):
We were unable to start Meek or obtain the port
number it started on, in order to do domain fronting.
"""
class MeekNotFound(Exception):
"""
We were unable to find the Meek Client binary.
"""

View File

@ -26,7 +26,7 @@ import json
from . import strings
from .gui_common import GuiCommon
from onionshare_cli.meek import MeekNotRunning
from onionshare_cli.meek import MeekNotFound
class MoatDialog(QtWidgets.QDialog):
@ -234,12 +234,19 @@ class MoatThread(QtCore.QThread):
def run(self):
# Start Meek so that we can do domain fronting
self.meek.start()
try:
self.meek.start()
except MeekNotFound:
self.common.log("MoatThread", "run", f"Could not find the Meek Client")
self.bridgedb_error.emit()
return
# We should only fetch bridges if we can domain front,
# but we can override this in local-only mode.
if not self.meek.meek_proxies and not self.common.gui.local_only:
self.common.log("MoatThread", "run", f"Could not identify meek proxies to make request")
self.common.log(
"MoatThread", "run", f"Could not identify meek proxies to make request"
)
self.bridgedb_error.emit()
return
@ -256,15 +263,14 @@ class MoatThread(QtCore.QThread):
{
"version": "0.1.0",
"type": "client-transports",
"supported": [
"obfs4",
"snowflake",
],
"supported": ["obfs4", "snowflake"],
}
]
},
)
self.meek.cleanup()
if r.status_code != 200:
self.common.log("MoatThread", "run", f"status_code={r.status_code}")
self.bridgedb_error.emit()
@ -317,7 +323,9 @@ class MoatThread(QtCore.QThread):
]
},
)
self.meek.cleanup()
if r.status_code != 200:
self.common.log("MoatThread", "run", f"status_code={r.status_code}")
self.bridgedb_error.emit()