[tbb-commits] [torbutton/master] Bug 14324: Show HS circuit in Tor circuit display

gk at torproject.org gk at torproject.org
Thu Mar 12 10:49:25 UTC 2015


commit c61487302e5056c561c7d50887807a320b354575
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Tue Mar 10 21:44:41 2015 -0700

    Bug 14324: Show HS circuit in Tor circuit display
---
 src/chrome/content/tor-circuit-display.js |   18 +++++++++++++-----
 src/chrome/locale/en/torbutton.properties |    2 ++
 src/chrome/skin/tor-circuit-display.css   |    5 +++++
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/chrome/content/tor-circuit-display.js b/src/chrome/content/tor-circuit-display.js
index fc4da14..b31953d 100644
--- a/src/chrome/content/tor-circuit-display.js
+++ b/src/chrome/content/tor-circuit-display.js
@@ -181,10 +181,9 @@ let showCircuitDisplay = function (show) {
 // Takes a nodeData array of node items, each like
 // `{ ip : "12.34.56.78", country : "fr" }`
 // and converts each node data to text, as
-// `"France (12.34.56.78)"`, prepended by "This browser"
-// and appended by "Internet".
+// `"France (12.34.56.78)"`.
 let nodeLines = function (nodeData) {
-  let result = [uiString("this_browser")];
+  let result = [];
   for (let {ip, countryCode, type, bridgeType} of nodeData) {
     let bridge = type === "bridge";
     result.push(
@@ -203,7 +202,6 @@ let nodeLines = function (nodeData) {
                           // and right-to-left languages.
                           " &#x202D; (" + (ip || uiString("ip_unknown")) + ")&#x202C;"));
   }
-  result.push(uiString("internet"));
   return result;
 };
 
@@ -225,6 +223,10 @@ let getSOCKSCredentialsForBrowser = function (browser) {
   return proxyInfo.username + ":" + proxyInfo.password;
 };
 
+// __onionSiteRelayLine__.
+// When we have an onion site, we simply show the word '(relay)'.
+let onionSiteRelayLine = "<li class='relay'>(" + uiString("relay") + ")</li>";
+
 // __updateCircuitDisplay()__.
 // Updates the Tor circuit display, showing the current domain
 // and the relay nodes for that domain.
@@ -242,10 +244,16 @@ let updateCircuitDisplay = function () {
 	document.getElementById("domain").innerHTML = "(" + domain + "):";
 	// Update the displayed information for the relay nodes.
         let lines = nodeLines(nodeData),
-            nodeInnerHTML = "";
+            nodeInnerHTML = "<li>" + uiString("this_browser") + "</li>";
 	for (let line of lines) {
           nodeInnerHTML += "<li>" + line + "</li>";
 	}
+        nodeInnerHTML += domain.endsWith(".onion") ?
+                           (onionSiteRelayLine +
+                            onionSiteRelayLine +
+                            onionSiteRelayLine +
+                            "<li>" + uiString("onion_site") + "</li>") :
+                           "<li>" + uiString("internet") + "</li>";
         document.getElementById("circuit-nodes").innerHTML = nodeInnerHTML;
       }
     }
diff --git a/src/chrome/locale/en/torbutton.properties b/src/chrome/locale/en/torbutton.properties
index 505f31b..3ee41f6 100644
--- a/src/chrome/locale/en/torbutton.properties
+++ b/src/chrome/locale/en/torbutton.properties
@@ -2,7 +2,9 @@ torbutton.button.tooltip.disabled = Enable Tor
 torbutton.button.tooltip.enabled = Disable Tor
 torbutton.circuit_display.internet = Internet
 torbutton.circuit_display.ip_unknown = IP unknown
+torbutton.circuit_display.onion_site = Onion site
 torbutton.circuit_display.this_browser = This browser
+torbutton.circuit_display.relay = relay
 torbutton.circuit_display.tor_bridge = Bridge
 torbutton.circuit_display.unknown_country = Unknown country
 torbutton.panel.tooltip.disabled = Click to enable Tor
diff --git a/src/chrome/skin/tor-circuit-display.css b/src/chrome/skin/tor-circuit-display.css
index b9d0638..004a68f 100644
--- a/src/chrome/skin/tor-circuit-display.css
+++ b/src/chrome/skin/tor-circuit-display.css
@@ -104,3 +104,8 @@ ul#circuit-nodes li:first-child:before {
 ul#circuit-nodes li:last-child:before {
   height: 50%;
 }
+
+/* Onion site relay node text should be gray. */
+ul#circuit-nodes li.relay {
+  color: gray;
+}
\ No newline at end of file



More information about the tbb-commits mailing list