mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Fixed call to create_ephemeral_hidden_service, and also await_publication=True to make the app.wait_for_hs() call obsolete
This commit is contained in:
parent
eba6dbb843
commit
629a70c249
@ -44,5 +44,5 @@
|
|||||||
"gui_please_wait": "Please wait...",
|
"gui_please_wait": "Please wait...",
|
||||||
"error_hs_dir_cannot_create": "Cannot create hidden service dir {0:s}",
|
"error_hs_dir_cannot_create": "Cannot create hidden service dir {0:s}",
|
||||||
"error_hs_dir_not_writable": "Hidden service dir {0:s} is not writable",
|
"error_hs_dir_not_writable": "Hidden service dir {0:s} is not writable",
|
||||||
"using_ephemeral": "Using ephemeral Tor hidden service"
|
"using_ephemeral": "Staring ephemeral Tor hidden service and awaiting publication"
|
||||||
}
|
}
|
||||||
|
@ -55,9 +55,10 @@ class HS(object):
|
|||||||
self.supports_ephemeral = callable(list_ephemeral_hidden_services) and tor_version >= '0.2.7.1'
|
self.supports_ephemeral = callable(list_ephemeral_hidden_services) and tor_version >= '0.2.7.1'
|
||||||
|
|
||||||
def start(self, port):
|
def start(self, port):
|
||||||
|
print strings._("connecting_ctrlport").format(int(port))
|
||||||
if self.supports_ephemeral:
|
if self.supports_ephemeral:
|
||||||
print strings._('using_ephemeral')
|
print strings._('using_ephemeral')
|
||||||
res = self.c.create_ephemeral_hidden_service(port)
|
res = self.c.create_ephemeral_hidden_service({ 80: port }, await_publication = True)
|
||||||
onion_host = res.content()[0][2].split('=')[1] + '.onion'
|
onion_host = res.content()[0][2].split('=')[1] + '.onion'
|
||||||
return onion_host
|
return onion_host
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ class OnionShare(object):
|
|||||||
self.onion_host = self.hs.start(self.port)
|
self.onion_host = self.hs.start(self.port)
|
||||||
|
|
||||||
def wait_for_hs(self):
|
def wait_for_hs(self):
|
||||||
|
# legacy only, this function is no longer required with ephemeral hidden services
|
||||||
if self.local_only:
|
if self.local_only:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -162,7 +163,6 @@ def main(cwd=None):
|
|||||||
try:
|
try:
|
||||||
app = OnionShare(debug, local_only, stay_open, transparent_torification)
|
app = OnionShare(debug, local_only, stay_open, transparent_torification)
|
||||||
app.choose_port()
|
app.choose_port()
|
||||||
print strings._("connecting_ctrlport").format(int(app.port))
|
|
||||||
app.start_hidden_service()
|
app.start_hidden_service()
|
||||||
except hs.NoTor as e:
|
except hs.NoTor as e:
|
||||||
sys.exit(e.args[0])
|
sys.exit(e.args[0])
|
||||||
@ -187,6 +187,7 @@ def main(cwd=None):
|
|||||||
|
|
||||||
try: # Trap Ctrl-C
|
try: # Trap Ctrl-C
|
||||||
# wait for hs
|
# wait for hs
|
||||||
|
if not app.hs.supports_ephemeral:
|
||||||
ready = app.wait_for_hs()
|
ready = app.wait_for_hs()
|
||||||
if not ready:
|
if not ready:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
Loading…
Reference in New Issue
Block a user