mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-12 07:49:39 -05:00
In CLI get_tor_path, stop trying to look in resources first
This commit is contained in:
parent
7cd1a53d00
commit
c3eeaefb9f
@ -309,30 +309,14 @@ class Common:
|
|||||||
|
|
||||||
def get_tor_paths(self):
|
def get_tor_paths(self):
|
||||||
if self.platform == "Linux":
|
if self.platform == "Linux":
|
||||||
# Look in resources first
|
tor_path = shutil.which("tor")
|
||||||
base_path = self.get_resource_path("tor")
|
if not tor_path:
|
||||||
if os.path.exists(base_path):
|
raise CannotFindTor()
|
||||||
self.log(
|
obfs4proxy_file_path = shutil.which("obfs4proxy")
|
||||||
"Common", "get_tor_paths", f"using tor binaries in {base_path}"
|
snowflake_file_path = shutil.which("snowflake-client")
|
||||||
)
|
prefix = os.path.dirname(os.path.dirname(tor_path))
|
||||||
tor_path = os.path.join(base_path, "tor")
|
tor_geo_ip_file_path = os.path.join(prefix, "share/tor/geoip")
|
||||||
tor_geo_ip_file_path = os.path.join(base_path, "geoip")
|
tor_geo_ipv6_file_path = os.path.join(prefix, "share/tor/geoip6")
|
||||||
tor_geo_ipv6_file_path = os.path.join(base_path, "geoip6")
|
|
||||||
obfs4proxy_file_path = os.path.join(base_path, "obfs4proxy")
|
|
||||||
snowflake_file_path = os.path.join(base_path, "snowflake-client")
|
|
||||||
else:
|
|
||||||
# Fallback to looking in the path
|
|
||||||
self.log(
|
|
||||||
"Common", "get_tor_paths", f"using tor binaries in system path"
|
|
||||||
)
|
|
||||||
tor_path = shutil.which("tor")
|
|
||||||
if not tor_path:
|
|
||||||
raise CannotFindTor()
|
|
||||||
obfs4proxy_file_path = shutil.which("obfs4proxy")
|
|
||||||
snowflake_file_path = shutil.which("snowflake-client")
|
|
||||||
prefix = os.path.dirname(os.path.dirname(tor_path))
|
|
||||||
tor_geo_ip_file_path = os.path.join(prefix, "share/tor/geoip")
|
|
||||||
tor_geo_ipv6_file_path = os.path.join(prefix, "share/tor/geoip6")
|
|
||||||
elif self.platform == "Windows":
|
elif self.platform == "Windows":
|
||||||
base_path = self.get_resource_path("tor")
|
base_path = self.get_resource_path("tor")
|
||||||
tor_path = os.path.join(base_path, "Tor", "tor.exe")
|
tor_path = os.path.join(base_path, "Tor", "tor.exe")
|
||||||
@ -341,24 +325,14 @@ class Common:
|
|||||||
tor_geo_ip_file_path = os.path.join(base_path, "Data", "Tor", "geoip")
|
tor_geo_ip_file_path = os.path.join(base_path, "Data", "Tor", "geoip")
|
||||||
tor_geo_ipv6_file_path = os.path.join(base_path, "Data", "Tor", "geoip6")
|
tor_geo_ipv6_file_path = os.path.join(base_path, "Data", "Tor", "geoip6")
|
||||||
elif self.platform == "Darwin":
|
elif self.platform == "Darwin":
|
||||||
# Look in resources first
|
tor_path = shutil.which("tor")
|
||||||
base_path = self.get_resource_path("tor")
|
if not tor_path:
|
||||||
if os.path.exists(base_path):
|
raise CannotFindTor()
|
||||||
tor_path = os.path.join(base_path, "tor")
|
obfs4proxy_file_path = shutil.which("obfs4proxy")
|
||||||
tor_geo_ip_file_path = os.path.join(base_path, "geoip")
|
snowflake_file_path = shutil.which("snowflake-client")
|
||||||
tor_geo_ipv6_file_path = os.path.join(base_path, "geoip6")
|
prefix = os.path.dirname(os.path.dirname(tor_path))
|
||||||
obfs4proxy_file_path = os.path.join(base_path, "obfs4proxy")
|
tor_geo_ip_file_path = os.path.join(prefix, "share/tor/geoip")
|
||||||
snowflake_file_path = os.path.join(base_path, "snowflake-client")
|
tor_geo_ipv6_file_path = os.path.join(prefix, "share/tor/geoip6")
|
||||||
else:
|
|
||||||
# Fallback to looking in the path
|
|
||||||
tor_path = shutil.which("tor")
|
|
||||||
if not tor_path:
|
|
||||||
raise CannotFindTor()
|
|
||||||
obfs4proxy_file_path = shutil.which("obfs4proxy")
|
|
||||||
snowflake_file_path = shutil.which("snowflake-client")
|
|
||||||
prefix = os.path.dirname(os.path.dirname(tor_path))
|
|
||||||
tor_geo_ip_file_path = os.path.join(prefix, "share/tor/geoip")
|
|
||||||
tor_geo_ipv6_file_path = os.path.join(prefix, "share/tor/geoip6")
|
|
||||||
elif self.platform == "BSD":
|
elif self.platform == "BSD":
|
||||||
tor_path = "/usr/local/bin/tor"
|
tor_path = "/usr/local/bin/tor"
|
||||||
tor_geo_ip_file_path = "/usr/local/share/tor/geoip"
|
tor_geo_ip_file_path = "/usr/local/share/tor/geoip"
|
||||||
|
Loading…
Reference in New Issue
Block a user