From 360fb6cfccf76f4ddc821145fe4d93bcf4341259 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Mon, 5 Sep 2016 11:29:12 -0700 Subject: [PATCH] Refactor onionshare CLI to use await_publication=True when using ephemeral onion services, instead of relying on wait_for_hs function --- onionshare/onion.py | 4 ++-- onionshare/onionshare.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/onionshare/onion.py b/onionshare/onion.py index 7ccf7b01..c015f5e9 100644 --- a/onionshare/onion.py +++ b/onionshare/onion.py @@ -90,9 +90,9 @@ class Onion(object): print(strings._("connecting_ctrlport").format(int(port))) if self.supports_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] - onion_host = res.content()[0][2].split('=')[1] + '.onion' + onion_host = self.service_id + '.onion' return onion_host else: diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py index 4190ddbf..cd401f3c 100644 --- a/onionshare/onionshare.py +++ b/onionshare/onionshare.py @@ -158,14 +158,14 @@ def main(cwd=None): print(strings._("large_filesize")) 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.daemon = True t.start() try: # Trap Ctrl-C # 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) if not ready: sys.exit()