[Pkg-privacy-commits] [onionshare] 51/256: Display information about tor when testing settings is successful

Ulrike Uhlig ulrike at moszumanska.debian.org
Fri May 26 12:53:11 UTC 2017


This is an automated email from the git hooks/post-receive script.

ulrike pushed a commit to branch master
in repository onionshare.

commit b8e797049b82dd0eec42fa46e5da442801ae8dc8
Author: Micah Lee <micah at micahflee.com>
Date:   Thu Dec 29 10:03:29 2016 -0800

    Display information about tor when testing settings is successful
---
 onionshare/onion.py               | 8 +++-----
 onionshare_gui/settings_dialog.py | 3 ++-
 resources/locale/en.json          | 3 ++-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/onionshare/onion.py b/onionshare/onion.py
index df74ffd..03dfde2 100644
--- a/onionshare/onion.py
+++ b/onionshare/onion.py
@@ -167,16 +167,14 @@ class Onion(object):
             except UnreadableCookieFile:
                 raise TorErrorUnreadableCookieFile(strings._('settings_error_unreadable_cookie_file'))
 
+        # get the tor version
+        self.tor_version = self.c.get_version().version_str
 
         # do the versions of stem and tor that I'm using support ephemeral onion services?
-        tor_version = self.c.get_version().version_str
         list_ephemeral_hidden_services = getattr(self.c, "list_ephemeral_hidden_services", None)
-        self.supports_ephemeral = callable(list_ephemeral_hidden_services) and tor_version >= '0.2.7.1'
+        self.supports_ephemeral = callable(list_ephemeral_hidden_services) and self.tor_version >= '0.2.7.1'
 
         # do the versions of stem and tor that I'm using support stealth onion services?
-        self.check_for_stealth_support()
-
-    def check_for_stealth_support(self):
         try:
             res = self.c.create_ephemeral_hidden_service({1:1}, basic_auth={'onionshare':None}, await_publication=False)
             tmp_service_id = res.content()[0][2].split('=')[1]
diff --git a/onionshare_gui/settings_dialog.py b/onionshare_gui/settings_dialog.py
index 6116d2a..24cecbb 100644
--- a/onionshare_gui/settings_dialog.py
+++ b/onionshare_gui/settings_dialog.py
@@ -214,9 +214,10 @@ class SettingsDialog(QtWidgets.QDialog):
             onion = Onion(settings=settings)
 
             # If an exception hasn't been raised yet, the Tor settings work
+            Alert(strings._('settings_test_success', True).format(onion.tor_version, onion.supports_ephemeral, onion.supports_stealth))
 
         except (TorErrorInvalidSetting, TorErrorSocketPort, TorErrorSocketFile, TorErrorMissingPassword, TorErrorUnreadableCookieFile) as e:
-            Alert(e.args[0])
+            Alert(e.args[0], QtWidgets.QMessageBox.Warning)
 
     def save_clicked(self):
         """
diff --git a/resources/locale/en.json b/resources/locale/en.json
index f48b90e..c69fbab 100644
--- a/resources/locale/en.json
+++ b/resources/locale/en.json
@@ -83,5 +83,6 @@
     "settings_error_socket_port": "Can't connect to Tor controller on address {} with port {}.",
     "settings_error_socket_file": "Can't connect to Tor controller using socket file {}.",
     "settings_error_missing_password": "Connected to Tor controller, but it requires a password to authenticate.",
-    "settings_error_unreadable_cookie_file": "Connected to Tor controller, but can't authenticate because your password may be wrong, and your user doesn't have permission to read the cookie file."
+    "settings_error_unreadable_cookie_file": "Connected to Tor controller, but can't authenticate because your password may be wrong, and your user doesn't have permission to read the cookie file.",
+    "settings_test_success": "Congratulations, OnionShare can connect to the Tor controller.\n\nTor version: {}\nSupports ephemeral onion services: {}\nSupports stealth onion services: {}"
 }

-- 
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