[Pkg-privacy-commits] [onionshare] 10/53: Fixed call to create_ephemeral_hidden_service, and also await_publication=True to make the app.wait_for_hs() call obsolete
Ulrike Uhlig
u-guest at moszumanska.debian.org
Wed Dec 30 00:20:11 UTC 2015
This is an automated email from the git hooks/post-receive script.
u-guest pushed a commit to branch debian
in repository onionshare.
commit 629a70c2492cdb75d9a56e2ca56fac5c1c9a95a6
Author: Micah Lee <micah at micahflee.com>
Date: Tue Sep 8 17:28:23 2015 -0700
Fixed call to create_ephemeral_hidden_service, and also await_publication=True to make the app.wait_for_hs() call obsolete
---
locale/en.json | 2 +-
onionshare/hs.py | 3 ++-
onionshare/onionshare.py | 9 +++++----
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/locale/en.json b/locale/en.json
index 164a784..819c9b9 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 fd28b64..b163633 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 34e57b4..527eab0 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)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionshare.git
More information about the Pkg-privacy-commits
mailing list