[tor-commits] [atlas/master] Updates paths for inclusion in metrics-web (See: #25258)

irl at torproject.org irl at torproject.org
Thu Feb 15 21:03:48 UTC 2018


commit 295f48afbf7912f993379173456c7913daf22a16
Author: Iain R. Learmonth <irl at fsfe.org>
Date:   Thu Feb 15 12:55:01 2018 +0000

    Updates paths for inclusion in metrics-web (See: #25258)
---
 js/main.js                      | 34 +++++++++++++++++-----------------
 js/router.js                    | 16 ++++++++--------
 js/views/aggregate/map.js       |  6 +++---
 templates/aggregate/search.html |  2 +-
 templates/details/bridge.html   | 20 ++++++++++----------
 templates/details/router.html   | 22 +++++++++++-----------
 templates/search/do.html        |  8 ++++----
 7 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/js/main.js b/js/main.js
index 842dc07..125b8c0 100644
--- a/js/main.js
+++ b/js/main.js
@@ -7,23 +7,23 @@ require.config({
     "bootstrap" : { "deps" :['jquery'] }
   },
   paths: {
-    jquery: 'https://metrics.torproject.org/js/jquery-3.2.1.min',
-    underscore: 'libs/underscore/underscore-min',
-    backbone: 'libs/backbone/backbone.min',
-    text: 'libs/require/text',
-    datatables: 'libs/datatables/jquery.dataTables.min',
-    datatablest: 'libs/datatables/dataTables.TorStatus',
-    datatablessort: 'libs/datatables/dataTables.Sorting',
-    bootstrap: 'libs/bootstrap/bootstrap.min',
-    datatablesbs: 'libs/datatables/dataTables.bootstrap',
-    d3js: 'libs/d3js/d3.v3.min',
-    "d3-geo-projection": 'libs/d3js/d3-geo-projection.v2.min',
-    "d3-geo": 'libs/d3js/d3-geo.v1.min',
-    "d3-array": 'libs/d3js/d3-array.v1.min',
-    topojson: 'libs/d3js/topojson.v1.min',
-    jssha: 'libs/jssha/sha1',
-    templates: '../templates',
-    fallbackdir: 'fallback_dir'
+    jquery: '/js/jquery-3.2.1.min',
+    underscore: '/rs/js/libs/underscore/underscore-min',
+    backbone: '/rs/js/libs/backbone/backbone.min',
+    text: '/rs/js/libs/require/text',
+    datatables: '/rs/js/libs/datatables/jquery.dataTables.min',
+    datatablest: '/rs/js/libs/datatables/dataTables.TorStatus',
+    datatablessort: '/rs/js/libs/datatables/dataTables.Sorting',
+    bootstrap: '/rs/js/libs/bootstrap/bootstrap.min',
+    datatablesbs: '/rs/js/libs/datatables/dataTables.bootstrap',
+    d3js: '/rs/js/libs/d3js/d3.v3.min',
+    "d3-geo-projection": '/rs/js/libs/d3js/d3-geo-projection.v2.min',
+    "d3-geo": '/rs/js/libs/d3js/d3-geo.v1.min',
+    "d3-array": '/rs/js/libs/d3js/d3-array.v1.min',
+    topojson: '/rs/js/libs/d3js/topojson.v1.min',
+    jssha: '/rs/js/libs/jssha/sha1',
+    templates: '/rs/templates',
+    fallbackdir: '/rs/js/fallback_dir'
   }
 
 });
diff --git a/js/router.js b/js/router.js
index aafef60..1f65c9f 100644
--- a/js/router.js
+++ b/js/router.js
@@ -47,7 +47,7 @@ define([
                 mainDetailsView.render();
                 $(".progress").hide();
                 $("#content").show();
-                $(".breadcrumb").html("<li><a href=\"https://metrics.torproject.org/\">Home</a></li><li><a href=\"https://metrics.torproject.org/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Details for " + relay.get('nickname') + "</li>");
+                $(".breadcrumb").html("<li><a href=\"/\">Home</a></li><li><a href=\"/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Details for " + relay.get('nickname') + "</li>");
                 $("#secondary-search").show();
 
             },
@@ -55,14 +55,14 @@ define([
                 mainDetailsView.error();
                 $(".progress").hide();
                 $("#content").show();
-                $(".breadcrumb").html("<li><a href=\"https://metrics.torproject.org/\">Home</a></li><li><a href=\"https://metrics.torproject.org/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Error</li>");
+                $(".breadcrumb").html("<li><a href=\"/\">Home</a></li><li><a href=\"/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Error</li>");
                 $("#secondary-search").show();
             }
         });
     },
     // Empty aggregation query
     emptyAggregateSearch: function() {
-        $(".breadcrumb").html("<li><a href=\"https://metrics.torproject.org/\">Home</a></li><li><a href=\"https://metrics.torproject.org/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Error</li>");
+        $(".breadcrumb").html("<li><a href=\"/\">Home</a></li><li><a href=\"/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Error</li>");
         $("#secondary-search-query").val("");
 
         $("#secondary-search").hide();
@@ -77,7 +77,7 @@ define([
     },
     // Perform an aggregate search
     aggregateSearch: function(aType, query){
-        $(".breadcrumb").html("<li><a href=\"https://metrics.torproject.org/\">Home</a></li><li><a href=\"https://metrics.torproject.org/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Aggregated search" + ((query) ? " for " + query : "") + "</li>");
+        $(".breadcrumb").html("<li><a href=\"/\">Home</a></li><li><a href=\"/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Aggregated search" + ((query) ? " for " + query : "") + "</li>");
 
         $("#content").hide();
         $("#secondary-search").hide();
@@ -117,7 +117,7 @@ define([
     },
     // Perform an aggregate search
     aggregateMap: function(property, query){
-        $(".breadcrumb").html("<li><a href=\"https://metrics.torproject.org/\">Home</a></li><li><a href=\"https://metrics.torproject.org/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Map view" + ((query) ? " for " + query : "") + "</li>");
+        $(".breadcrumb").html("<li><a href=\"/\">Home</a></li><li><a href=\"/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Map view" + ((query) ? " for " + query : "") + "</li>");
 
         $("#content").hide();
         $("#secondary-search").hide();
@@ -158,7 +158,7 @@ define([
     },
     // Perform a search on Atlas
     doSearch: function(query){
-        $(".breadcrumb").html("<li><a href=\"https://metrics.torproject.org/\">Home</a></li><li><a href=\"https://metrics.torproject.org/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Search for " + query + "</li>");
+        $(".breadcrumb").html("<li><a href=\"/\">Home</a></li><li><a href=\"/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Search for " + query + "</li>");
 
         $("#secondary-search").hide();
         $("#content").hide();
@@ -206,7 +206,7 @@ define([
         }
     },
     showTopRelays: function(){
-        $(".breadcrumb").html("<li><a href=\"https://metrics.torproject.org/\">Home</a></li><li><a href=\"https://metrics.torproject.org/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Top Relays</li>");
+        $(".breadcrumb").html("<li><a href=\"/\">Home</a></li><li><a href=\"/services.html\">Services</a></li><li><a href=\"#\">Relay Search</a></li><li class=\"active\">Top Relays</li>");
 
         $("#secondary-search-query").val("");
 
@@ -238,7 +238,7 @@ define([
 
     // No matched rules go to the default home page
     defaultAction: function(actions){
-        $(".breadcrumb").html("<li><a href=\"https://metrics.torproject.org/\">Home</a></li><li><a href=\"https://metrics.torproject.org/services.html\">Services</a></li><li class=\"active\">Relay Search</li>");
+        $(".breadcrumb").html("<li><a href=\"/\">Home</a></li><li><a href=\"/services.html\">Services</a></li><li class=\"active\">Relay Search</li>");
         $("#secondary-search").hide();
         $("#secondary-search-query").val("");
 
diff --git a/js/views/aggregate/map.js b/js/views/aggregate/map.js
index 6c62277..c77ec10 100644
--- a/js/views/aggregate/map.js
+++ b/js/views/aggregate/map.js
@@ -19,11 +19,11 @@ define([
     el: "#content",
     explanations: {
         "relays": "The map shows the total number of relays running in each country.",
-        "consensus_weight_fraction": "This map shows the total <a href=\"https://metrics.torproject.org/glossary.html#consensus-weight\" target=\"_blank\">consensus weight</a> of each country's relays as a percentage of all consensus weights in the network.  This percentage is a very rough approximation of the probability of a relay in each country to be selected by clients.",
+        "consensus_weight_fraction": "This map shows the total <a href=\"/glossary.html#consensus-weight\" target=\"_blank\">consensus weight</a> of each country's relays as a percentage of all consensus weights in the network.  This percentage is a very rough approximation of the probability of a relay in each country to be selected by clients.",
         "guard_probability": "This map shows the total guard probability of each country's relays as a percentage of the guard probabilities of all relays in the network. This probability is calculated based on consensus weights, relay flags, and bandwidth weights in the consensus. Path selection depends on more factors, so that this probability can only be an approximation.",
         "middle_probability": "This map shows the total middle probability of each country's relays as a percentage of the middle probabilities of all relays in the network. This probability is calculated based on consensus weights, relay flags, and bandwidth weights in the consensus. Path selection depends on more factors, so that this probability can only be an approximation.",
         "exit_probability": "This map shows the total exit probability of each country's relays as a percentage of the exit probabilities of all relays in the network. This probability is calculated based on consensus weights, relay flags, and bandwidth weights in the consensus. Path selection depends on more factors, so that this probability can only be an approximation.",
-        "advertised_bandwidth": "This map shows the total <a href=\"https://metrics.torproject.org/glossary.html#advertised-bandwidth\" target=\"_blank\">advertised bandwidth</a> of each country's relays.",
+        "advertised_bandwidth": "This map shows the total <a href=\"/glossary.html#advertised-bandwidth\" target=\"_blank\">advertised bandwidth</a> of each country's relays.",
         "consensus_weight_to_bandwidth": "This map shows the average ratio of consensus weight to advertised bandwidth for relays in each country. Countries shown in purple have greater consensus weight than advertised bandwidth, indicating that they are overweighted. Countries shown in green have greater advertised bandwidth than consensus weight and so are underweighted. Relays that did not have an advertised bandwidth or advertise a bandwidth of zero are not included in this analysis. Relays that have not yet been measured by at least three bandwidth authorities are also not included in this map as their consensus weight is not based on bandwidth measurement yet."
     },
     initialize: function() {
@@ -121,7 +121,7 @@ define([
         return text;
       }
 
-      d3.json("json/countries.topo.json", function(error, us) {
+      d3.json("/rs/json/countries.topo.json", function(error, us) {
       g.append("g")
         .attr("id", "countries")
         .style("fill","#fff")
diff --git a/templates/aggregate/search.html b/templates/aggregate/search.html
index d71f6e4..df537c2 100644
--- a/templates/aggregate/search.html
+++ b/templates/aggregate/search.html
@@ -64,7 +64,7 @@
     <% } %>
     <td>
       <% if ((typeof aggregate.country) == "string") { %>
-        <a href="#search/<%= (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %><% if (query.indexOf("country:") == -1) { %>country:<%= aggregate.country  %><% } %>"><img class="inline country" src="img/cc/<%= aggregate.country %>.png"> <%= countries[aggregate.country] %></a>
+        <a href="#search/<%= (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %><% if (query.indexOf("country:") == -1) { %>country:<%= aggregate.country  %><% } %>"><img class="inline country" src="/rs/img/cc/<%= aggregate.country %>.png"> <%= countries[aggregate.country] %></a>
       <% } else { %>
         <% if ((typeof aggregate.as) == "string") { %>
           (<a href="#aggregate/ascc/<%= (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %><% if (query.indexOf("as:") == -1) { %>as:<%= aggregate.as %><% } %>"><%= aggregate.country.size %> distinct</a>)
diff --git a/templates/details/bridge.html b/templates/details/bridge.html
index a619731..690723e 100644
--- a/templates/details/bridge.html
+++ b/templates/details/bridge.html
@@ -50,7 +50,7 @@
     <dt><span class="tip" title="Flags that the directory authorities assigned to this bridge.">Flags</span></dt>
     <dd><% _.each(relay.get('flags'), function(flag) { %>
     <span class="tip flags" title="<%= flag[2] %>">
-        <img class="inline" alt="" src="img/flags/<%= flag[1] %>.png"/>
+        <img class="inline" alt="" src="/rs/img/flags/<%= flag[1] %>.png"/>
         <span class="inline"><%= flag[0] %></span>
     </span>
     <% }); %>
@@ -61,7 +61,7 @@
         <% var propertyCount = 0; %>
         <% _.each(relay.get('additional_flags'), function(flag) { propertyCount++; %>
             <span class="tip flags" title="<%= flag[2] %>">
-                <img class="inline" alt="" src="img/flags/<%= flag[1] %>.png"/>
+                <img class="inline" alt="" src="/rs/img/flags/<%= flag[1] %>.png"/>
                 <span class="inline"><%= flag[0] %></span>
             </span>
         <% }); %>
@@ -99,7 +99,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="bw_month" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
             <div class="caption">
               <h5>1 Month graph</h5>
@@ -110,7 +110,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="clients_month" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
             <div class="caption">
               <h5>1 Month graph</h5>
@@ -126,7 +126,7 @@
           <div class="thumbnail">
 
             <div id="bw_months" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
             <div class="caption">
               <h5>3 Months graph</h5>
@@ -137,7 +137,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="clients_months" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
             <div class="caption">
               <h5>3 Months graph</h5>
@@ -152,7 +152,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="bw_year" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
             <div class="caption">
               <h5>1 Year graph</h5>
@@ -163,7 +163,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="clients_year" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
             <div class="caption">
               <h5>1 Year graph</h5>
@@ -178,7 +178,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="bw_years" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
             <div class="caption">
               <h5>5 Years graph</h5>
@@ -189,7 +189,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="clients_years" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
 
            <div class="caption">
diff --git a/templates/details/router.html b/templates/details/router.html
index 5233648..3b66315 100644
--- a/templates/details/router.html
+++ b/templates/details/router.html
@@ -122,7 +122,7 @@
     <dt><span class="tip" title="Flags that the directory authorities assigned to this relay.">Flags</span></dt>
     <dd><% _.each(relay.get('flags'), function(flag) { %>
         <span class="tip flags" title="<%= flag[2] %>">
-            <img class="inline" alt="" src="img/flags/<%= flag[1] %>.png"/>
+            <img class="inline" alt="" src="/rs/img/flags/<%= flag[1] %>.png"/>
             <span class="inline"><%= flag[0] %></span>
         </span>
     <% }); %>
@@ -134,7 +134,7 @@
         <% var propertyCount = 0; %>
         <% _.each(relay.get('additional_flags'), function(flag) { propertyCount++; %>
             <span class="tip flags" title="<%= flag[2] %>">
-                <img class="inline" alt="" src="img/flags/<%= flag[1] %>.png"/>
+                <img class="inline" alt="" src="/rs/img/flags/<%= flag[1] %>.png"/>
                 <span class="inline"><%= flag[0] %></span>
             </span>
         <% }); %>
@@ -145,7 +145,7 @@
     <dd><% if (relay.get('host_name')) { %><%= relay.get('host_name') %><% } else { %>No PTR record found<% } %></dd>
 
     <dt><span class="tip" title="Country as found in a GeoIP database by resolving the relay's first onion-routing address.">Country</span></dt>
-    <dd><% if (relay.get('country')) { %><img class="inline country" title="<%= relay.get('countryname') %>" alt="" src="img/cc/<%= relay.get('country') %>.png"/> <%= relay.get('countryname') %><% } else { %>Unknown<% } %></dd>
+    <dd><% if (relay.get('country')) { %><img class="inline country" title="<%= relay.get('countryname') %>" alt="" src="/rs/img/cc/<%= relay.get('country') %>.png"/> <%= relay.get('countryname') %><% } else { %>Unknown<% } %></dd>
 
     <dt><span class="tip" title="Autonomous System Number">AS Number</span></dt>
     <dd><% if (relay.get('as_number') !== null) { %><a href="#search/as:<%= relay.get('as_number') %>"><%= _.escape(relay.get('as_number')) %></a><% } else { %>unknown<% }; %></dd>
@@ -185,7 +185,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="bw_month" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
             <div class="caption">
               <h5>1 Month graph</h5>
@@ -196,7 +196,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="weights_month" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
            <div class="caption">
               <h5>1 Month graph</h5>
@@ -211,7 +211,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="bw_months" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
             <div class="caption">
               <h5>3 Months graph</h5>
@@ -222,7 +222,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="weights_months" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
            <div class="caption">
               <h5>3 Months graph</h5>
@@ -237,7 +237,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="bw_year" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
             <div class="caption">
               <h5>1 Year graph</h5>
@@ -248,7 +248,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="weights_year" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
            <div class="caption">
               <h5>1 Year graph</h5>
@@ -263,7 +263,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="bw_years" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
            <div class="caption">
               <h5>5 Years graph</h5>
@@ -274,7 +274,7 @@
         <div class="col-md-6">
           <div class="thumbnail">
             <div id="weights_years" class="graph">
-            <img src="img/no-data-available.png" alt="">
+            <img src="/rs/img/no-data-available.png" alt="">
             </div>
            <div class="caption">
               <h5>5 Years graph</h5>
diff --git a/templates/search/do.html b/templates/search/do.html
index 62aa19e..d175198 100644
--- a/templates/search/do.html
+++ b/templates/search/do.html
@@ -95,18 +95,18 @@
             </td>
             <% if ( relay.get('country')) { %>
               <td data-order="<%= relay.get('countryname') %>">
-                <img class="tip inline country" title="<%= relay.get('countryname') %>" alt="<%= relay.get('countryname') %>" src="img/cc/<%= relay.get('country') %>.png"/>
+                <img class="tip inline country" title="<%= relay.get('countryname') %>" alt="<%= relay.get('countryname') %>" src="/rs/img/cc/<%= relay.get('country') %>.png"/>
               </td>
             <% } else { %>
-              <td data-order="Unknown"><img class="tip inline country" title="Unknown" alt="Unknown" src="img/cc/xz.png"></td>
+              <td data-order="Unknown"><img class="tip inline country" title="Unknown" alt="Unknown" src="/rs/img/cc/xz.png"></td>
             <% } %>
 			<td><%= relay.get('or_address') %></td>
 			<td><%= (relay.get('or_v6_address')) ? relay.get('or_v6_address') : '-' %></td>
 			<td class="flags-cell">
-            <% _.each(relay.get('flags'), function(flag) { %><img class="tip flags" src="img/flags/<%= flag[1] %>.png" alt="<%= flag[0] %>" title="<%= flag[0] %><br /><%= flag[2] %>"/><% }); %>
+            <% _.each(relay.get('flags'), function(flag) { %><img class="tip flags" src="/rs/img/flags/<%= flag[1] %>.png" alt="<%= flag[0] %>" title="<%= flag[0] %><br /><%= flag[2] %>"/><% }); %>
             </td>
             <td>
-            <% _.each(relay.get('additional_flags'), function(flag) { %><img class="tip flags" src="img/flags/<%= flag[1] %>.png" alt="<%= flag[0] %>" title="<%= flag[0] %><br /><%= flag[2] %>"/><% }); %>
+            <% _.each(relay.get('additional_flags'), function(flag) { %><img class="tip flags" src="/rs/img/flags/<%= flag[1] %>.png" alt="<%= flag[0] %>" title="<%= flag[0] %><br /><%= flag[2] %>"/><% }); %>
             </td>
 			<td><%= relay.get('or_port') %></td>
 			<td><%= relay.get('dir_port') %></td>



More information about the tor-commits mailing list