diff --git a/locale/en.json b/locale/en.json index 164a7844..819c9b94 100644 --- a/locale/en.json +++ b/locale/en.json @@ -44,5 +44,5 @@ "gui_please_wait": "Please wait...", "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", - "using_ephemeral": "Using ephemeral Tor hidden service" + "using_ephemeral": "Staring ephemeral Tor hidden service and awaiting publication" } diff --git a/onionshare/hs.py b/onionshare/hs.py index fd28b64c..b1636338 100644 --- a/onionshare/hs.py +++ b/onionshare/hs.py @@ -55,9 +55,10 @@ class HS(object): self.supports_ephemeral = callable(list_ephemeral_hidden_services) and tor_version >= '0.2.7.1' def start(self, port): + print strings._("connecting_ctrlport").format(int(port)) if self.supports_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' return onion_host diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py index 34e57b43..527eab09 100644 --- a/onionshare/onionshare.py +++ b/onionshare/onionshare.py @@ -65,6 +65,7 @@ class OnionShare(object): self.onion_host = self.hs.start(self.port) def wait_for_hs(self): + # legacy only, this function is no longer required with ephemeral hidden services if self.local_only: return True @@ -162,7 +163,6 @@ def main(cwd=None): try: app = OnionShare(debug, local_only, stay_open, transparent_torification) app.choose_port() - print strings._("connecting_ctrlport").format(int(app.port)) app.start_hidden_service() except hs.NoTor as e: sys.exit(e.args[0]) @@ -187,9 +187,10 @@ def main(cwd=None): try: # Trap Ctrl-C # wait for hs - ready = app.wait_for_hs() - if not ready: - sys.exit() + if not app.hs.supports_ephemeral: + ready = app.wait_for_hs() + if not ready: + sys.exit() print strings._("give_this_url") print 'http://{0:s}/{1:s}'.format(app.onion_host, web.slug)