[tor-commits] [atlas/master] Fix three columns in search results.

karsten at torproject.org karsten at torproject.org
Mon Aug 20 07:29:44 UTC 2012


commit f518d2c2c28365542dd8ade0ad1a8c46401a8f92
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Thu Aug 9 16:27:44 2012 +0200

    Fix three columns in search results.
    
    Onionoo doesn't include or_address, or_port, and dir_port fields anymore,
    but or_addresses and dir_address.  Extract values from those fields for
    the search results table.
---
 js/models/relay.js       |    3 +++
 templates/search/do.html |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/js/models/relay.js b/js/models/relay.js
index e1393d4..49ba0ca 100644
--- a/js/models/relay.js
+++ b/js/models/relay.js
@@ -138,6 +138,9 @@ define([
                 relay.bandwidth = bw;
                 relay.family = relay.family ? relay.family : null;
                 relay.bandwidth_hr = hrBandwidth(bw);
+                relay.or_address = relay.or_addresses ? relay.or_addresses[0].split(":")[0] : null;
+                relay.or_port = relay.or_addresses ? relay.or_addresses[0].split(":")[1] : 0;
+                relay.dir_port = relay.dir_address ? relay.dir_address.split(":")[1] : 0;
                 relay.country = relay.country.toLowerCase();
                 relay.countryname = CountryCodes[relay.country];
                 relay.uptime = model.parsedate(relay.last_restarted);
diff --git a/templates/search/do.html b/templates/search/do.html
index 4ba5ef8..ee3a391 100644
--- a/templates/search/do.html
+++ b/templates/search/do.html
@@ -64,7 +64,7 @@ Please report which browser/addons/etc. you're using to <a href="https://trac.to
             <img class="inline country" title="<%= relay.get('countryname') %>" src="img/cc/<%= relay.get('country') %>.png"/>
             <% } %>
             </td>
-			<td><%= relay.get('or_addresses') %></td>
+			<td><%= relay.get('or_address') %></td>
 			<td>
             <% _.each(relay.get('flags'), function(flag) { %>
             <img class="inline flags" rel="tooltip" src="img/flags/<%= flag[1] %>.png" title="<%= flag[0] %>"/>





More information about the tor-commits mailing list