mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-28 23:37:03 -05:00
Refactor onionshare CLI to use await_publication=True when using ephemeral onion services, instead of relying on wait_for_hs function
This commit is contained in:
parent
1372239ed7
commit
360fb6cfcc
@ -90,9 +90,9 @@ class Onion(object):
|
|||||||
print(strings._("connecting_ctrlport").format(int(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({ 80: port }, await_publication = False)
|
res = self.c.create_ephemeral_hidden_service({ 80: port }, await_publication = True)
|
||||||
self.service_id = res.content()[0][2].split('=')[1]
|
self.service_id = res.content()[0][2].split('=')[1]
|
||||||
onion_host = res.content()[0][2].split('=')[1] + '.onion'
|
onion_host = self.service_id + '.onion'
|
||||||
return onion_host
|
return onion_host
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -158,14 +158,14 @@ def main(cwd=None):
|
|||||||
print(strings._("large_filesize"))
|
print(strings._("large_filesize"))
|
||||||
print('')
|
print('')
|
||||||
|
|
||||||
# start onionshare service in new thread
|
# start onionshare http service in new thread
|
||||||
t = threading.Thread(target=web.start, args=(app.port, app.stay_open, app.transparent_torification))
|
t = threading.Thread(target=web.start, args=(app.port, app.stay_open, app.transparent_torification))
|
||||||
t.daemon = True
|
t.daemon = True
|
||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
try: # Trap Ctrl-C
|
try: # Trap Ctrl-C
|
||||||
# wait for hs, only if using old version of tor
|
# wait for hs, only if using old version of tor
|
||||||
if not app.local_only:
|
if not app.local_only and not app.onion.supports_ephemeral:
|
||||||
ready = app.onion.wait_for_hs(app.onion_host)
|
ready = app.onion.wait_for_hs(app.onion_host)
|
||||||
if not ready:
|
if not ready:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user