Update patch as per the suggestion by @mig5 on

https://github.com/micahflee/onionshare/pull/585
Tested on current snapshot, both gui and cli work
This commit is contained in:
attila 2018-02-06 16:39:04 -05:00
parent ae494c8e33
commit bc8f233db9

View File

@ -131,7 +131,7 @@ class Onion(object):
self.stealth = False self.stealth = False
self.service_id = None self.service_id = None
self.system = platform.system() self.system = common.get_platform()
# Is bundled tor supported? # Is bundled tor supported?
if (self.system == 'Windows' or self.system == 'Darwin') and getattr(sys, 'onionshare_dev_mode', False): if (self.system == 'Windows' or self.system == 'Darwin') and getattr(sys, 'onionshare_dev_mode', False):
@ -183,7 +183,7 @@ class Onion(object):
raise OSError(strings._('no_available_port')) raise OSError(strings._('no_available_port'))
self.tor_torrc = os.path.join(self.tor_data_directory.name, 'torrc') self.tor_torrc = os.path.join(self.tor_data_directory.name, 'torrc')
else: else:
# Linux and Mac can use unix sockets # Linux, Mac and BSD can use unix sockets
with open(common.get_resource_path('torrc_template')) as f: with open(common.get_resource_path('torrc_template')) as f:
torrc_template = f.read() torrc_template = f.read()
self.tor_control_port = None self.tor_control_port = None
@ -316,8 +316,7 @@ class Onion(object):
# guessing the socket file name next # guessing the socket file name next
if not found_tor: if not found_tor:
try: try:
plat = common.get_platform() if self.system == 'Linux' or self.system == 'BSD':
if plat == 'Linux' or plat == 'BSD':
socket_file_path = '/run/user/{}/Tor/control.socket'.format(os.geteuid()) socket_file_path = '/run/user/{}/Tor/control.socket'.format(os.geteuid())
elif self.system == 'Darwin': elif self.system == 'Darwin':
socket_file_path = '/run/user/{}/Tor/control.socket'.format(os.geteuid()) socket_file_path = '/run/user/{}/Tor/control.socket'.format(os.geteuid())