Loading projects/firefox/namecoin-torbutton.patch +58 −17 Original line number Diff line number Diff line diff --git a/chrome/content/tor-circuit-display.js b/chrome/content/tor-circuit-display.js index 5ecbe7d..f771150 100644 index 119f6fca..477b0302 100644 --- a/chrome/content/tor-circuit-display.js +++ b/chrome/content/tor-circuit-display.js @@ -49,7 +49,11 @@ let credentialsToNodeDataMap = new Map(), @@ -48,7 +48,11 @@ let credentialsToNodeDataMap = new Map(), knownCircuitIDs = new Map(), // A mutable map that records the SOCKS credentials for the // latest channels for each browser + domain. Loading @@ -15,7 +15,7 @@ index 5ecbe7d..f771150 100644 // __trimQuotes(s)__. // Removes quotation marks around a quoted string. @@ -126,6 +130,28 @@ let getCircuitStatusByID = async function (aController, circuitID) { @@ -132,6 +136,28 @@ let getCircuitStatusByID = async function (aController, circuitID) { return null; }; Loading Loading @@ -44,7 +44,7 @@ index 5ecbe7d..f771150 100644 // __collectIsolationData(aController, updateUI)__. // Watches for STREAM SENTCONNECT events. When a SENTCONNECT event occurs, then // we assume isolation settings (SOCKS username+password) are now fixed for the @@ -139,6 +165,15 @@ let collectIsolationData = function (aController, updateUI) { @@ -145,6 +171,15 @@ let collectIsolationData = function (aController, updateUI) { "STREAM", streamEvent => streamEvent.StreamStatus === "SENTCONNECT", async (streamEvent) => { Loading @@ -60,10 +60,10 @@ index 5ecbe7d..f771150 100644 if (!knownCircuitIDs.get(streamEvent.CircuitID)) { logger.eclog(3, "streamEvent.CircuitID: " + streamEvent.CircuitID); knownCircuitIDs.set(streamEvent.CircuitID, true); @@ -306,12 +341,14 @@ let updateCircuitDisplay = function () { (i === 0 && nodeData[0].type !== "bridge") ? ["span", { class: "circuit-guard-info" }, uiString("guard")] : null); @@ -312,7 +347,9 @@ let updateCircuitDisplay = function () { } let domainParts = []; - if (domain.endsWith(".onion")) { + logger.eclog(3, "bit to onion map:" + JSON.stringify(bitToOnionMap) + ", domain: " + domain); + let mappedOnion = bitToOnionMap[domain]; Loading @@ -71,13 +71,54 @@ index 5ecbe7d..f771150 100644 for (let i = 0; i < 3; ++i) { li(uiString("relay")); } @@ -325,24 +362,28 @@ let updateCircuitDisplay = function () { domainParts.push(domain); } - li(domain); + li(domain, " ", mappedOnion ? ["span", { class: "circuit-ip-address" }, mappedOnion] : null); - // We use a XUL html:span element so that the tooltiptext is displayed. - li([ - "html:span", - { - class: "circuit-onion", - onclick: ` - this.classList.add("circuit-onion-copied"); - Cc[ - "@mozilla.org/widget/clipboardhelper;1" - ].getService(Ci.nsIClipboardHelper).copyString(this.getAttribute("data-onion")) - `, - "data-onion": domain, - "data-text-clicktocopy": torbutton_get_property_string("torbutton.circuit_display.click_to_copy"), - "data-text-copied": torbutton_get_property_string("torbutton.circuit_display.copied"), - tooltiptext: domain, - }, - ...domainParts, - ]); + if (mappedOnion) { + li(domain, " ", ["span", { class: "circuit-ip-address" }, mappedOnion]); + } else { + // We use a XUL html:span element so that the tooltiptext is displayed. + li([ + "html:span", + { + class: "circuit-onion", + onclick: ` + this.classList.add("circuit-onion-copied"); + Cc[ + "@mozilla.org/widget/clipboardhelper;1" + ].getService(Ci.nsIClipboardHelper).copyString(this.getAttribute("data-onion")) + `, + "data-onion": domain, + "data-text-clicktocopy": torbutton_get_property_string("torbutton.circuit_display.click_to_copy"), + "data-text-copied": torbutton_get_property_string("torbutton.circuit_display.copied"), + tooltiptext: domain, + }, + ...domainParts, + ]); + } // Hide the note about guards if we are using a bridge. document.getElementById("circuit-guard-note-container").style.display = (nodeData[0].type === "bridge") ? "none" : "block"; @@ -418,6 +455,7 @@ let setupDisplay = function (ipcFile, host, port, password, enablePrefName) { @@ -450,6 +491,7 @@ let setupDisplay = function (enablePrefName) { stopCollectingIsolationData = null, stopCollectingBrowserCredentials = null, stopEnsuringCorrectPopupDimensions = null, Loading @@ -85,7 +126,7 @@ index 5ecbe7d..f771150 100644 stop = function() { syncDisplayWithSelectedTab(false); if (myController) { @@ -430,6 +468,9 @@ let setupDisplay = function (ipcFile, host, port, password, enablePrefName) { @@ -462,6 +504,9 @@ let setupDisplay = function (enablePrefName) { if (stopEnsuringCorrectPopupDimensions) { stopEnsuringCorrectPopupDimensions(); } Loading @@ -95,7 +136,7 @@ index 5ecbe7d..f771150 100644 myController = null; } }, @@ -444,6 +485,7 @@ let setupDisplay = function (ipcFile, host, port, password, enablePrefName) { @@ -475,6 +520,7 @@ let setupDisplay = function (enablePrefName) { stop(); }); syncDisplayWithSelectedTab(true); Loading Loading
projects/firefox/namecoin-torbutton.patch +58 −17 Original line number Diff line number Diff line diff --git a/chrome/content/tor-circuit-display.js b/chrome/content/tor-circuit-display.js index 5ecbe7d..f771150 100644 index 119f6fca..477b0302 100644 --- a/chrome/content/tor-circuit-display.js +++ b/chrome/content/tor-circuit-display.js @@ -49,7 +49,11 @@ let credentialsToNodeDataMap = new Map(), @@ -48,7 +48,11 @@ let credentialsToNodeDataMap = new Map(), knownCircuitIDs = new Map(), // A mutable map that records the SOCKS credentials for the // latest channels for each browser + domain. Loading @@ -15,7 +15,7 @@ index 5ecbe7d..f771150 100644 // __trimQuotes(s)__. // Removes quotation marks around a quoted string. @@ -126,6 +130,28 @@ let getCircuitStatusByID = async function (aController, circuitID) { @@ -132,6 +136,28 @@ let getCircuitStatusByID = async function (aController, circuitID) { return null; }; Loading Loading @@ -44,7 +44,7 @@ index 5ecbe7d..f771150 100644 // __collectIsolationData(aController, updateUI)__. // Watches for STREAM SENTCONNECT events. When a SENTCONNECT event occurs, then // we assume isolation settings (SOCKS username+password) are now fixed for the @@ -139,6 +165,15 @@ let collectIsolationData = function (aController, updateUI) { @@ -145,6 +171,15 @@ let collectIsolationData = function (aController, updateUI) { "STREAM", streamEvent => streamEvent.StreamStatus === "SENTCONNECT", async (streamEvent) => { Loading @@ -60,10 +60,10 @@ index 5ecbe7d..f771150 100644 if (!knownCircuitIDs.get(streamEvent.CircuitID)) { logger.eclog(3, "streamEvent.CircuitID: " + streamEvent.CircuitID); knownCircuitIDs.set(streamEvent.CircuitID, true); @@ -306,12 +341,14 @@ let updateCircuitDisplay = function () { (i === 0 && nodeData[0].type !== "bridge") ? ["span", { class: "circuit-guard-info" }, uiString("guard")] : null); @@ -312,7 +347,9 @@ let updateCircuitDisplay = function () { } let domainParts = []; - if (domain.endsWith(".onion")) { + logger.eclog(3, "bit to onion map:" + JSON.stringify(bitToOnionMap) + ", domain: " + domain); + let mappedOnion = bitToOnionMap[domain]; Loading @@ -71,13 +71,54 @@ index 5ecbe7d..f771150 100644 for (let i = 0; i < 3; ++i) { li(uiString("relay")); } @@ -325,24 +362,28 @@ let updateCircuitDisplay = function () { domainParts.push(domain); } - li(domain); + li(domain, " ", mappedOnion ? ["span", { class: "circuit-ip-address" }, mappedOnion] : null); - // We use a XUL html:span element so that the tooltiptext is displayed. - li([ - "html:span", - { - class: "circuit-onion", - onclick: ` - this.classList.add("circuit-onion-copied"); - Cc[ - "@mozilla.org/widget/clipboardhelper;1" - ].getService(Ci.nsIClipboardHelper).copyString(this.getAttribute("data-onion")) - `, - "data-onion": domain, - "data-text-clicktocopy": torbutton_get_property_string("torbutton.circuit_display.click_to_copy"), - "data-text-copied": torbutton_get_property_string("torbutton.circuit_display.copied"), - tooltiptext: domain, - }, - ...domainParts, - ]); + if (mappedOnion) { + li(domain, " ", ["span", { class: "circuit-ip-address" }, mappedOnion]); + } else { + // We use a XUL html:span element so that the tooltiptext is displayed. + li([ + "html:span", + { + class: "circuit-onion", + onclick: ` + this.classList.add("circuit-onion-copied"); + Cc[ + "@mozilla.org/widget/clipboardhelper;1" + ].getService(Ci.nsIClipboardHelper).copyString(this.getAttribute("data-onion")) + `, + "data-onion": domain, + "data-text-clicktocopy": torbutton_get_property_string("torbutton.circuit_display.click_to_copy"), + "data-text-copied": torbutton_get_property_string("torbutton.circuit_display.copied"), + tooltiptext: domain, + }, + ...domainParts, + ]); + } // Hide the note about guards if we are using a bridge. document.getElementById("circuit-guard-note-container").style.display = (nodeData[0].type === "bridge") ? "none" : "block"; @@ -418,6 +455,7 @@ let setupDisplay = function (ipcFile, host, port, password, enablePrefName) { @@ -450,6 +491,7 @@ let setupDisplay = function (enablePrefName) { stopCollectingIsolationData = null, stopCollectingBrowserCredentials = null, stopEnsuringCorrectPopupDimensions = null, Loading @@ -85,7 +126,7 @@ index 5ecbe7d..f771150 100644 stop = function() { syncDisplayWithSelectedTab(false); if (myController) { @@ -430,6 +468,9 @@ let setupDisplay = function (ipcFile, host, port, password, enablePrefName) { @@ -462,6 +504,9 @@ let setupDisplay = function (enablePrefName) { if (stopEnsuringCorrectPopupDimensions) { stopEnsuringCorrectPopupDimensions(); } Loading @@ -95,7 +136,7 @@ index 5ecbe7d..f771150 100644 myController = null; } }, @@ -444,6 +485,7 @@ let setupDisplay = function (ipcFile, host, port, password, enablePrefName) { @@ -475,6 +520,7 @@ let setupDisplay = function (enablePrefName) { stop(); }); syncDisplayWithSelectedTab(true); Loading