mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-28 00:39:37 -05:00
Guess the default socket file path for new versions of Tor Browser in OS X
This commit is contained in:
parent
406fffdb39
commit
d069cc2a29
@ -108,6 +108,7 @@ class Onion(object):
|
|||||||
|
|
||||||
if self.settings.get('connection_type') == 'automatic':
|
if self.settings.get('connection_type') == 'automatic':
|
||||||
# Automatically try to guess the right way to connect to Tor Browser
|
# Automatically try to guess the right way to connect to Tor Browser
|
||||||
|
p = platform.system()
|
||||||
|
|
||||||
# Try connecting to control port
|
# Try connecting to control port
|
||||||
found_tor = False
|
found_tor = False
|
||||||
@ -131,11 +132,19 @@ class Onion(object):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# If this still didn't work, try guessing the default socket file path
|
||||||
|
socket_file_path = ''
|
||||||
|
if not found_tor:
|
||||||
|
if p == 'Darwin':
|
||||||
|
socket_file_path = os.path.expanduser('~/Library/Application Support/TorBrowser-Data/Tor/control.socket')
|
||||||
|
|
||||||
|
self.c = Controller.from_socket_file(path=socket_file_path)
|
||||||
|
found_tor = True
|
||||||
|
|
||||||
# If connecting to default control ports failed, so let's try
|
# If connecting to default control ports failed, so let's try
|
||||||
# guessing the socket file name next
|
# guessing the socket file name next
|
||||||
if not found_tor:
|
if not found_tor:
|
||||||
try:
|
try:
|
||||||
p = platform.system()
|
|
||||||
if p == 'Linux':
|
if p == 'Linux':
|
||||||
socket_file_path = '/run/user/{}/Tor/control.socket'.format(os.geteuid())
|
socket_file_path = '/run/user/{}/Tor/control.socket'.format(os.geteuid())
|
||||||
elif p == 'Darwin':
|
elif p == 'Darwin':
|
||||||
|
Loading…
Reference in New Issue
Block a user