tor-commits
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
August 2018
- 17 participants
- 2582 discussions
15 Aug '18
commit 985bcbf8323c159b18345fbfc010a7277d54559f
Author: Kathy Brade <brade(a)pearlcrescent.com>
Date: Fri Jul 27 12:23:36 2018 -0400
Bug 26960: implement new about:tor start page
Implement new design from UX team.
Remove "update needed" notification (will be addressed by bug 25694).
---
src/chrome/content/aboutTor/aboutTor-content.js | 222 +--------------
src/chrome/content/aboutTor/aboutTor.xhtml | 212 +++++++++-----
src/chrome/content/torbutton.js | 63 +----
src/chrome/locale/en/aboutTor.dtd | 42 +--
src/chrome/locale/en/aboutTor.properties | 8 +-
src/chrome/skin/aboutTor.css | 353 ++++++++++--------------
src/chrome/skin/forwardArrow.png | Bin 0 -> 258 bytes
src/chrome/skin/onionArrow-extension.png | Bin 1798 -> 0 bytes
src/chrome/skin/onionArrow-leftBend.png | Bin 2080 -> 0 bytes
src/chrome/skin/onionArrow-rightBend.png | Bin 2077 -> 0 bytes
src/chrome/skin/onionArrow-short.png | Bin 1913 -> 0 bytes
src/chrome/skin/search.png | Bin 934 -> 0 bytes
src/chrome/skin/searchLogo.png | Bin 0 -> 1912 bytes
src/chrome/skin/tor-off.png | Bin 5835 -> 0 bytes
src/chrome/skin/tor-on.png | Bin 17945 -> 0 bytes
src/defaults/preferences/preferences.js | 1 -
16 files changed, 318 insertions(+), 583 deletions(-)
diff --git a/src/chrome/content/aboutTor/aboutTor-content.js b/src/chrome/content/aboutTor/aboutTor-content.js
index 1a8d5cfa..c2e26c8c 100644
--- a/src/chrome/content/aboutTor/aboutTor-content.js
+++ b/src/chrome/content/aboutTor/aboutTor-content.js
@@ -12,8 +12,6 @@
* the code in torbutton.js:
* AboutTor:Loaded page loaded content -> chrome
* AboutTor:ChromeData privileged data chrome -> content
- * AboutTor:GetToolbarData request toolbar info content -> chrome
- * AboutTor:ToolbarData toolbar info chrome -> content
*/
var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
@@ -24,7 +22,8 @@ let { bindPrefAndInit } = Cu.import("resource://torbutton/modules/utils.js", {})
var AboutTorListener = {
- kAboutTorMessages: [ "AboutTor:ChromeData", "AboutTor:ToolbarData" ],
+ kAboutTorLoadedMessage: "AboutTor:Loaded",
+ kAboutTorChromeDataMessage: "AboutTor:ChromeData",
get isAboutTor() {
return content.document.documentURI.toLowerCase() == "about:tor";
@@ -45,9 +44,6 @@ var AboutTorListener = {
case "pagehide":
this.onPageHide();
break;
- case "resize":
- sendAsyncMessage("AboutTor:GetToolbarData");
- break;
}
},
@@ -56,12 +52,9 @@ var AboutTorListener = {
return;
switch (aMessage.name) {
- case "AboutTor:ChromeData":
+ case this.kAboutTorChromeDataMessage:
this.onChromeDataUpdate(aMessage.data);
break;
- case "AboutTor:ToolbarData":
- this.onToolbarDataUpdate(aMessage.data);
- break;
}
},
@@ -74,70 +67,42 @@ var AboutTorListener = {
});
// Add message and event listeners.
- this.kAboutTorMessages.forEach(aMsg => addMessageListener(aMsg, this));
- addMessageListener("AboutTor:ChromeData", this);
+ addMessageListener(this.kAboutTorChromeDataMessage, this);
addEventListener("pagehide", this, false);
addEventListener("resize", this, false);
- sendAsyncMessage("AboutTor:Loaded");
+ sendAsyncMessage(this.kAboutTorLoadedMessage);
},
onPageHide: function() {
removeEventListener("resize", this, false);
removeEventListener("pagehide", this, false);
- this.kAboutTorMessages.forEach(aMsg => removeMessageListener(aMsg, this));
+ removeMessageListener(this.kAboutTorChromeDataMessage, this);
},
onChromeDataUpdate: function(aData) {
let body = content.document.body;
- // Update status: tor on/off, update needed, Tor Browser manual shown.
+ // Update status: tor on/off, Tor Browser manual shown.
if (aData.torOn)
body.setAttribute("toron", "yes");
else
body.removeAttribute("toron");
- if (aData.updateNeeded)
- body.setAttribute("torNeedsUpdate", "yes");
- else
- body.removeAttribute("torNeedsUpdate");
-
if (aData.showManual)
body.setAttribute("showmanual", "yes");
else
body.removeAttribute("showmanual");
- // Setting body.initialized="yes" displays the body, which must be done
- // at this point because our remaining initialization depends on elements
- // being visible so that their size and position are accurate.
+ // Setting body.initialized="yes" displays the body.
body.setAttribute("initialized", "yes");
-
- let containerName = "torstatus-" + (aData.torOn ? "on" : "off") +
- "-container";
- this.adjustFontSizes(containerName);
-
- this.onToolbarDataUpdate(aData);
- },
-
- onToolbarDataUpdate: function(aData) {
- this.adjustArrow(aData.toolbarButtonXPos);
},
onLocaleChange: function(aLocale) {
- this.insertPropertyStrings();
-
// Set Tor Browser manual link.
content.document.getElementById("manualLink").href =
"https://tb-manual.torproject.org/" + aLocale;
- // Insert "Test Tor Network Settings" url.
- let elem = content.document.getElementById("testTorSettings");
- if (elem) {
- let url = Services.prefs.getCharPref(
- "extensions.torbutton.test_url_interactive");
- elem.href = url.replace(/__LANG__/g, aLocale.replace(/-/g, '_'));
- }
-
// Display the Tor Browser product name and version.
try {
const kBrandBundle = "chrome://branding/locale/brand.properties";
@@ -153,177 +118,6 @@ var AboutTorListener = {
elem.appendChild(content.document.createTextNode(productName + '\n'
+ tbbVersion));
} catch (e) {}
- },
-
- insertPropertyStrings: function() {
- try {
- let kPropertiesURL = "chrome://torbutton/locale/aboutTor.properties";
-
- let stringBundle = Services.strings.createBundle(kPropertiesURL);
- let s1 = stringBundle.GetStringFromName("aboutTor.searchDDG.privacy.link");
- let s2 = stringBundle.GetStringFromName("aboutTor.searchDDG.search.link");
- let result = stringBundle.formatStringFromName(
- "aboutTor.searchDDG.privacy", [s1, s2], 2);
- if (result) {
- let elem = content.document.getElementById("searchProviderInfo");
- if (elem)
- elem.innerHTML = result;
- }
- } catch(e) {}
- },
-
- // Ensure that text in top area does not overlap the tor on/off (onion) image.
- // This is done by reducing the font sizes as necessary.
- adjustFontSizes: function(aContainerName)
- {
- let imgElem = content.document.getElementById("torstatus-image");
- let containerElem = content.document.getElementById(aContainerName);
- if (!imgElem || !containerElem)
- return;
-
- try
- {
- let imgRect = imgElem.getBoundingClientRect();
-
- for (let textElem = containerElem.firstChild; textElem;
- textElem = textElem.nextSibling)
- {
- if ((textElem.nodeType != textElem.ELEMENT_NODE) ||
- (textElem.nodeName.toLowerCase() == "br"))
- {
- continue;
- }
-
- let textRect = textElem.getBoundingClientRect();
- if (0 == textRect.width)
- continue;
-
- // Reduce font to 90% of previous size, repeating the process up to 7
- // times. This allows for a maximum reduction to just less than 50% of
- // the original size.
- let maxTries = 7;
- while ((textRect.left < imgRect.right) && (--maxTries >= 0))
- {
- let style = content.document.defaultView
- .getComputedStyle(textElem, null);
- let fontSize = parseFloat(style.getPropertyValue("font-size"));
- textElem.style.fontSize = (fontSize * 0.9) + "px";
- textRect = textElem.getBoundingClientRect();
- }
- }
-
- } catch (e) {}
- },
-
- adjustArrow: function(aToolbarButtonXPos)
- {
- let win = content;
- let doc = content.document;
- let textElem = doc.getElementById("updatePrompt");
- let arrowHeadDiv = doc.getElementById("toolbarIconArrowHead");
- let vertExtDiv = doc.getElementById("toolbarIconArrowVertExtension");
- let bendDiv = doc.getElementById("toolbarIconArrowBend");
- let horzExtDiv = doc.getElementById("toolbarIconArrowHorzExtension");
- if (!textElem || !arrowHeadDiv || !vertExtDiv || !bendDiv || !horzExtDiv)
- return;
-
- let arrowTailElems = [ vertExtDiv, bendDiv, horzExtDiv ];
- if (!aToolbarButtonXPos || isNaN(aToolbarButtonXPos) ||
- (aToolbarButtonXPos < 0))
- {
- arrowHeadDiv.style.display = "none";
- for (let elem of arrowTailElems)
- elem.style.display = "none";
- return;
- }
-
- const kArrowMargin = 6; // Horizontal margin between line and text.
- const kArrowHeadExtraWidth = 9; // Horizontal margin to the line.
- const kArrowLineThickness = 11;
- const kBendWidth = 22;
- const kBendHeight = 22;
-
- try {
- // Compensate for any content zoom that may be in effect on about:tor.
- // Because window.devicePixelRatio always returns 1.0 for non-Chrome
- // windows (see bug 13875), we use screenPixelsPerCSSPixel for the
- // content window.
- let pixRatio = content.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindowUtils)
- .screenPixelsPerCSSPixel;
- let tbXpos = Math.round(aToolbarButtonXPos / pixRatio);
-
- arrowHeadDiv.style.display = "block"; // Must be visible to get offsetWidth.
- let arrowHalfWidth = Math.round(arrowHeadDiv.offsetWidth / 2);
- let leftAnchor = textElem.offsetLeft - kArrowMargin
- - kBendWidth + Math.round(kArrowLineThickness / 2);
- let rightAnchor = textElem.offsetLeft + textElem.offsetWidth
- + kArrowMargin + arrowHalfWidth;
-
- let isArrowOnLeft = (tbXpos < leftAnchor);
- let isArrowOnRight = (tbXpos > rightAnchor) &&
- (tbXpos < (win.innerWidth - arrowHalfWidth));
- let isArrowInMiddle = (tbXpos >= leftAnchor) && (tbXpos <= rightAnchor);
-
- if (isArrowOnLeft || isArrowOnRight || isArrowInMiddle)
- {
- // Position the arrow head.
- let arrowHeadLeft = tbXpos - arrowHalfWidth;
- arrowHeadDiv.style.left = arrowHeadLeft + "px";
- if (isArrowOnLeft || isArrowOnRight)
- {
- let horzExtBottom = textElem.offsetTop +
- Math.round((textElem.offsetHeight + kArrowLineThickness) / 2);
-
- // Position the vertical (extended) line.
- let arrowHeadBottom = arrowHeadDiv.offsetTop +
- arrowHeadDiv.offsetHeight;
- vertExtDiv.style.top = arrowHeadBottom + "px";
- vertExtDiv.style.left = (arrowHeadLeft + kArrowHeadExtraWidth) + "px";
- let ht = horzExtBottom - kBendHeight - arrowHeadBottom;
- vertExtDiv.style.height = ht + "px";
-
- // Position the bend (elbow).
- bendDiv.style.top = (horzExtBottom - kBendHeight) + "px";
- let bendDivLeft;
- if (isArrowOnLeft)
- {
- bendDiv.setAttribute("pos", "left");
- bendDivLeft = arrowHeadLeft + kArrowHeadExtraWidth;
- }
- else if (isArrowOnRight)
- {
- bendDiv.setAttribute("pos", "right");
- bendDivLeft = arrowHeadLeft + kArrowHeadExtraWidth
- + kArrowLineThickness - kBendWidth;
- }
- bendDiv.style.left = bendDivLeft + "px";
-
- // Position the horizontal (extended) line.
- horzExtDiv.style.top = (horzExtBottom - kArrowLineThickness) + "px";
- let horzExtLeft, w;
- if (isArrowOnLeft)
- {
- horzExtLeft = bendDivLeft + kBendWidth;
- w = (textElem.offsetLeft - horzExtLeft - kArrowMargin);
- }
- else
- {
- horzExtLeft = rightAnchor - arrowHalfWidth;
- w = tbXpos - arrowHalfWidth - horzExtLeft;
- }
- horzExtDiv.style.left = horzExtLeft + "px";
- horzExtDiv.style.width = w + "px";
- }
- }
-
- let headDisplay = (isArrowOnLeft || isArrowInMiddle || isArrowOnRight)
- ? "block" : "none";
- arrowHeadDiv.style.display = headDisplay;
- let tailDisplay = (isArrowOnLeft || isArrowOnRight) ? "block" : "none";
- for (let elem of arrowTailElems)
- elem.style.display = tailDisplay;
- } catch (e) {}
}
};
diff --git a/src/chrome/content/aboutTor/aboutTor.xhtml b/src/chrome/content/aboutTor/aboutTor.xhtml
index 5cb2a605..c2bbcb25 100644
--- a/src/chrome/content/aboutTor/aboutTor.xhtml
+++ b/src/chrome/content/aboutTor/aboutTor.xhtml
@@ -31,87 +31,173 @@ window.addEventListener("pageshow", function() {
</script>
</head>
<body dir="&locale.dir;">
- <div class="hideIfTorIsUpToDate">
- <div id="toolbarIconArrowHead" class="arrow"/>
- <div id="toolbarIconArrowVertExtension" class="arrow"/>
- <div id="toolbarIconArrowBend" class="arrow"/>
- <div id="toolbarIconArrowHorzExtension" class="arrow"/>
- </div>
<div class="torcontent-container">
<div id="torstatus-version"/>
<div id="torstatus" class="top">
- <div id="torstatus-image"/>
<div id="torstatus-on-container" class="hideIfTorOff torstatus-container">
- <h1>&aboutTor.success.label;</h1>
- <br/>
- <h3 class="hideIfTBBNeedsUpdate">&aboutTor.success3.label;</h3>
+ <div class="heading1">&aboutTor.ready.label;</div>
<br/>
- <div style="margin-top: 20px;">
- <a id="testTorSettings" href="about:blank">&aboutTor.check.label;</a>
- </div>
+ <div class="heading2">&aboutTor.ready2.label;</div>
</div>
<div id="torstatus-off-container" class="hideIfTorOn torstatus-container">
- <h1>&aboutTor.failure.label;</h1>
+ <div class="heading1">&aboutTor.failure.label;</div>
<br/>
- <h2>&aboutTor.failure2.label;</h2>
- </div>
- </div>
- <div class="top">
- <div class="hideIfTorIsUpToDate">
- <h1 class="hideIfTorOff">&aboutTor.outOfDateTorOn.label;</h1>
- <h1 class="hideIfTorOn">&aboutTor.outOfDateTorOff.label;</h1>
- <div>
- <h3 id="updatePrompt">&aboutTor.outOfDate2.label;</h3>
- </div>
+ <div class="heading2">&aboutTor.failure2.label;</div>
</div>
</div>
<div class="searchbox hideIfTorOff"> <!-- begin form based search -->
<form action="&aboutTor.searchDDGPost.link;" method="post">
- <div id="sxw">
- <div id="sbutton">
- <input name="b" id="sb" value="" title="&aboutTor.search.label;"
- alt="&aboutTor.search.label;" type="submit"/>
+ <div class="searchwrapper">
+ <label class="searchlabel" for="search-text"> </label>
+ <input name="q" id="search-text" placeholder="&aboutTor.search.label;"
+ autocomplete="off" type="text"/>
+ <input name="b" id="search-button" value=""
+ title="&aboutTor.search.label;"
+ alt="&aboutTor.search.label;" type="submit"/>
</div>
- <input name="q" autocomplete="off" id="sx" type="text"/>
- </div>
- <h4 id="searchProviderInfo" />
</form>
</div>
- <div class="hideIfTorOn" style="height:100px"/>
-
- <div id="middle" class="hideIfTorOff">
- <div class="bubble">
- <h1>&aboutTor.whatnextQuestion.label;</h1>
- <p>&aboutTor.whatnextAnswer.label;</p>
- <ul>
- <li>
- <a href="&aboutTor.whatnext.link;">
- &aboutTor.whatnext.label;
- </a>
- </li>
- <li class="showForManual">
- <a id="manualLink">
- &aboutTor.torbrowser_user_manual.label; »
- </a>
- </li>
- </ul>
- </div>
- <div class="bubble">
- <h1>&aboutTor.helpInfo1.label;</h1>
- <p>&aboutTor.helpInfo2.label;</p>
- <ul>
- <li><a href="&aboutTor.helpInfo3.link;">&aboutTor.helpInfo3.label;</a></li>
- <li><a href="&aboutTor.helpInfo4.link;">&aboutTor.helpInfo4.label;</a></li>
- <li><a href="&aboutTor.helpInfo5.link;">&aboutTor.helpInfo5.label;</a></li>
- </ul>
- </div>
- </div> <!-- middle -->
-
<div id="bottom">
- <p>&aboutTor.footer.label;
- <a href="&aboutTor.learnMore.link;">&aboutTor.learnMore.label;</a></p>
+ <p class="showForManual moreInfoLink">&aboutTor.torbrowser_user_manual_questions.label;
+ <a id="manualLink">&aboutTor.torbrowser_user_manual_link.label;</a></p>
+ <p>&aboutTor.tor_mission.label;
+ <a href="&aboutTor.getInvolved.link;">&aboutTor.getInvolved.label;</a></p>
+ </div>
+ </div>
+
+<!--
+ - The abstract onion pattern begins here. There are two
+ - "onion-pattern-row" elements, each containing 14 circles. The width
+ - of "onion-pattern-row" is fixed at a value that is wide enough so the
+ - circles are not distorted by the flex-based layout. The parent
+ - "onion-pattern-container" element has overflow: hidden and is designed
+ - to expand to the width of the page, until it reaches a maximum width
+ - that can accommodate all 14 circles. Since the rows are wider than
+ - most browser windows, typically the two rows of onions will fill the
+ - bottom of the page. On really wide pages, the onions are centered at
+ - the bottom of the page.
+ -->
+ <div class="onion-pattern-container">
+ <div class="onion-pattern-row">
+ <div class="circle solid"></div>
+
+ <div class="circle border"></div>
+
+ <div class="circle border">
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ </div>
+
+ <div class="circle">
+ <div class="half solid"></div>
+ <div class="half dotted"></div>
+ </div>
+
+ <div class="circle dotted"></div>
+
+ <div class="circle dotted">
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ </div>
+
+ <div class="circle dashed"></div>
+
+ <div class="circle dashed">
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ </div>
+
+ <div class="circle bold"></div>
+
+ <div class="circle solid"></div>
+
+ <div class="circle dotted">
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ </div>
+
+ <div class="circle border">
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ </div>
+
+ <div class="circle">
+ <div class="half solid"></div>
+ <div class="half solid"></div>
+ </div>
+
+ <div class="circle dashed">
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ </div>
+ </div>
+
+ <div class="onion-pattern-row onion-pattern-offset-row">
+ <div class="circle dashed">
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ </div>
+
+ <div class="circle bold"></div>
+
+ <div class="circle solid"></div>
+
+ <div class="circle dotted">
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ </div>
+
+ <div class="circle border">
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ </div>
+
+ <div class="circle">
+ <div class="half solid"></div>
+ <div class="half solid"></div>
+ </div>
+
+ <div class="circle dashed">
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ <div class="inner dashed"></div>
+ </div>
+
+ <div class="circle solid"></div>
+
+ <div class="circle border"></div>
+
+ <div class="circle border">
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ <div class="inner border"></div>
+ </div>
+
+ <div class="circle">
+ <div class="half solid"></div>
+ <div class="half dotted"></div>
+ </div>
+
+ <div class="circle dotted"></div>
+
+ <div class="circle dotted">
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ <div class="inner dotted"></div>
+ </div>
+
+ <div class="circle dashed"></div>
</div>
</div>
</body>
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index d0195b46..8e62a5ab 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -338,10 +338,9 @@ function torbutton_init() {
}
}
- // Add about:tor IPC message listeners.
- let aboutTorMessages = [ "AboutTor:Loaded", "AboutTor:GetToolbarData" ];
- aboutTorMessages.forEach(aMsg => window.messageManager.addMessageListener(
- aMsg, torbutton_abouttor_message_handler));
+ // Add about:tor IPC message listener.
+ window.messageManager.addMessageListener("AboutTor:Loaded",
+ torbutton_abouttor_message_handler);
// XXX: Get rid of the cached asmjs (or IndexedDB) files on disk in case we
// don't allow things saved to disk. This is an ad-hoc fix to work around
@@ -369,11 +368,6 @@ function torbutton_init() {
torbutton_log(1, "registering Tor check observer");
torbutton_tor_check_observer.register();
- // Detect toolbar customization and update arrow on about:tor pages.
- window.addEventListener("aftercustomization", function() {
- torbutton_abouttor_message_handler.updateAllOpenPages();
- }, false);
-
//setting up context menu
//var contextMenu = document.getElementById("contentAreaContextMenu");
//if (contextMenu)
@@ -425,10 +419,6 @@ var torbutton_abouttor_message_handler = {
aMessage.target.messageManager.sendAsyncMessage("AboutTor:ChromeData",
this.chromeData);
break;
- case "AboutTor:GetToolbarData":
- aMessage.target.messageManager.sendAsyncMessage("AboutTor:ToolbarData",
- this.toolbarData);
- break;
}
},
@@ -441,23 +431,12 @@ var torbutton_abouttor_message_handler = {
// The chrome data contains all of the data needed by the about:tor
// content process that is only available here (in the chrome process).
// It is sent to the content process when an about:tor window is opened
- // and in response to events such as the browser noticing that an update
- // is available.
+ // and in response to events such as the browser noticing that Tor is
+ // not working.
get chromeData() {
return {
torOn: torbutton_tor_check_ok(),
- updateNeeded: torbutton_update_is_needed(),
- showManual: torbutton_show_torbrowser_manual(),
- toolbarButtonXPos: torbutton_get_toolbarbutton_xpos()
- };
- },
-
- // The toolbar data only contains the x coordinate of Torbutton's toolbar
- // item; it is sent back to the content process as the about:tor window
- // is resized.
- get toolbarData() {
- return {
- toolbarButtonXPos: torbutton_get_toolbarbutton_xpos()
+ showManual: torbutton_show_torbrowser_manual()
};
}
};
@@ -593,9 +572,6 @@ function torbutton_notify_if_update_needed() {
var btn = torbutton_get_toolbutton();
setOrClearAttribute(btn, "tbUpdateNeeded", updateNeeded);
- // Update all open about:tor pages.
- torbutton_abouttor_message_handler.updateAllOpenPages();
-
// Make the "check for update" menu item bold if an update is needed.
var item = document.getElementById("torbutton-checkForUpdate");
setOrClearAttribute(item, "tbUpdateNeeded", updateNeeded);
@@ -621,33 +597,6 @@ function torbutton_check_for_update() {
prompter.checkForUpdates();
}
-// Determine X position of Torbutton toolbar item. The value returned
-// accounts for retina but not content zoom.
-// undefined is returned if the value cannot be determined (e.g., if the
-// toolbar item is not on the toolbar).
-function torbutton_get_toolbarbutton_xpos() {
- try {
- let tbXpos = -1;
- let tbItem = torbutton_get_toolbutton();
- if (tbItem) {
- let tbItemRect = tbItem.getBoundingClientRect();
- let contentElem = document.getElementById("tabbrowser-initialBrowser");
- let contentRect = contentElem.getBoundingClientRect();
- if (tbItemRect.top < contentRect.top) {
- tbXpos = tbItemRect.left + (tbItemRect.width / 2.0) - contentRect.left;
- }
- }
-
- if (tbXpos >= 0) {
- // Convert to device-independent units, compensating for retina display.
- tbXpos *= window.devicePixelRatio;
- return tbXpos;
- }
- } catch(e) {}
-
- return undefined;
-}
-
function torbutton_show_sec_slider_notification() {
// Show the notification about the new security slider.
if (m_tb_prefs.
diff --git a/src/chrome/locale/en/aboutTor.dtd b/src/chrome/locale/en/aboutTor.dtd
index 676878e2..3eecc0bc 100644
--- a/src/chrome/locale/en/aboutTor.dtd
+++ b/src/chrome/locale/en/aboutTor.dtd
@@ -1,45 +1,25 @@
<!--
- - Copyright (c) 2015, The Tor Project, Inc.
+ - Copyright (c) 2018, The Tor Project, Inc.
- See LICENSE for licensing information.
- vim: set sw=2 sts=2 ts=8 et syntax=xml:
-->
<!ENTITY aboutTor.title "About Tor">
-<!ENTITY aboutTor.outOfDateTorOn.label "WARNING: this browser is out of date.">
-<!ENTITY aboutTor.outOfDateTorOff.label "ALSO, this browser is out of date.">
-<!ENTITY aboutTor.outOfDate2.label "Click on the onion and then choose Check for Tor Browser Update.">
-
-<!ENTITY aboutTor.check.label "Test Tor Network Settings">
-
-<!ENTITY aboutTor.success.label "Welcome to Tor Browser">
-<!ENTITY aboutTor.success2.label "Connected to the Tor network.">
-<!ENTITY aboutTor.success3.label "You are now free to browse the Internet anonymously.">
+<!ENTITY aboutTor.ready.label "Explore. Privately.">
+<!ENTITY aboutTor.ready2.label "You’re ready for the world’s most private browsing experience.">
<!ENTITY aboutTor.failure.label "Something Went Wrong!">
<!ENTITY aboutTor.failure2.label "Tor is not working in this browser.">
-<!ENTITY aboutTor.search.label "Search">
+<!ENTITY aboutTor.search.label "Search with DuckDuckGo">
<!ENTITY aboutTor.searchDDGPost.link "https://duckduckgo.com">
-<!ENTITY aboutTor.torInfo1.label "Additional Info:">
-<!ENTITY aboutTor.torInfo2.label "Country & IP Address:">
-<!ENTITY aboutTor.torInfo3.label "Exit Node:">
-<!ENTITY aboutTor.torInfo4.label "This server does not log any information about visitors.">
-<!ENTITY aboutTor.whatnextQuestion.label "What Next?">
-<!ENTITY aboutTor.whatnextAnswer.label "Tor is NOT all you need to browse anonymously! You may need to change some of your browsing habits to ensure your identity stays safe.">
-<!ENTITY aboutTor.whatnext.label "Tips On Staying Anonymous »">
-<!ENTITY aboutTor.whatnext.link "https://www.torproject.org/download/download.html.en#warning">
+<!ENTITY aboutTor.torbrowser_user_manual_questions.label "Questions?">
+<!ENTITY aboutTor.torbrowser_user_manual_link.label "Check our Tor Browser Manual »">
+<!-- The next two entities are used within the browser's Help menu. -->
<!ENTITY aboutTor.torbrowser_user_manual.accesskey "M">
-<!ENTITY aboutTor.torbrowser_user_manual.label "Tor Browser User Manual">
-<!ENTITY aboutTor.helpInfo1.label "You Can Help!">
-<!ENTITY aboutTor.helpInfo2.label "There are many ways you can help make the Tor Network faster and stronger:">
-<!ENTITY aboutTor.helpInfo3.label "Run a Tor Relay Node »">
-<!ENTITY aboutTor.helpInfo3.link "https://www.torproject.org/docs/tor-doc-relay.html.en">
-<!ENTITY aboutTor.helpInfo4.label "Volunteer Your Services »">
-<!ENTITY aboutTor.helpInfo4.link "https://www.torproject.org/getinvolved/volunteer.html.en">
-<!ENTITY aboutTor.helpInfo5.label "Make a Donation »">
-<!ENTITY aboutTor.helpInfo5.link "https://www.torproject.org/donate/donate.html.en">
+<!ENTITY aboutTor.torbrowser_user_manual.label "Tor Browser Manual">
-<!ENTITY aboutTor.footer.label "The Tor Project is a US 501(c)(3) non-profit dedicated to the research, development, and education of online anonymity and privacy.">
-<!ENTITY aboutTor.learnMore.label "Learn more about The Tor Project »">
-<!ENTITY aboutTor.learnMore.link "https://www.torproject.org/about/overview.html.en">
+<!ENTITY aboutTor.tor_mission.label "The Tor Project is a US 501(c)(3) non-profit organization advancing human rights and freedoms by creating and deploying free and open source anonymity and privacy technologies, supporting their unrestricted availability and use, and furthering their scientific and popular understanding.">
+<!ENTITY aboutTor.getInvolved.label "Get Involved »">
+<!ENTITY aboutTor.getInvolved.link "https://www.torproject.org/getinvolved/volunteer.html.en">
diff --git a/src/chrome/locale/en/aboutTor.properties b/src/chrome/locale/en/aboutTor.properties
index d0d3a64b..375c0da1 100644
--- a/src/chrome/locale/en/aboutTor.properties
+++ b/src/chrome/locale/en/aboutTor.properties
@@ -1,13 +1,7 @@
-# Copyright (c) 2014, The Tor Project, Inc.
+# Copyright (c) 2018, The Tor Project, Inc.
# See LICENSE for licensing information.
# vim: set sw=2 sts=2 ts=8 et:
-aboutTor.searchDDG.privacy=Search <a href="%1$S">securely</a> with <a href="%2$S">DuckDuckGo</a>.
-# The following string is a link which replaces %1$S above.
-aboutTor.searchDDG.privacy.link=https://duckduckgo.com/privacy.html
-# The following string is a link which replaces %2$S above.
-aboutTor.searchDDG.search.link=https://duckduckgo.com/
-
aboutTor.donationBanner.donate=Donate Now!
aboutTor.donationBanner.slogan=Tor: Powering Digital Resistance
diff --git a/src/chrome/skin/aboutTor.css b/src/chrome/skin/aboutTor.css
index 62c9256c..02a81744 100644
--- a/src/chrome/skin/aboutTor.css
+++ b/src/chrome/skin/aboutTor.css
@@ -5,6 +5,12 @@
* vim: set sw=2 sts=2 ts=8 et syntax=css:
*/
+:root {
+ --abouttor-text-color: white;
+ --abouttor-bg-toron-color: #420C5D;
+ --abouttor-bg-toroff-color: #A4000F;
+}
+
* {
padding: 0px;
margin: 0px;
@@ -15,21 +21,15 @@ body {
height: 100%;
margin: 0px auto;
padding: 0px 0px;
- font-size: 62.5%;
- font-family: "Liberation Sans", Arial, Helvetica, sans-serif;
- font-weight: normal;
- color: #4d4d4d;
- background-color: #FFFFFF;
+ font-family: Helvetica, Arial, sans-serif;
+ color: var(--abouttor-text-color);
+ background-color: var(--abouttor-bg-toroff-color);
background-attachment: fixed;
background-size: 100% 100%;
}
-body {
- background-image: linear-gradient(to bottom, #ffffff, #ffffff 10%, #dddddd 50%, #dddddd);
-}
-
body[toron] {
- background-image: linear-gradient(to bottom, #ffffff, #ffffff 10%, #d5ffd5 50%, #d5ffd5);
+ background-color: var(--abouttor-bg-toron-color);
}
/* Hide the entire document by default to avoid showing the incorrect
@@ -42,88 +42,44 @@ body:not([initialized]) {
}
.torcontent-container {
- margin: 40px 20px;
+ margin: 40px 20px 28px 20px;
display: flex;
flex-direction: column;
}
+@media only screen and (min-width: 900px) {
+ .torcontent-container {
+ margin: 40px auto 28px auto;
+ max-width: 1000px;
+ min-width: 1000px;
+ }
+}
+
#torstatus-version {
position: absolute;
top: 6px;
right: 6px;
height: 30px;
width: 200px;
- font-size: 1.4em;
+ font-size: 15px;
white-space: pre-wrap;
text-align: right;
}
-body[toron] #torstatus-image {
- background-image: url('chrome://torbutton/skin/tor-on.png');
-}
-
-#torstatus-image {
- display: none;
- position: absolute;
- left: 85px;
- height: 128px;
- width: 128px;
- background-image: url('chrome://torbutton/skin/tor-off.png');
- background-repeat: no-repeat;
- background-position: center;
- z-index: -1;
-}
-
-.arrow {
- display: none;
- position: absolute;
- z-index: -1;
-}
-
-#toolbarIconArrowHead {
- top: 4px;
- width: 30px;
- height: 36px;
- background-image: url('chrome://torbutton/skin/onionArrow-short.png');
-}
-
-#toolbarIconArrowVertExtension, #toolbarIconArrowHorzExtension {
- width: 11px;
- height: 11px;
- background-image: url('chrome://torbutton/skin/onionArrow-extension.png');
-}
-
-#toolbarIconArrowBend {
- width: 22px;
- height: 22px;
- background-image: url('chrome://torbutton/skin/onionArrow-leftBend.png');
-}
-
-#toolbarIconArrowBend[pos="right"] {
- background-image: url('chrome://torbutton/skin/onionArrow-rightBend.png');
-}
-
a {
- color: #008000;
- text-decoration: none;
-}
-
-a:hover {
- color: #00A000;
- text-decoration: underline;
-}
-
-#testTorSettings {
- font-size: 1.6em;
- text-decoration: underline;
- margin-bottom: 5px;
+ color: var(--abouttor-text-color);
}
#torstatus {
- position: relative; /* needed for torstatus-image positioning */
+ margin-top: 135px;
display: flex;
justify-content: center;
- min-height: 148px;
+ vertical-align: bottom;
+ min-height: 92px;
+}
+
+#torstatus > div {
+ align-self: flex-end; /* align text to bottom of container */
}
.top {
@@ -134,206 +90,183 @@ a:hover {
text-align: center;
}
-body[toron][torNeedsUpdate] .hideIfTBBNeedsUpdate,
-body:not([torNeedsUpdate]) .hideIfTorIsUpToDate {
- display: none;
-}
-
body[toron] .hideIfTorOn,
body:not([toron]) .hideIfTorOff {
display: none;
}
-body[toron] .top h1 {
- color: #600060;
-}
-
body:not([showmanual]) .showForManual {
display: none;
}
-div.hideIfTorIsUpToDate {
- display: flex;
- flex-direction: column;
-}
-
-div.hideIfTorIsUpToDate,
-body .top div.hideIfTorIsUpToDate h1 {
- color: black;
- text-align: center;
-}
-
-/* Use inline-block for text-oriented elements whose widths need to measured. */
-.torstatus-container *,
-.top div.hideIfTorIsUpToDate h3 {
- display: inline-block;
+.torstatus-container * {
text-align: center;
}
-.top div.hideIfTorOff h1 {
+.top div.hideIfTorOff .heading1 {
margin-top: 20px;
}
-.top h1 {
- font-size: 4.00em;
- font-weight: bold;
+.top .heading1 {
+ font-size: 50px;
+ font-weight: 300;
margin-bottom: 5px;
}
-.top h2 {
- font-size: 2.934em;
+.top .heading2 {
+ font-size: 15px;
margin-bottom: 20px;
- font-weight: normal;
}
-.top h3 {
- font-size: 1.8em;
- font-weight: normal;
- color: #3B503C;
+#bottom {
+ margin-top: 170px;
}
-#middle {
- display: flex;
- flex-flow: row wrap;
- font-size: 1.6em;
- justify-content: space-evenly;
- margin-top: 40px;
+#bottom p {
+ font-size: 10px;
+ text-align: start;
+ margin: auto;
+ padding-bottom: 20px;
}
-.bubble {
- width: 242px;
- padding: 20px 30px;
- color: #3B503C;
- background-color: #FFFFFF;
- border: none;
- border-radius: 16px;
- margin-bottom: 40px;
- text-align: start;
- vertical-align: top;
+@media only screen and (min-width: 900px) {
+ #bottom p {
+ margin: 0px 135px 0px 135px;
+ }
}
-#middle h1 {
- font-size: 1.2em;
- margin-bottom: 10px;
+#bottom p:last-child {
+ padding-bottom: 0px;
}
-#middle ul {
- padding: 5px 0 0 22px;
+#bottom p.moreInfoLink {
+ font-size: 15px;
}
-#middle ul:dir(rtl) {
- padding: 5px 22px 0 0;
+.searchbox form {
+ width: 500px;
+ margin: 39px auto 0px auto;
+ text-align: left;
}
-#middle li {
- padding-top: 2px;
+@media only screen and (max-width: 540px) {
+ .searchbox form {
+ width: auto;
+ }
}
-#bottom {
- padding-bottom: 40px;
+.searchwrapper {
+ display: flex;
+ height: 46px;
+ border: 1px solid black;
+ border-radius: 8px;
+ background-color: white;
}
-#bottom p {
- font-size: 1.6em;
- text-align: start;
- margin: auto;
+.searchlabel {
+ height: auto;
+ width: 50px;
+ display: inline-block;
+ background: url('chrome://torbutton/skin/searchLogo.png') no-repeat center center;
+ background-size: 30px 30px;
}
-#bottom a {
- color: #800080;
- text-decoration: underline;
+#search-button {
+ height: auto;
+ width: 36px;
+ border: 0;
+ background: url('chrome://torbutton/skin/forwardArrow.png') no-repeat center center;
+ background-size: 16px 14px;
+ cursor: pointer;
}
-#bottom a:hover {
- color: #A000A0;
- text-decoration: none;
+#search-button:hover {
+ background-color: rgba(12, 12, 13, 0.1); /* same as Firefox's about:home */
}
-#bottom h4 {
- margin-top: 50px;
- line-height: 1em;
- font-size: 1em;
- font-weight: normal;
- text-align: center;
+/* #search-text is the search input field */
+#search-text {
+ flex: 1;
+ border: none;
+ padding: 4px 2px 5px 2px;
+ margin: 0;
+ font-size: 15px;
}
-#bottom p.lang {
- max-width: 620px;
- margin: 10px auto;
- font-size: 1em;
- font-weight: normal;
- text-align: center;
+.onion-pattern-container {
+ margin: 0px auto;
+ width: 100%;
+ max-width: 1624px; /* room for 14 of the widest circles */
+ overflow: hidden;
}
-.searchbox form {
- width: 396px;
- margin: 35px auto 1px auto;
- text-align: left;
+.onion-pattern-row {
+ width: 1624px;
+ display: flex;
+ flex-direction: row;
+ position: relative;
}
-.searchbox h4 {
- padding-top: 5px;
- font-size: 12px;
- font-weight: normal;
- text-align: center;
+.onion-pattern-offset-row {
+ left: -40px;
}
-#sbutton {
- display: block;
- float: right;
- width: 33px;
+/* With borders, circles range in size from 100 x 100px to 116 x 116px. */
+.circle {
+ opacity: 0.2;
+ position: relative;
+ width: 100px;
+ height: 100px;
+ border-radius: 50%;
}
-#sbutton input {
- height: 34px;
- width: 33px;
- border: 0;
- background: url('chrome://torbutton/skin/search.png') no-repeat top left;
- cursor: pointer;
+.inner {
+ position: absolute;
}
-/* #sxw is the container div for the search field and button */
-#sxw {
- border: none;
+.inner:nth-child(1){
+ transform: translate(calc(12.5% - 2px),calc(12.5% - 2px));
+ width: calc(100% * 0.75);
+ height: calc(100% * 0.75);
+ border-radius: 50%;
}
-/* #sx is the search input (text) field */
-#sx {
- border-color: lightgray;
- border-style: solid;
- border-width: 1px 0px 1px 1px;
- width: 350px;
- min-height: 23px;
- padding: 4px 6px 5px 6px;
- margin: 0;
- outline: none;
- color: #222;
- font-size: 18px;
+.inner:nth-child(2){
+ transform: translate(calc(40% - 2px),calc(40% - 2px));
+ width: calc(100% * 0.5);
+ height: calc(100% * 0.5);
+ border-radius: 50%;
}
-@media only screen and (min-width : 820px) {
-.torcontent-container {
- margin: auto;
- margin-top: 40px;
- max-width: 920px;
- min-width: 920px;
- }
+.inner:nth-child(3){
+ transform: translate(calc(108% - 2px),calc(108% - 2px));
+ width: calc(100% * 0.25);
+ height: calc(100% * 0.25);
+ border-radius: 50%;
+}
- #torstatus-image {
- display: block;
- }
+.solid {
+ background-color: #fff;
+}
- #bottom p {
- margin: 10px 125px 0px 125px;
- }
+.border {
+ border: 4px solid #fff;
}
-@media only screen and (max-width : 436px) {
- .searchbox form {
- width: auto;
- }
+.dashed {
+ border: 4px dashed #fff;
+}
- #sx {
- width: calc(100% - 46px);
- }
+.dotted {
+ border: 4px dotted #fff;
+}
+
+.bold {
+ border: 8px solid #fff;
+}
+
+.half {
+ width: 100px;
+ height: 50px;
+ border-radius: 50px 50px 0 0;
}
diff --git a/src/chrome/skin/forwardArrow.png b/src/chrome/skin/forwardArrow.png
new file mode 100644
index 00000000..ceea950f
Binary files /dev/null and b/src/chrome/skin/forwardArrow.png differ
diff --git a/src/chrome/skin/onionArrow-extension.png b/src/chrome/skin/onionArrow-extension.png
deleted file mode 100644
index 55ff2084..00000000
Binary files a/src/chrome/skin/onionArrow-extension.png and /dev/null differ
diff --git a/src/chrome/skin/onionArrow-leftBend.png b/src/chrome/skin/onionArrow-leftBend.png
deleted file mode 100644
index 9d1bb456..00000000
Binary files a/src/chrome/skin/onionArrow-leftBend.png and /dev/null differ
diff --git a/src/chrome/skin/onionArrow-rightBend.png b/src/chrome/skin/onionArrow-rightBend.png
deleted file mode 100644
index 6b60342d..00000000
Binary files a/src/chrome/skin/onionArrow-rightBend.png and /dev/null differ
diff --git a/src/chrome/skin/onionArrow-short.png b/src/chrome/skin/onionArrow-short.png
deleted file mode 100644
index 23e5a20e..00000000
Binary files a/src/chrome/skin/onionArrow-short.png and /dev/null differ
diff --git a/src/chrome/skin/search.png b/src/chrome/skin/search.png
deleted file mode 100644
index 698a77df..00000000
Binary files a/src/chrome/skin/search.png and /dev/null differ
diff --git a/src/chrome/skin/searchLogo.png b/src/chrome/skin/searchLogo.png
new file mode 100644
index 00000000..98ae319e
Binary files /dev/null and b/src/chrome/skin/searchLogo.png differ
diff --git a/src/chrome/skin/tor-off.png b/src/chrome/skin/tor-off.png
deleted file mode 100644
index a4509ba5..00000000
Binary files a/src/chrome/skin/tor-off.png and /dev/null differ
diff --git a/src/chrome/skin/tor-on.png b/src/chrome/skin/tor-on.png
deleted file mode 100644
index 186fcf15..00000000
Binary files a/src/chrome/skin/tor-on.png and /dev/null differ
diff --git a/src/defaults/preferences/preferences.js b/src/defaults/preferences/preferences.js
index ab9b4bf4..43401ad0 100644
--- a/src/defaults/preferences/preferences.js
+++ b/src/defaults/preferences/preferences.js
@@ -10,7 +10,6 @@ pref("extensions.torbutton.updateNeeded", false);
// Tor check and proxy prefs
pref("extensions.torbutton.test_enabled",true);
pref("extensions.torbutton.test_url","https://check.torproject.org/?TorButton=true");
-pref("extensions.torbutton.test_url_interactive", "https://check.torproject.org/?lang=__LANG__");
pref("extensions.torbutton.local_tor_check",true);
pref("extensions.torbutton.versioncheck_url","https://www.torproject.org/projects/torbrowser/RecommendedTBBVersions");
pref("extensions.torbutton.versioncheck_enabled",true);
1
0
commit cb5a49602ffb6fb04c2c32d0866cd0a331b5e9ab
Author: Damian Johnson <atagar(a)torproject.org>
Date: Tue Aug 14 12:57:36 2018 -0700
Fixup last commit
Damn me. Forgot to do amend the last commit with my last fixup before pushing.
---
test/unit/control/controller.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/unit/control/controller.py b/test/unit/control/controller.py
index c7fd0f96..156e62c5 100644
--- a/test/unit/control/controller.py
+++ b/test/unit/control/controller.py
@@ -693,7 +693,7 @@ class TestControl(unittest.TestCase):
self._emit_event(BAD_EVENT)
self.circ_listener.assert_not_called()
self.bw_listener.assert_not_called()
- self.malformed_listener.assert_called_once_with(casted_bad_event)
+ self.malformed_listener.assert_called_once_with(expected_bad_event)
self._emit_event(BW_EVENT)
self.bw_listener.assert_called_once_with(BW_EVENT)
1
0
14 Aug '18
commit e75cf259a8385b19c2b9b7df6aaf3f3e005e5478
Author: Damian Johnson <atagar(a)torproject.org>
Date: Tue Aug 14 12:54:55 2018 -0700
Python3 mock doesn't have assert_called_once
Oops. With python 2.x we use pypi's mock module but with python 3.x it's built
in (under unittest.mock). I thought Python bundled an exact copy of the
upstream module but seems it doesn't include the assert_called_once method...
======================================================================
ERROR: test_event_listing_with_malformed_event
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.5/unittest/mock.py", line 1157, in patched
return func(*args, **keywargs)
File "/home/atagar/Desktop/stem/test/unit/control/controller.py", line 688, in test_event_listing_with_malformed_event
self.malformed_listener.assert_called_once()
File "/usr/lib/python3.5/unittest/mock.py", line 583, in __getattr__
raise AttributeError(name)
AttributeError: assert_called_once
---
test/unit/control/controller.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/test/unit/control/controller.py b/test/unit/control/controller.py
index eba612fd..c7fd0f96 100644
--- a/test/unit/control/controller.py
+++ b/test/unit/control/controller.py
@@ -10,6 +10,7 @@ import unittest
import stem.descriptor.router_status_entry
import stem.response
+import stem.response.events
import stem.socket
import stem.util.system
import stem.version
@@ -681,11 +682,18 @@ class TestControl(unittest.TestCase):
is_alive_mock.return_value = True
self.controller._launch_threads()
+ # When stem.response.convert() encounters malformed content we still recast
+ # the message.
+
+ expected_bad_event = ControlMessage.from_str(BAD_EVENT.raw_content())
+ setattr(expected_bad_event, 'arrived_at', TEST_TIMESTAMP)
+ expected_bad_event.__class__ = stem.response.events.BandwidthEvent
+
try:
self._emit_event(BAD_EVENT)
self.circ_listener.assert_not_called()
self.bw_listener.assert_not_called()
- self.malformed_listener.assert_called_once()
+ self.malformed_listener.assert_called_once_with(casted_bad_event)
self._emit_event(BW_EVENT)
self.bw_listener.assert_called_once_with(BW_EVENT)
1
0
14 Aug '18
commit 6c94482adbd651d787ecc3c32d5d1d79395db7af
Author: Iain R. Learmonth <irl(a)fsfe.org>
Date: Tue Aug 14 14:21:06 2018 +0100
Remove pointless assignment in NodeStatus
Fixes: #27124
---
src/main/java/org/torproject/onionoo/docs/NodeStatus.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/main/java/org/torproject/onionoo/docs/NodeStatus.java b/src/main/java/org/torproject/onionoo/docs/NodeStatus.java
index 63720d9..50c66f9 100644
--- a/src/main/java/org/torproject/onionoo/docs/NodeStatus.java
+++ b/src/main/java/org/torproject/onionoo/docs/NodeStatus.java
@@ -565,8 +565,7 @@ public class NodeStatus extends Document {
if (!parts[14].equals("null")) {
nodeStatus.setPortList(parts[14]);
}
- long firstSeenMillis = lastSeenMillis;
- firstSeenMillis = DateTimeHelper.parse(parts[15] + " " + parts[16]);
+ long firstSeenMillis = DateTimeHelper.parse(parts[15] + " " + parts[16]);
if (firstSeenMillis < 0L) {
log.error("Parse exception while parsing node status "
+ "line '" + documentString + "'. Skipping.");
1
0
14 Aug '18
commit b60cf28654a880bd0bc68288d0af36d4a460e857
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Fri Aug 10 09:35:50 2018 +0200
Integrate ExoneraTor as its own web page.
Implements #23549.
---
build.xml | 5 ++
.../metrics/web/ExoneraTorWrapperServlet.java | 35 ++++++++++++++
src/main/resources/web.xml | 11 +++++
src/main/resources/web/jsps/exonerator.jsp | 23 +++++++++
src/main/resources/web/jsps/services.jsp | 2 +-
.../resources/web/properties/ExoneraTor.properties | 54 ++++++++++++++++++++++
.../web/properties/ExoneraTor_de.properties | 52 +++++++++++++++++++++
.../web/properties/ExoneraTor_fr.properties | 52 +++++++++++++++++++++
.../web/properties/ExoneraTor_ro.properties | 52 +++++++++++++++++++++
.../web/properties/ExoneraTor_sv.properties | 52 +++++++++++++++++++++
10 files changed, 337 insertions(+), 1 deletion(-)
diff --git a/build.xml b/build.xml
index 2f06209..423bfe3 100644
--- a/build.xml
+++ b/build.xml
@@ -10,6 +10,7 @@
<property name="implementation-title" value="metrics-web" />
<property name="release.version" value="1.1.0-dev" />
<property name="metricslibversion" value="2.4.0" />
+ <property name="exoneratorversion" value="3.0.0" />
<property name="jetty.version" value="-9.2.21.v20170120" />
<property name="warfile"
value="metrics-web-${release.version}.war"/>
@@ -64,6 +65,7 @@
</patternset>
<patternset id="web" >
+ <include name="exonerator-${exoneratorversion}-thin.jar" />
<include name="jetty9-annotations${jetty.version}.jar"/>
<include name="jetty9-server${jetty.version}.jar"/>
<include name="jetty9-servlet${jetty.version}.jar"/>
@@ -194,6 +196,9 @@
prefix="WEB-INF/json"
includes="metrics.json categories.json news.json"/>
+ <zipfileset dir="${resources}/web/properties"
+ includes="*.properties"/>
+
<zipfileset dir="${basedir}/src/submods/metrics-lib/generated/javadoc"
prefix="metrics-lib" />
<zipfileset dir="${libs}" prefix="WEB-INF/lib" >
diff --git a/src/main/java/org/torproject/metrics/web/ExoneraTorWrapperServlet.java b/src/main/java/org/torproject/metrics/web/ExoneraTorWrapperServlet.java
new file mode 100644
index 0000000..fc817e2
--- /dev/null
+++ b/src/main/java/org/torproject/metrics/web/ExoneraTorWrapperServlet.java
@@ -0,0 +1,35 @@
+/* Copyright 2018 The Tor Project
+ * See LICENSE for licensing information */
+
+package org.torproject.metrics.web;
+
+import org.torproject.metrics.exonerator.ExoneraTorServlet;
+
+import java.io.IOException;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class ExoneraTorWrapperServlet extends AnyServlet {
+
+ private ExoneraTorServlet exoneraTorServlet;
+
+ public ExoneraTorWrapperServlet() {
+ this.exoneraTorServlet = new ExoneraTorServlet();
+ }
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ this.exoneraTorServlet.init(config);
+ }
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException {
+ request.setAttribute("categories", this.categories);
+ this.exoneraTorServlet.doGet(request, response);
+ }
+}
diff --git a/src/main/resources/web.xml b/src/main/resources/web.xml
index 154a64e..ae252da 100644
--- a/src/main/resources/web.xml
+++ b/src/main/resources/web.xml
@@ -384,6 +384,17 @@
<url-pattern>/rs.html</url-pattern>
</servlet-mapping>
+ <servlet>
+ <servlet-name>ExoneraTor</servlet-name>
+ <servlet-class>
+ org.torproject.metrics.web.ExoneraTorWrapperServlet
+ </servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>ExoneraTor</servlet-name>
+ <url-pattern>/exonerator.html</url-pattern>
+ </servlet-mapping>
+
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
diff --git a/src/main/resources/web/jsps/exonerator.jsp b/src/main/resources/web/jsps/exonerator.jsp
new file mode 100644
index 0000000..f8b9341
--- /dev/null
+++ b/src/main/resources/web/jsps/exonerator.jsp
@@ -0,0 +1,23 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+<jsp:include page="top.jsp">
+ <jsp:param name="pageTitle" value="ExoneraTor – Tor Metrics"/>
+ <jsp:param name="navActive" value="Services"/>
+</jsp:include>
+
+<div class="container">
+ <ul class="breadcrumb">
+ <li><a href="/">Home</a></li>
+ <li><a href="/services.html">Services</a></li>
+ <li class="active">ExoneraTor</li>
+ </ul>
+</div>
+
+<div class="container">
+ <h1>ExoneraTor</h1>
+</div>
+
+${body}
+
+<jsp:include page="bottom.jsp"/>
+
diff --git a/src/main/resources/web/jsps/services.jsp b/src/main/resources/web/jsps/services.jsp
index 2283dbe..ead3b03 100644
--- a/src/main/resources/web/jsps/services.jsp
+++ b/src/main/resources/web/jsps/services.jsp
@@ -21,7 +21,7 @@
<h2>Network archive <a href="#archive" name="archive" class="anchor">#</a></h2>
<p>The following tool lets you browse the network archive for relays running in the past.</p>
<ul>
- <li><a href="https://exonerator.torproject.org/" target="_blank">ExoneraTor</a> tells you if an IP was used by a Tor relay on a given date.</li>
+ <li><a href="/exonerator.html">ExoneraTor</a> tells you if an IP was used by a Tor relay on a given date.</li>
</ul>
</div>
diff --git a/src/main/resources/web/properties/ExoneraTor.properties b/src/main/resources/web/properties/ExoneraTor.properties
new file mode 100644
index 0000000..936754a
--- /dev/null
+++ b/src/main/resources/web/properties/ExoneraTor.properties
@@ -0,0 +1,54 @@
+form.explanation=Enter an IP address and date to find out whether that address was used as a Tor relay:
+form.ip.label=IP address
+form.timestamp.label=Date
+form.search.label=Search
+summary.heading=Summary
+summary.serverproblem.dbnoconnect.title=Server problem
+summary.serverproblem.dbnoconnect.body.text=Unable to connect to the database. Please try again later. If this problem persists, please %s!
+summary.serverproblem.dbnoconnect.body.link=let us know
+summary.serverproblem.dbempty.title=Server problem
+summary.serverproblem.dbempty.body.text=The database appears to be empty. Please try again later. If this problem persists, please %s!
+summary.serverproblem.dbempty.body.link=let us know
+summary.invalidparams.notimestamp.title=No date parameter given
+summary.invalidparams.notimestamp.body=Sorry, you also need to provide a date parameter.
+summary.invalidparams.noip.title=No IP address parameter given
+summary.invalidparams.noip.body=Sorry, you also need to provide an IP address parameter.
+summary.invalidparams.timestamprange.title=Date parameter out of range
+summary.invalidparams.timestamprange.body=Sorry, the database does not contain any data from %s. Please pick a date between %s and %s.
+summary.invalidparams.invalidip.title=Invalid IP address parameter
+summary.invalidparams.invalidip.body=Sorry, %s is not a valid IP address. The expected IP address formats are %s or %s.
+summary.invalidparams.invalidtimestamp.title=Invalid date parameter
+summary.invalidparams.invalidtimestamp.body=Sorry, %s is not a valid date. The expected date format is %s.
+summary.invalidparams.timestamptoorecent.title=Date parameter too recent
+summary.invalidparams.timestamptoorecent.body=The database may not yet contain enough data to correctly answer this request. The latest accepted data is the day before yesterday. Please repeat your search on another day.
+summary.serverproblem.nodata.title=Server problem
+summary.serverproblem.nodata.body.text=The database does not contain any data for the requested date. Please try again later. If this problem persists, please %s!
+summary.serverproblem.nodata.body.link=let us know
+summary.negativesamenetwork.title=Result is negative
+summary.negativesamenetwork.body=We did not find IP address %s on or within a day of %s. But we did find other IP addresses of Tor relays in the same /%d network around the time:
+summary.positive.title=Result is positive
+summary.positive.body=We found one or more Tor relays on IP address %s on or within a day of %s that Tor clients were likely to know.
+summary.negative.title=Result is negative
+summary.negative.body=We did not find IP address %s on or within a day of %s.
+technicaldetails.heading=Technical details
+technicaldetails.pre=Looking up IP address %s on or within one day of %s. Tor clients could have selected this or these Tor relays to build circuits.
+technicaldetails.colheader.timestamp=Timestamp (UTC)
+technicaldetails.colheader.ip=IP address(es)
+technicaldetails.colheader.fingerprint=Identity fingerprint
+technicaldetails.colheader.nickname=Nickname
+technicaldetails.colheader.exit=Exit relay
+technicaldetails.nickname.unknown=Unknown
+technicaldetails.exit.unknown=Unknown
+technicaldetails.exit.yes=Yes
+technicaldetails.exit.no=No
+permanentlink.heading=Permanent link
+footer.abouttor.heading=About Tor
+footer.abouttor.body.text=Tor is an international software project to anonymize Internet traffic by %s. Therefore, if you see traffic from a Tor relay, this traffic usually originates from someone using Tor, rather than from the relay operator. The Tor Project and Tor relay operators have no records of the traffic that passes over the network and therefore cannot provide any information about its origin. Be sure to %s, and don't hesitate to %s for more information.
+footer.abouttor.body.link1=encrypting packets and sending them through a series of hops before they reach their destination
+footer.abouttor.body.link2=learn more about Tor
+footer.abouttor.body.link3=contact The Tor Project, Inc.
+footer.aboutexonerator.heading=About ExoneraTor
+footer.aboutexonerator.body=The ExoneraTor service maintains a database of IP addresses that have been part of the Tor network. It answers the question whether there was a Tor relay running on a given IP address on a given date. ExoneraTor may store more than one IP address per relay if relays use a different IP address for exiting to the Internet than for registering in the Tor network, and it stores whether a relay permitted transit of Tor traffic to the open Internet at that time.
+footer.language.name=English
+footer.language.text=This page is also available in the following languages:
+
diff --git a/src/main/resources/web/properties/ExoneraTor_de.properties b/src/main/resources/web/properties/ExoneraTor_de.properties
new file mode 100644
index 0000000..d830e31
--- /dev/null
+++ b/src/main/resources/web/properties/ExoneraTor_de.properties
@@ -0,0 +1,52 @@
+form.explanation=Geben Sie eine IP-Adresse und ein Datum ein um herauszufinden, ob diese IP-Adresse von einem Tor-Server verwendet wurde:
+form.ip.label=IP-Adresse
+form.timestamp.label=Datum
+form.search.label=Suchen
+summary.heading=Zusammenfassung
+summary.serverproblem.dbnoconnect.title=Server-Problem
+summary.serverproblem.dbnoconnect.body.text=Es kann keine Verbindung zur Datenbank hergestellt werden. Bitte versuchen Sie es sp\u00e4ter noch einmal. Sollte dieses Problem weiterhin bestehen %s.
+summary.serverproblem.dbnoconnect.body.link=lassen Sie es uns bitte wissen
+summary.serverproblem.dbempty.title=Server-Problem
+summary.serverproblem.dbempty.body.text=Die Datenbank scheint leer zu sein. Bitte versuchen Sie es sp\u00e4ter noch einmal. Sollte dieses Problem weiterhin bestehen %s.
+summary.serverproblem.dbempty.body.link=lassen Sie es uns bitte wissen
+summary.invalidparams.notimestamp.title=Kein Datum angegeben
+summary.invalidparams.notimestamp.body=Sie m\u00fcssen ein Datum angeben.
+summary.invalidparams.noip.title=Keine IP-Adresse angegeben.
+summary.invalidparams.noip.body=Sie m\u00fcssen eine IP-Adresse angeben.
+summary.invalidparams.timestamprange.title=Datum au\u00dferhalb des zul\u00e4ssigen Bereichs
+summary.invalidparams.timestamprange.body=Die Datenbank enth\u00e4lt keine Daten vom %s. Bitte w\u00e4hlen Sie ein Datum zwischen %s und %s aus.
+summary.invalidparams.invalidip.title=Ung\u00fcltige IP-Adresse
+summary.invalidparams.invalidip.body=%s ist keine g\u00fcltige IP-Adresse. Zul\u00e4ssige IP-Adress-Formate sind %s oder %s.
+summary.invalidparams.invalidtimestamp.title=Ung\u00fcltiges Datum
+summary.invalidparams.invalidtimestamp.body=%s ist kein g\u00fcltiges Datum. Das zul\u00e4ssige Datumsformat ist %s.
+summary.serverproblem.nodata.title=Server-Problem
+summary.serverproblem.nodata.body.text=Die Datenbank enth\u00e4lt keine Daten f\u00fcr das angegebene Datum. Bitte versuchen Sie es sp\u00e4ter noch einmal. Sollte dieses Problem weiterhin bestehen %s.
+summary.serverproblem.nodata.body.link=lassen Sie es uns bitte wissen
+summary.negativesamenetwork.title=Keine \u00dcbereinstimmungen gefunden
+summary.negativesamenetwork.body=Es wurde kein Tor-Server mit der IP-Adresse %s am %s bzw. am Tag vorher oder nachher gefunden. Es wurden jedoch benachbarte IP-Adressen im selben /%d-Netzwerk an diesen Tagen gefunden:
+summary.positive.title=\u00dcbereinstimmungen gefunden
+summary.positive.body=Es wurde ein oder mehrere Tor-Server mit IP-Adresse %s am %s bzw. am Tag vorher oder nachher gefunden, die den Tor-Clients bekannt waren.
+summary.negative.title=Keine \u00dcbereinstimmungen gefunden
+summary.negative.body=Es wurde kein Tor-Server mit der IP-Adresse %s am %s bzw. am Tag vorher oder nachher gefunden.
+technicaldetails.heading=Technische Details
+technicaldetails.pre=Es wird nach Tor-Servern mit IP-Adresse %s am %s bzw. am Tag vorher oder nachher gesucht. Tor-Clients konnten diese Tor-Server verwenden, um Verbindungen aufzubauen.
+technicaldetails.colheader.timestamp=Datum/Uhrzeit (UTC)
+technicaldetails.colheader.ip=IP-Adresse(n)
+technicaldetails.colheader.fingerprint=Identit\u00e4tsschl\u00fcssel
+technicaldetails.colheader.nickname=Spitzname
+technicaldetails.colheader.exit=Exit-Server
+technicaldetails.nickname.unknown=Unbekannt
+technicaldetails.exit.unknown=Unbekannt
+technicaldetails.exit.yes=Ja
+technicaldetails.exit.no=Nein
+permanentlink.heading=Dauerhafter Link
+footer.abouttor.heading=\u00dcber Tor
+footer.abouttor.body.text=Tor ist ein internationales Softwareprojekt, um Internetverbindungen zu anonymisieren indem %s. Wenn Sie eine Internetverbindung sehen, die von einem Tor-Server kommt, stammt diese in der Regel von jemandem, der Tor benutzt, und nicht vom Betreiber des Tor-Servers selbst. Weder The Tor Project, Inc. noch die Tor-Server-Betreiber besitzen Aufzeichnungen \u00fcber die Internetverbindungen im Tor-Netzwerk und k\u00f6nnen daher keine Auskunft \u00fcber den Ursprung der Internetverbindung geben. Mehr Informationen \u00fcber Tor erhalten Sie %s. The Tor Project, Inc. steht Ihnen jederzeit f\u00fcr %s zur Verf\u00fcgung.
+footer.abouttor.body.link1=Datenpakete verschl\u00fcsselt und \u00fcber eine Reihe von Stationen geleitet werden, bevor diese ihr Ziel erreichen
+footer.abouttor.body.link2=hier
+footer.abouttor.body.link3=Fragen
+footer.aboutexonerator.heading=\u00dcber ExoneraTor
+footer.aboutexonerator.body=Der ExoneraTor-Dienst basiert auf einer Datenbank von IP-Adressen, die Teil des Tor-Netzwerks sind oder waren. Dieser Dienst beantwortet die Frage, ob es an einem bestimmten Tag einen Tor-Server mit einer bestimmten IP-Adresse gegeben hat. ExoneraTor kann in einigen F\u00e4llen mehr als nur eine IP-Adresse pro Tor-Server ausgeben, falls ein Tor-Server verschiedene IP-Adressen f\u00fcr ausgehende Verbindungen und die Registrierung im Tor-Netzwerk verwendet hat. ExoneraTor speichert au\u00dferdem, ob ein Tor-Server Verbindungen ins offene Internet zugelassen hat oder nicht.
+footer.language.name=Deutsch
+footer.language.text=Diese Seite gibt es auch in den folgenden Sprachen:
+
diff --git a/src/main/resources/web/properties/ExoneraTor_fr.properties b/src/main/resources/web/properties/ExoneraTor_fr.properties
new file mode 100644
index 0000000..70d4d2f
--- /dev/null
+++ b/src/main/resources/web/properties/ExoneraTor_fr.properties
@@ -0,0 +1,52 @@
+form.explanation=Saisir une adresse IP et une date afin de savoir si l'adresse a \u00e9t\u00e9 utilis\u00e9e comme relais Tor \:
+form.ip.label=Adresse IP
+form.timestamp.label=Date
+form.search.label=Rechercher
+summary.heading=R\u00e9sum\u00e9
+summary.serverproblem.dbnoconnect.title=Probl\u00e8me de serveur
+summary.serverproblem.dbnoconnect.body.text=Impossible de se connecter \u00e0 la base de donn\u00e9es. Veuillez ressayer ult\u00e9rieurement. Si ce probl\u00e8me perdure, veuillez %s \!
+summary.serverproblem.dbnoconnect.body.link=nous en informer
+summary.serverproblem.dbempty.title=Probl\u00e8me de serveur
+summary.serverproblem.dbempty.body.text=La base de donn\u00e9es semble \u00eatre vide. Veuillez ressayer ult\u00e9rieurement. Si ce probl\u00e8me perdure, veuillez %s \!
+summary.serverproblem.dbempty.body.link=nous en informer
+summary.invalidparams.notimestamp.title=Aucune date n'a \u00e9t\u00e9 donn\u00e9e en param\u00e8tre
+summary.invalidparams.notimestamp.body=D\u00e9sol\u00e9, vous devez aussi pr\u00e9ciser une date.
+summary.invalidparams.noip.title=Aucune adresse IP n'a \u00e9t\u00e9 donn\u00e9e en param\u00e8tre
+summary.invalidparams.noip.body=D\u00e9sol\u00e9, vous devez aussi fournir une adresse IP.
+summary.invalidparams.timestamprange.title=Date hors p\u00e9riode couverte
+summary.invalidparams.timestamprange.body=D\u00e9sol\u00e9, la base de donn\u00e9es ne contient aucune donn\u00e9e de %s. Veuillez choisir une date entre %s et %s.
+summary.invalidparams.invalidip.title=Adresse IP invalide
+summary.invalidparams.invalidip.body=D\u00e9sol\u00e9, %s n'est pas une adresse IP valide. Les formats d'adresse IP attendus sont %s ou %s.
+summary.invalidparams.invalidtimestamp.title=Date invalide
+summary.invalidparams.invalidtimestamp.body=D\u00e9sol\u00e9, %s n'est pas une date valide. Le format de date attendu est %s.
+summary.serverproblem.nodata.title=Probl\u00e8me de serveur
+summary.serverproblem.nodata.body.text=La base de donn\u00e9es ne contient aucune donn\u00e9e pour la date demand\u00e9e. Veuillez ressayer ult\u00e9rieurement. Si le probl\u00e8me perdure, veuillez %s \!
+summary.serverproblem.nodata.body.link=nous en informer
+summary.negativesamenetwork.title=R\u00e9sultat n\u00e9gatif
+summary.negativesamenetwork.body=Nous n'avons pas trouv\u00e9 l'adresse IP %s, le %s ou \u00e0 un jour pr\u00e8s. Mais nous avons trouv\u00e9 d'autres adresses IP de relais Tor dans le m\u00eame r\u00e9seau /%d aux alentours de cette date \:
+summary.positive.title=R\u00e9sultat positif
+summary.positive.body=Nous avons trouv\u00e9 un ou plusieurs relais Tor \u00e0 l'adresse IP %s probablement connus des clients Tor le %s ou \u00e0 un jour pr\u00e8s.
+summary.negative.title=R\u00e9sultat n\u00e9gatif
+summary.negative.body=Nous n'avons pas trouv\u00e9 l'adresse IP %s, le %s ou \u00e0 un jour pr\u00e8s.
+technicaldetails.heading=D\u00e9tails techniques
+technicaldetails.pre=Recherche de l'adresse IP %s, le %s ou \u00e0 un jour pr\u00e8s. Des clients Tor pourraient avoir choisi ce ou ces relais Tor pour construire des circuits.
+technicaldetails.colheader.timestamp=Date et heure (UTC)
+technicaldetails.colheader.ip=Adresse(s) IP
+technicaldetails.colheader.fingerprint=Empreinte
+technicaldetails.colheader.nickname=Pseudonyme
+technicaldetails.colheader.exit=Relais de sortie
+technicaldetails.nickname.unknown=Inconnu
+technicaldetails.exit.unknown=Inconnu
+technicaldetails.exit.yes=Oui
+technicaldetails.exit.no=Non
+permanentlink.heading=Lien permanent
+footer.abouttor.heading=\u00c0 propos de Tor
+footer.abouttor.body.text=Tor est un projet international d\u00e9veloppant des logiciels pour anonymiser le trafic Internet en %s. Par cons\u00e9quent, si vous voyez du trafic en provenance d'un relais Tor, ce trafic provient habituellement de quelqu'un qui utilise Tor, plut\u00f4t que de l'op\u00e9rateur du relais. Le projet Tor et les op\u00e9rateurs de relais Tor n'ont aucune trace du trafic relay\u00e9 par le r\u00e9seau et ne peuvent donc fournir aucune information sur son origine. N'h\u00e9sitez pas \u00e0 vous %s et n'h\u00e9sitez pas \u00e0 %s pour obtenir d'avantage d'informations.
+footer.abouttor.body.link1=chiffrant les paquets et en les faisant transiter par une s\u00e9rie de relais avant qu'ils n'atteignent leur destination
+footer.abouttor.body.link2=renseigner d'avantage au sujet de Tor
+footer.abouttor.body.link3=contacter \u00ab\u00a0The Tor Project, Inc.\u00a0\u00bb
+footer.aboutexonerator.heading=\u00c0 propos d'ExoneraTor
+footer.aboutexonerator.body=Le service ExoneraTor g\u00e8re une base de donn\u00e9es d'adresses IP qui ont fait partie du r\u00e9seau Tor. Il permet de savoir si un relais Tor fonctionnait pour une adresse IP donn\u00e9e \u00e0 une date pr\u00e9cise. ExoneraTor peut enregistrer plus d'une adresse IP par relais si ces derniers utilisent une adresse IP diff\u00e9rente pour se connecter \u00e0 Internet de celle utilis\u00e9e pour s'enregistrer sur le r\u00e9seau Tor. ExoneraTor enregistre \u00e9galement les dates et heures auxquelles un relais a permis de faire transiter du trafic en provenance de Tor vers Internet.
+footer.language.name=fran\u00e7ais
+footer.language.text=Cette page est aussi disponible dans les langues suivantes :
+
diff --git a/src/main/resources/web/properties/ExoneraTor_ro.properties b/src/main/resources/web/properties/ExoneraTor_ro.properties
new file mode 100644
index 0000000..3663c06
--- /dev/null
+++ b/src/main/resources/web/properties/ExoneraTor_ro.properties
@@ -0,0 +1,52 @@
+form.explanation=Introduce\u021bi o adres\u0103 IP si o dat\u0103 pentru a afla dac\u0103 respectiva adresa a fost folosita de un nod Tor.
+form.ip.label=Adres\u0103 IP
+form.timestamp.label=Dat\u0103
+form.search.label=Caut\u0103
+summary.heading=Sumar
+summary.serverproblem.dbnoconnect.title=Problem\u0103 de server
+summary.serverproblem.dbnoconnect.body.text=Imposibil de conectat la baza de date. V\u0103 rug\u0103m s\u0103 re\u00eencerca\u021bi mai t\u00eerziu. Dac\u0103 problema persist\u0103, v\u0103 rug\u0103m %s\!
+summary.serverproblem.dbnoconnect.body.link=Informa\u021bi-ne
+summary.serverproblem.dbempty.title=Problem\u0103 de server
+summary.serverproblem.dbempty.body.text=Baza de date pare a fi goal\u0103. V\u0103 rug\u0103m s\u0103 re\u00eencerca\u021bi mai t\u00eerziu. Dac\u0103 problema persist\u0103, v\u0103 rug\u0103m %s\!
+summary.serverproblem.dbempty.body.link=Informa\u021bi-ne
+summary.invalidparams.notimestamp.title=Lips\u0103 parametru dat\u0103
+summary.invalidparams.notimestamp.body=Ne pare r\u0103u, dar trebuie s\u0103 introduce\u021bi un parametru dat\u0103.
+summary.invalidparams.noip.title=Lips\u0103 parametru adres\u0103 IP
+summary.invalidparams.noip.body=Ne pare r\u0103u, trebuie de asemenea s\u0103 introduce\u021bi adresa IP.
+summary.invalidparams.timestamprange.title=Parametrul de dat\u0103 este in afara intervalului
+summary.invalidparams.timestamprange.body=Ne pare r\u0103u, baza de date nu con\u021bine informa\u021bii de la %s. V\u0103 rug\u0103m s\u0103 alege\u021bi o dat\u0103 \u00eentre %s \u0219i %s.
+summary.invalidparams.invalidip.title=Parametrul adresei IP este incorect
+summary.invalidparams.invalidip.body=Ne pare r\u0103u, %s nu este o adres\u0103 IP valid\u0103. Formatele corecte ale unei adresei IP sunt %s sau %s.
+summary.invalidparams.invalidtimestamp.title=Parametru dat\u0103 incorect
+summary.invalidparams.invalidtimestamp.body=Ne pare r\u0103u, %s nu este o dat\u0103 valid\u0103. Formatul corect al datei este %s.
+summary.serverproblem.nodata.title=Problem\u0103 de server
+summary.serverproblem.nodata.body.text=Baza de date nu con\u021bine informatii pentru data solicitat\u0103. V\u0103 rug\u0103m \u00eencerca\u021bi mai t\u00e2rziu. Dac\u0103 problema persist\u0103, va rug\u0103m %s\!
+summary.serverproblem.nodata.body.link=Informa\u021bi-ne
+summary.negativesamenetwork.title=Rezultatul este negativ
+summary.negativesamenetwork.body=Nu am g\u0103sit adresa IP %s la data de %s sau la o zi distan\u021b\u0103. Dar am g\u0103sit alte adrese IP folosite de noduri Tor \u00een aceea\u0219i /%d re\u021bea \u00een jurul orei\:
+summary.positive.title=Rezultatul este pozitiv
+summary.positive.body=Am g\u0103sit unul sau mai multe noduri Tor care au folosit adresa IP %s la data de %s sau la o zi distan\u021b\u0103 care puteau fi cunoscute de clien\u021bii Tor.
+summary.negative.title=Rezultatul este negativ
+summary.negative.body=Nu am g\u0103sit adresa IP %s la data de %s sau la o zi distan\u021b\u0103.
+technicaldetails.heading=Detalii tehnice
+technicaldetails.pre=C\u0103utare adresa IP %s la data de %s sau la o zi distan\u021b\u0103. Clien\u021bii Tor ar fi putut alege acest sau aceste noduri Tor pentru a construi circuite.
+technicaldetails.colheader.timestamp=Dat\u0103(fus UTC)
+technicaldetails.colheader.ip=Adres\u0103/Adrese IP
+technicaldetails.colheader.fingerprint=Amprenta digital\u0103 de identificare a nodului
+technicaldetails.colheader.nickname=Pseudonim
+technicaldetails.colheader.exit=Nod de ie\u0219ire
+technicaldetails.nickname.unknown=Necunoscut
+technicaldetails.exit.unknown=Necunoscut
+technicaldetails.exit.yes=Da
+technicaldetails.exit.no=Nu
+permanentlink.heading=Link permanent
+footer.abouttor.heading=Despre Tor
+footer.abouttor.body.text=Tor este un proiect software interna\u021bional pentru anonimizarea traficului de internet prin %s. De aceea, dac\u0103 vede\u021bi trafic de la un nod Tor, acest trafic provine mai degrab\u0103 de la un client care folose\u0219te Tor, nu de la operatorul releului. The Tor Project, Inc. (organiza\u021bia) \u0219i operatorii nodurilor Tor nu de\u021bin informa\u021bii referitoare la traficul care trece prin re\u021bea \u0219i, implicit, prin nodurile operate de ace\u0219tia, de aceea nu pot furniza informa\u021bii despre originea acestuia. Asigura\u021bi-v\u0103 c\u0103 %s \u0219i nu ezita\u021bi s\u0103 %s pentru mai multe informa\u021bii.
+footer.abouttor.body.link1=criptarea pachetelor de date \u0219i transmiterea acestora printr-o serie de hop-uri \u00eenainte ca ele s\u0103 ajung\u0103 la destina\u021bie
+footer.abouttor.body.link2=Afla\u021bi mai multe despre Tor
+footer.abouttor.body.link3=contacta\u021bi The Tor Project, Inc.
+footer.aboutexonerator.heading=Despre ExoneraTor
+footer.aboutexonerator.body=Serviciul ExoneraTor opereaz\u0103 o baz\u0103 de date de adrese IP care au fost parte din re\u021belaua Tor la un anumit moment. Acest serviciu r\u0103spunde la \u00eentrebarea dac\u0103 a existat un nod Tor care a func\u021bionat pe o anumit\u0103 adres\u0103 IP la o anumit\u0103 dat\u0103. ExoneraTor poate stoca mai mult de o adresa IP per nod dac\u0103 nodurile folosesc o alt\u0103 adres\u0103 IP pentru a ie\u0219i pe internet dec\u00e2t cea folosit\u0103 pentru \u00eenregistrarea \u00een re\u021beaua Tor \u0219i stocheaz\u0103 dac\u0103 un nod a permis tranzitarea de trafic din re\u021beaua Tor catre internetul public la acea dat\u0103.
+footer.language.name=rom\u00e2n\u0103
+footer.language.text=Aceast\u0103 pagin\u0103 mai este disponibil\u0103 \u00een urm\u0103toarele limbi:
+
diff --git a/src/main/resources/web/properties/ExoneraTor_sv.properties b/src/main/resources/web/properties/ExoneraTor_sv.properties
new file mode 100644
index 0000000..277a5b8
--- /dev/null
+++ b/src/main/resources/web/properties/ExoneraTor_sv.properties
@@ -0,0 +1,52 @@
+form.explanation=Ange en IP-adress och ett datum f\u00f6r att f\u00e5 reda p\u00e5 om adressen anv\u00e4ndes av ett Tor-rel\u00e4\:
+form.ip.label=IP-adress
+form.timestamp.label=Datum
+form.search.label=S\u00f6k
+summary.heading=Sammanfattning
+summary.serverproblem.dbnoconnect.title=Serverproblem
+summary.serverproblem.dbnoconnect.body.text=Kunde inte ansluta till databasen. V\u00e4nligen f\u00f6rs\u00f6k igen senare. Om problemet kvarst\u00e5r, v\u00e4nligen %s\!
+summary.serverproblem.dbnoconnect.body.link=l\u00e5t oss f\u00e5 veta
+summary.serverproblem.dbempty.title=Serverproblem
+summary.serverproblem.dbempty.body.text=Databasen verkar vara tom. V\u00e4nligen f\u00f6rs\u00f6k igen senare. Om problemet kvarst\u00e5r, v\u00e4nligen %s\!
+summary.serverproblem.dbempty.body.link=l\u00e5t oss f\u00e5 veta
+summary.invalidparams.notimestamp.title=Inget datum angivet
+summary.invalidparams.notimestamp.body=Datum m\u00e5ste anges.
+summary.invalidparams.noip.title=Ingen IP-adress angiven
+summary.invalidparams.noip.body=IP-adress m\u00e5ste anges.
+summary.invalidparams.timestamprange.title=Ogiltigt datum
+summary.invalidparams.timestamprange.body=Databasen inneh\u00e5ller inte n\u00e5got data f\u00f6r %s. V\u00e4nligen v\u00e4lj ett datum mellan %s och %s.
+summary.invalidparams.invalidip.title=Felaktig IP-adress
+summary.invalidparams.invalidip.body=%s \u00e4r inte en giltig IP-adress. F\u00f6rv\u00e4ntat format p\u00e5 IP-adresser \u00e4r %s eller %s.
+summary.invalidparams.invalidtimestamp.title=Ogiltigt datum.
+summary.invalidparams.invalidtimestamp.body=%s \u00e4r inte ett giltigt datum. F\u00f6rv\u00e4ntat datumformat \u00e4r %s.
+summary.serverproblem.nodata.title=Serverproblem
+summary.serverproblem.nodata.body.text=Databasen inneh\u00e5ller inte n\u00e5got data f\u00f6r det efterfr\u00e5gade datumet. V\u00e4nligen f\u00f6rs\u00f6k igen senare. Om problemet kvarst\u00e5r, v\u00e4nligen %s\!
+summary.serverproblem.nodata.body.link=l\u00e5t oss f\u00e5 veta
+summary.negativesamenetwork.title=Resultatet \u00e4r negativt
+summary.negativesamenetwork.body=Vi kunde inte hitta IP-adress %s p\u00e5 eller inom en dag fr\u00e5n %s. Men vi hittade andra IP-adresser som anv\u00e4ndes av Tor-rel\u00e4n i samma /%d-n\u00e4tverk runt den tiden\:
+summary.positive.title=Resultatet \u00e4r positivt
+summary.positive.body=Vi hittade ett eller flera Tor-rel\u00e4n p\u00e5 IP-adress %s p\u00e5 eller inom en dag fr\u00e5n %s som Tor-klienter f\u00f6rmodligen k\u00e4nde till.
+summary.negative.title=Resultatet \u00e4r negativt
+summary.negative.body=Vi kunde inte hitta IP-adress %s p\u00e5 eller inom en dag fr\u00e5n %s.
+technicaldetails.heading=Tekniska detaljer
+technicaldetails.pre=Letar upp IP-adress %s p\u00e5 eller inom en dag fr\u00e5n %s. Tor-klienter kan ha valt denna eller dessa Tor-rel\u00e4n vid anslutning via Tor.
+technicaldetails.colheader.timestamp=Tidsst\u00e4mpel (UTC)
+technicaldetails.colheader.ip=IP adress(er)
+technicaldetails.colheader.fingerprint=Identitet ("fingerprint")
+technicaldetails.colheader.nickname=Namn
+technicaldetails.colheader.exit=Exit-rel\u00e4
+technicaldetails.nickname.unknown=Ok\u00e4nd
+technicaldetails.exit.unknown=Ok\u00e4nd
+technicaldetails.exit.yes=Ja
+technicaldetails.exit.no=Nej
+permanentlink.heading=Permanent l\u00e4nk
+footer.abouttor.heading=Om Tor
+footer.abouttor.body.text=Tor \u00e4r ett internationellt mjukvaruprojekt f\u00f6r att anonymisera internettrafik genom att %s. Om du ser trafik fr\u00e5n ett Tor-rel\u00e4 s\u00e5 kommer den trafiken oftast fr\u00e5n n\u00e5gon som anv\u00e4nder sig av Tor snarare \u00e4n fr\u00e5n sj\u00e4lva rel\u00e4operat\u00f6ren. Vare sig Tor-projektet eller Tor-rel\u00e4operat\u00f6rer har n\u00e5gon historik \u00f6ver trafiken som passerar genom n\u00e4tverket och kan d\u00e4rf\u00f6r inte ge n\u00e5gon information om dess ursprung. Se till att %s och tveka inte att %s f\u00f6r ytterligare information.
+footer.abouttor.body.link1=kryptera datat och skicka det genom flera hopp innan det n\u00e5r sin destination
+footer.abouttor.body.link2=l\u00e4sa p\u00e5 om Tor
+footer.abouttor.body.link3=kontakta Tor-projektet
+footer.aboutexonerator.heading=Om ExoneraTor
+footer.aboutexonerator.body=Tj\u00e4nsten ExoneraTor uppr\u00e4tth\u00e5ller en databas \u00f6ver IP-adresser som har varit en del av Tor-n\u00e4tverket. Den ger svar p\u00e5 fr\u00e5gan om det var ett Tor-rel\u00e4 som anv\u00e4nde en viss IP-adress vid ett givet datum. ExoneraTor kan komma att lagra fler \u00e4n en IP-adress per rel\u00e4 f\u00f6r rel\u00e4n som anv\u00e4nder en annan IP-adress f\u00f6r att ansluta till internet \u00e4n den som anv\u00e4ndes f\u00f6r att registrera sig i Tor-n\u00e4tverket. Huruvida ett rel\u00e4 har till\u00e5tit Tor-trafik ut mot internet vid tidpunkten eller ej lagras ocks\u00e5.
+footer.language.name=svenska
+footer.language.text=Denna sida finns \u00e4ven p\u00e5 f\u00f6ljande spr\u00e5k:
+
1
0
commit 48c44a230122ae12441a65299b655ac75113c978
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Wed May 30 15:39:01 2018 +0200
Bump version to 2.1.0-dev.
---
build.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.xml b/build.xml
index 0d34f4e..c28dbcd 100644
--- a/build.xml
+++ b/build.xml
@@ -8,7 +8,7 @@
<property name="javadoc-title" value="ExoneraTor API Documentation"/>
<property name="implementation-title" value="ExoneraTor" />
- <property name="release.version" value="2.1.0" />
+ <property name="release.version" value="2.1.0-dev" />
<property name="metricslibversion" value="2.4.0" />
<property name="jetty.version" value="-9.2.21.v20170120" />
<property name="warfile"
1
0
[exonerator/release] Prepare ExoneraTorServlet for integration into Tor Metrics.
by karsten@torproject.org 14 Aug '18
by karsten@torproject.org 14 Aug '18
14 Aug '18
commit bd235118ebe2505c571fd028f981dd3481dcfedd
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Fri Aug 10 09:33:56 2018 +0200
Prepare ExoneraTorServlet for integration into Tor Metrics.
Also add a new ExoneraTorRedirectServlet that redirects to Tor
Metrics, and make it the default.
Implements #23549.
---
CHANGELOG.md | 11 +++++
src/build | 2 +-
.../exonerator/ExoneraTorRedirectServlet.java | 24 ++++++++++
.../metrics/exonerator/ExoneraTorServlet.java | 54 ++++++++++++----------
src/main/resources/web.xml | 11 ++++-
.../web/jsps/{index.jsp => exonerator.jsp} | 0
6 files changed, 76 insertions(+), 26 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4aa9c79..1faf5ed 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,14 @@
+# Changes in version 2.2.0 - 2018-08-??
+
+ * Medium changes
+ - Prepare ExoneraTorServlet for integration into Tor Metrics.
+ - Add a new ExoneraTorRedirectServlet that redirects to Tor
+ Metrics, and make it the default.
+
+ * Minor changes
+ - Provide a thin jar file without dependencies.
+
+
# Changes in version 2.1.0 - 2018-05-29
* Medium changes
diff --git a/src/build b/src/build
index 23c6e0b..08514a3 160000
--- a/src/build
+++ b/src/build
@@ -1 +1 @@
-Subproject commit 23c6e0be5fab9463f137615053ef412e4da2315e
+Subproject commit 08514a32afefbeef848b80f9a338ee840c282604
diff --git a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorRedirectServlet.java b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorRedirectServlet.java
new file mode 100644
index 0000000..fbe4e49
--- /dev/null
+++ b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorRedirectServlet.java
@@ -0,0 +1,24 @@
+/* Copyright 2018 The Tor Project
+ * See LICENSE for licensing information */
+
+package org.torproject.metrics.exonerator;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class ExoneraTorRedirectServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 526889516976914884L;
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response) {
+ String redirectUrl = "https://metrics.torproject.org/exonerator.html";
+ if (null != request.getQueryString()) {
+ redirectUrl += "?" + request.getQueryString();
+ }
+ response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
+ response.setHeader("Location", redirectUrl);
+ }
+}
+
diff --git a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java
index 659f494..9099025 100644
--- a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java
+++ b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java
@@ -141,6 +141,9 @@ public class ExoneraTorServlet extends HttpServlet {
PrintWriter out = new PrintWriter(so);
this.writeHeader(out, rb, langStr);
+ /* Obtain request URL without query string parameters for links. */
+ String requestUrl = request.getRequestURL().toString();
+
/* Write form. */
boolean timestampOutOfRange = requestedDate.valid
&& (firstDate.valid && requestedDate.date.isBefore(firstDate.date)
@@ -155,43 +158,43 @@ public class ExoneraTorServlet extends HttpServlet {
/* If both parameters are empty, don't print any summary and exit.
* This is the start page. */
if ("".equals(relayIp) && requestedDate.empty) {
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
/* If only one parameter is empty and the other is not, print summary
* with warning message and exit. */
} else if ("".equals(relayIp)) {
this.writeSummaryNoIp(out, rb);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
} else if (requestedDate.empty) {
this.writeSummaryNoTimestamp(out, rb);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
/* If there's an issue with parsing either of the parameters, print
* summary with error message and exit. */
} else if (relayIpHasError) {
this.writeSummaryInvalidIp(out, rb, ipParameter);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
} else if (!requestedDate.valid) {
this.writeSummaryInvalidTimestamp(out, rb, requestedDate.asRequested);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
/* If the timestamp is too recent, print summary with error message and
* exit. */
} else if (requestedDate.tooRecent) {
this.writeSummaryTimestampTooRecent(out, rb);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
/* If we were unable to connect to the database,
* write an error message. */
} else if (!successfullyConnectedToBackend) {
this.writeSummaryUnableToConnectToBackend(out, rb);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
/* Similarly, if we found the database to be empty,
* write an error message, too. */
} else if (firstDate.empty || lastDate.empty) {
this.writeSummaryNoData(out, rb);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
/* If the requested date is out of range, tell the user. */
} else if (timestampOutOfRange) {
@@ -199,11 +202,11 @@ public class ExoneraTorServlet extends HttpServlet {
this.writeSummaryTimestampOutsideRange(out, rb, requestedDate.asString,
firstDate.asString, lastDate.date.isBefore(dayBeforeYesterday)
? lastDate.asString : dayBeforeYesterday.format(ISO_LOCAL_DATE));
- this.writeFooter(out, rb, relayIp, requestedDate.asString);
+ this.writeFooter(out, rb, requestUrl, relayIp, requestedDate.asString);
} else if (noRelevantConsensuses) {
this.writeSummaryNoDataForThisInterval(out, rb);
- this.writeFooter(out, rb, relayIp, requestedDate.asString);
+ this.writeFooter(out, rb, requestUrl, relayIp, requestedDate.asString);
/* Print out result. */
} else {
@@ -218,15 +221,15 @@ public class ExoneraTorServlet extends HttpServlet {
} else {
this.writeSummaryNegative(out, rb, relayIp, requestedDate.asString);
}
- this.writePermanentLink(out, rb, relayIp, requestedDate.asString,
- langStr);
- this.writeFooter(out, rb, relayIp, requestedDate.asString);
+ this.writePermanentLink(out, rb, requestUrl, relayIp,
+ requestedDate.asString, langStr);
+ this.writeFooter(out, rb, requestUrl, relayIp, requestedDate.asString);
}
/* Forward to the JSP that adds header and footer. */
request.setAttribute("lang", langStr);
request.setAttribute("body", so.toString());
- request.getRequestDispatcher("WEB-INF/index.jsp").forward(request,
+ request.getRequestDispatcher("WEB-INF/exonerator.jsp").forward(request,
response);
} catch (Throwable th) {
logger.error("Some problem in doGet. Returning error.", th);
@@ -334,7 +337,7 @@ public class ExoneraTorServlet extends HttpServlet {
+ " <div class=\"col-xs-12\">\n"
+ " <div class=\"text-center\">\n"
+ " <div class=\"row vbottom15\">\n"
- + " <h4>%s</h4>\n"
+ + " <p>%s</p>\n"
+ " </div> <!-- row -->\n"
+ " <form class=\"form-inline\">\n"
+ " <div class=\"form-group%s\">\n"
@@ -605,22 +608,24 @@ public class ExoneraTorServlet extends HttpServlet {
}
private void writePermanentLink(PrintWriter out, ResourceBundle rb,
- String relayIp, String timestampStr, String langStr) throws IOException {
+ String requestUrl, String relayIp, String timestampStr, String langStr)
+ throws IOException {
String encodedAddress = relayIp.contains(":")
? "[" + relayIp.replaceAll(":", "%3A") + "]" : relayIp;
out.printf(" <div class=\"row\">\n"
+ " <div class=\"col-xs-12\">\n"
+ " <h2>%s</h2>\n"
- + " <pre>https://exonerator.torproject.org/?ip=%s&"
+ + " <pre>%s?ip=%s&"
+ "timestamp=%s&lang=%s</pre>\n"
+ " </div><!-- col -->\n"
+ " </div><!-- row -->\n",
- rb.getString("permanentlink.heading"),
+ rb.getString("permanentlink.heading"), requestUrl,
encodedAddress, timestampStr, langStr);
}
- private void writeFooter(PrintWriter out, ResourceBundle rb, String relayIp,
- String timestampStr) throws IOException {
+ private void writeFooter(PrintWriter out, ResourceBundle rb,
+ String requestUrl, String relayIp, String timestampStr)
+ throws IOException {
out.printf(" </div><!-- container -->\n"
+ " <div class=\"container\">\n"
+ " <div class=\"row\">\n"
@@ -651,11 +656,12 @@ public class ExoneraTorServlet extends HttpServlet {
for (Map.Entry<String, String> entry
: this.availableLanguageNames.entrySet()) {
if (null != relayIp && null != timestampStr) {
- out.printf(" <a href=\"/?ip=%s×tamp=%s&lang=%s\">%s</a>",
- relayIp, timestampStr, entry.getKey(), entry.getValue());
+ out.printf(" <a href=\"%s?ip=%s×tamp=%s&lang=%s\">%s</a>",
+ requestUrl, relayIp, timestampStr, entry.getKey(),
+ entry.getValue());
} else {
- out.printf(" <a href=\"/?lang=%s\">%s</a>",
- entry.getKey(), entry.getValue());
+ out.printf(" <a href=\"%s?lang=%s\">%s</a>",
+ requestUrl, entry.getKey(), entry.getValue());
}
}
out.printf("</p>\n"
diff --git a/src/main/resources/web.xml b/src/main/resources/web.xml
index 62bf96f..f2ebbec 100644
--- a/src/main/resources/web.xml
+++ b/src/main/resources/web.xml
@@ -6,10 +6,19 @@
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
metadata-complete="false" >
+ <!--
+
+ Notice: By default, we redirect all requests to:
+ https://metrics.torproject.org/exonerator.html
+
+ If this is not the desired behavior, simply replace the servlet-class below
+ with org.torproject.metrics.exonerator.ExoneraTorServlet and redeploy.
+
+ -->
<servlet>
<servlet-name>ExoneraTor</servlet-name>
<servlet-class>
- org.torproject.metrics.exonerator.ExoneraTorServlet
+ org.torproject.metrics.exonerator.ExoneraTorRedirectServlet
</servlet-class>
</servlet>
<servlet-mapping>
diff --git a/src/main/resources/web/jsps/index.jsp b/src/main/resources/web/jsps/exonerator.jsp
similarity index 100%
rename from src/main/resources/web/jsps/index.jsp
rename to src/main/resources/web/jsps/exonerator.jsp
1
0
commit 2612bba5378f8edb53aa8163032f899888c11f56
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Mon Aug 13 19:50:52 2018 +0200
Prepare for 3.0.0 release.
---
CHANGELOG.md | 8 +++++---
build.xml | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1faf5ed..dce2f3a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,12 @@
-# Changes in version 2.2.0 - 2018-08-??
+# Changes in version 3.0.0 - 2018-08-13
- * Medium changes
- - Prepare ExoneraTorServlet for integration into Tor Metrics.
+ * Major changes
- Add a new ExoneraTorRedirectServlet that redirects to Tor
Metrics, and make it the default.
+ * Medium changes
+ - Prepare ExoneraTorServlet for integration into Tor Metrics.
+
* Minor changes
- Provide a thin jar file without dependencies.
diff --git a/build.xml b/build.xml
index c28dbcd..9d68d0e 100644
--- a/build.xml
+++ b/build.xml
@@ -8,7 +8,7 @@
<property name="javadoc-title" value="ExoneraTor API Documentation"/>
<property name="implementation-title" value="ExoneraTor" />
- <property name="release.version" value="2.1.0-dev" />
+ <property name="release.version" value="3.0.0" />
<property name="metricslibversion" value="2.4.0" />
<property name="jetty.version" value="-9.2.21.v20170120" />
<property name="warfile"
1
0
commit 33798614b10574bbd2059ac49c5e6136a912d0d0
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Tue Aug 14 20:32:46 2018 +0200
Bump version to 3.0.0-dev.
---
build.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.xml b/build.xml
index 9d68d0e..eaa2a94 100644
--- a/build.xml
+++ b/build.xml
@@ -8,7 +8,7 @@
<property name="javadoc-title" value="ExoneraTor API Documentation"/>
<property name="implementation-title" value="ExoneraTor" />
- <property name="release.version" value="3.0.0" />
+ <property name="release.version" value="3.0.0-dev" />
<property name="metricslibversion" value="2.4.0" />
<property name="jetty.version" value="-9.2.21.v20170120" />
<property name="warfile"
1
0
[exonerator/master] Prepare ExoneraTorServlet for integration into Tor Metrics.
by karsten@torproject.org 14 Aug '18
by karsten@torproject.org 14 Aug '18
14 Aug '18
commit bd235118ebe2505c571fd028f981dd3481dcfedd
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Fri Aug 10 09:33:56 2018 +0200
Prepare ExoneraTorServlet for integration into Tor Metrics.
Also add a new ExoneraTorRedirectServlet that redirects to Tor
Metrics, and make it the default.
Implements #23549.
---
CHANGELOG.md | 11 +++++
src/build | 2 +-
.../exonerator/ExoneraTorRedirectServlet.java | 24 ++++++++++
.../metrics/exonerator/ExoneraTorServlet.java | 54 ++++++++++++----------
src/main/resources/web.xml | 11 ++++-
.../web/jsps/{index.jsp => exonerator.jsp} | 0
6 files changed, 76 insertions(+), 26 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4aa9c79..1faf5ed 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,14 @@
+# Changes in version 2.2.0 - 2018-08-??
+
+ * Medium changes
+ - Prepare ExoneraTorServlet for integration into Tor Metrics.
+ - Add a new ExoneraTorRedirectServlet that redirects to Tor
+ Metrics, and make it the default.
+
+ * Minor changes
+ - Provide a thin jar file without dependencies.
+
+
# Changes in version 2.1.0 - 2018-05-29
* Medium changes
diff --git a/src/build b/src/build
index 23c6e0b..08514a3 160000
--- a/src/build
+++ b/src/build
@@ -1 +1 @@
-Subproject commit 23c6e0be5fab9463f137615053ef412e4da2315e
+Subproject commit 08514a32afefbeef848b80f9a338ee840c282604
diff --git a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorRedirectServlet.java b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorRedirectServlet.java
new file mode 100644
index 0000000..fbe4e49
--- /dev/null
+++ b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorRedirectServlet.java
@@ -0,0 +1,24 @@
+/* Copyright 2018 The Tor Project
+ * See LICENSE for licensing information */
+
+package org.torproject.metrics.exonerator;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class ExoneraTorRedirectServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 526889516976914884L;
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response) {
+ String redirectUrl = "https://metrics.torproject.org/exonerator.html";
+ if (null != request.getQueryString()) {
+ redirectUrl += "?" + request.getQueryString();
+ }
+ response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
+ response.setHeader("Location", redirectUrl);
+ }
+}
+
diff --git a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java
index 659f494..9099025 100644
--- a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java
+++ b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java
@@ -141,6 +141,9 @@ public class ExoneraTorServlet extends HttpServlet {
PrintWriter out = new PrintWriter(so);
this.writeHeader(out, rb, langStr);
+ /* Obtain request URL without query string parameters for links. */
+ String requestUrl = request.getRequestURL().toString();
+
/* Write form. */
boolean timestampOutOfRange = requestedDate.valid
&& (firstDate.valid && requestedDate.date.isBefore(firstDate.date)
@@ -155,43 +158,43 @@ public class ExoneraTorServlet extends HttpServlet {
/* If both parameters are empty, don't print any summary and exit.
* This is the start page. */
if ("".equals(relayIp) && requestedDate.empty) {
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
/* If only one parameter is empty and the other is not, print summary
* with warning message and exit. */
} else if ("".equals(relayIp)) {
this.writeSummaryNoIp(out, rb);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
} else if (requestedDate.empty) {
this.writeSummaryNoTimestamp(out, rb);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
/* If there's an issue with parsing either of the parameters, print
* summary with error message and exit. */
} else if (relayIpHasError) {
this.writeSummaryInvalidIp(out, rb, ipParameter);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
} else if (!requestedDate.valid) {
this.writeSummaryInvalidTimestamp(out, rb, requestedDate.asRequested);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
/* If the timestamp is too recent, print summary with error message and
* exit. */
} else if (requestedDate.tooRecent) {
this.writeSummaryTimestampTooRecent(out, rb);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
/* If we were unable to connect to the database,
* write an error message. */
} else if (!successfullyConnectedToBackend) {
this.writeSummaryUnableToConnectToBackend(out, rb);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
/* Similarly, if we found the database to be empty,
* write an error message, too. */
} else if (firstDate.empty || lastDate.empty) {
this.writeSummaryNoData(out, rb);
- this.writeFooter(out, rb, null, null);
+ this.writeFooter(out, rb, requestUrl, null, null);
/* If the requested date is out of range, tell the user. */
} else if (timestampOutOfRange) {
@@ -199,11 +202,11 @@ public class ExoneraTorServlet extends HttpServlet {
this.writeSummaryTimestampOutsideRange(out, rb, requestedDate.asString,
firstDate.asString, lastDate.date.isBefore(dayBeforeYesterday)
? lastDate.asString : dayBeforeYesterday.format(ISO_LOCAL_DATE));
- this.writeFooter(out, rb, relayIp, requestedDate.asString);
+ this.writeFooter(out, rb, requestUrl, relayIp, requestedDate.asString);
} else if (noRelevantConsensuses) {
this.writeSummaryNoDataForThisInterval(out, rb);
- this.writeFooter(out, rb, relayIp, requestedDate.asString);
+ this.writeFooter(out, rb, requestUrl, relayIp, requestedDate.asString);
/* Print out result. */
} else {
@@ -218,15 +221,15 @@ public class ExoneraTorServlet extends HttpServlet {
} else {
this.writeSummaryNegative(out, rb, relayIp, requestedDate.asString);
}
- this.writePermanentLink(out, rb, relayIp, requestedDate.asString,
- langStr);
- this.writeFooter(out, rb, relayIp, requestedDate.asString);
+ this.writePermanentLink(out, rb, requestUrl, relayIp,
+ requestedDate.asString, langStr);
+ this.writeFooter(out, rb, requestUrl, relayIp, requestedDate.asString);
}
/* Forward to the JSP that adds header and footer. */
request.setAttribute("lang", langStr);
request.setAttribute("body", so.toString());
- request.getRequestDispatcher("WEB-INF/index.jsp").forward(request,
+ request.getRequestDispatcher("WEB-INF/exonerator.jsp").forward(request,
response);
} catch (Throwable th) {
logger.error("Some problem in doGet. Returning error.", th);
@@ -334,7 +337,7 @@ public class ExoneraTorServlet extends HttpServlet {
+ " <div class=\"col-xs-12\">\n"
+ " <div class=\"text-center\">\n"
+ " <div class=\"row vbottom15\">\n"
- + " <h4>%s</h4>\n"
+ + " <p>%s</p>\n"
+ " </div> <!-- row -->\n"
+ " <form class=\"form-inline\">\n"
+ " <div class=\"form-group%s\">\n"
@@ -605,22 +608,24 @@ public class ExoneraTorServlet extends HttpServlet {
}
private void writePermanentLink(PrintWriter out, ResourceBundle rb,
- String relayIp, String timestampStr, String langStr) throws IOException {
+ String requestUrl, String relayIp, String timestampStr, String langStr)
+ throws IOException {
String encodedAddress = relayIp.contains(":")
? "[" + relayIp.replaceAll(":", "%3A") + "]" : relayIp;
out.printf(" <div class=\"row\">\n"
+ " <div class=\"col-xs-12\">\n"
+ " <h2>%s</h2>\n"
- + " <pre>https://exonerator.torproject.org/?ip=%s&"
+ + " <pre>%s?ip=%s&"
+ "timestamp=%s&lang=%s</pre>\n"
+ " </div><!-- col -->\n"
+ " </div><!-- row -->\n",
- rb.getString("permanentlink.heading"),
+ rb.getString("permanentlink.heading"), requestUrl,
encodedAddress, timestampStr, langStr);
}
- private void writeFooter(PrintWriter out, ResourceBundle rb, String relayIp,
- String timestampStr) throws IOException {
+ private void writeFooter(PrintWriter out, ResourceBundle rb,
+ String requestUrl, String relayIp, String timestampStr)
+ throws IOException {
out.printf(" </div><!-- container -->\n"
+ " <div class=\"container\">\n"
+ " <div class=\"row\">\n"
@@ -651,11 +656,12 @@ public class ExoneraTorServlet extends HttpServlet {
for (Map.Entry<String, String> entry
: this.availableLanguageNames.entrySet()) {
if (null != relayIp && null != timestampStr) {
- out.printf(" <a href=\"/?ip=%s×tamp=%s&lang=%s\">%s</a>",
- relayIp, timestampStr, entry.getKey(), entry.getValue());
+ out.printf(" <a href=\"%s?ip=%s×tamp=%s&lang=%s\">%s</a>",
+ requestUrl, relayIp, timestampStr, entry.getKey(),
+ entry.getValue());
} else {
- out.printf(" <a href=\"/?lang=%s\">%s</a>",
- entry.getKey(), entry.getValue());
+ out.printf(" <a href=\"%s?lang=%s\">%s</a>",
+ requestUrl, entry.getKey(), entry.getValue());
}
}
out.printf("</p>\n"
diff --git a/src/main/resources/web.xml b/src/main/resources/web.xml
index 62bf96f..f2ebbec 100644
--- a/src/main/resources/web.xml
+++ b/src/main/resources/web.xml
@@ -6,10 +6,19 @@
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
metadata-complete="false" >
+ <!--
+
+ Notice: By default, we redirect all requests to:
+ https://metrics.torproject.org/exonerator.html
+
+ If this is not the desired behavior, simply replace the servlet-class below
+ with org.torproject.metrics.exonerator.ExoneraTorServlet and redeploy.
+
+ -->
<servlet>
<servlet-name>ExoneraTor</servlet-name>
<servlet-class>
- org.torproject.metrics.exonerator.ExoneraTorServlet
+ org.torproject.metrics.exonerator.ExoneraTorRedirectServlet
</servlet-class>
</servlet>
<servlet-mapping>
diff --git a/src/main/resources/web/jsps/index.jsp b/src/main/resources/web/jsps/exonerator.jsp
similarity index 100%
rename from src/main/resources/web/jsps/index.jsp
rename to src/main/resources/web/jsps/exonerator.jsp
1
0