commit 0ac652aec6c9d42ceb29867ed49f2820ec1f4667 Author: Iain R. Learmonth irl@fsfe.org Date: Tue Aug 7 14:57:43 2018 +0100
Display Onionoo protocol version and build rev
Fixes: #26863 --- src/main/resources/web/js/rs/collections/aggregates.js | 5 ++++- src/main/resources/web/js/rs/collections/results.js | 5 ++++- src/main/resources/web/js/rs/models/relay.js | 2 ++ src/main/resources/web/js/rs/router.js | 17 +++++++++++++---- src/main/resources/web/js/rs/views/aggregate/map.js | 2 ++ src/main/resources/web/js/rs/views/aggregate/search.js | 2 ++ src/main/resources/web/js/rs/views/search/do.js | 2 ++ src/main/resources/web/templates/rs/aggregate/map.html | 2 ++ .../resources/web/templates/rs/aggregate/search.html | 1 + src/main/resources/web/templates/rs/details/bridge.html | 1 + src/main/resources/web/templates/rs/details/router.html | 1 + src/main/resources/web/templates/rs/search/do.html | 1 + 12 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/src/main/resources/web/js/rs/collections/aggregates.js b/src/main/resources/web/js/rs/collections/aggregates.js index dbf65ea..75c5e22 100644 --- a/src/main/resources/web/js/rs/collections/aggregates.js +++ b/src/main/resources/web/js/rs/collections/aggregates.js @@ -20,6 +20,8 @@ define([ this.fresh_until = response.fresh_until; this.valid_after = response.valid_after; var aggregates = {}; + var onionooVersion = response.version; + var buildRevision = response.build_revision; var relaysPublished = response.relays_published; var bridgesPublished = response.bridges_published; options.error = function(options) { @@ -122,7 +124,8 @@ define([ aggregatesArr.push(aggregate); }); collection[options.add ? 'add' : 'reset'](aggregatesArr, options); - success(err, relaysPublished, bridgesPublished); + success(err, onionooVersion, buildRevision, relaysPublished, + bridgesPublished); }).fail(function(jqXHR, textStatus, errorThrown) { if(jqXHR.statusText == "error") { error(2); diff --git a/src/main/resources/web/js/rs/collections/results.js b/src/main/resources/web/js/rs/collections/results.js index 73ef819..0110b7b 100644 --- a/src/main/resources/web/js/rs/collections/results.js +++ b/src/main/resources/web/js/rs/collections/results.js @@ -19,6 +19,8 @@ define([ this.fresh_until = response.fresh_until; this.valid_after = response.valid_after; var relays = []; + var onionooVersion = response.version; + var buildRevision = response.build_revision; var relaysPublished = response.relays_published; var bridgesPublished = response.bridges_published; options.error = function(options) { @@ -64,7 +66,8 @@ define([ $('.progress-bar').html("Rendering results..."); setTimeout(function() { collection[options.add ? 'add' : 'reset'](relays, options); - success(err, relaysPublished, bridgesPublished); + success(err, onionooVersion, buildRevision, + relaysPublished, bridgesPublished); }, 500); } else { $('.progress-bar').width((lookedUpRelays / relays.length * 100) + "%"); diff --git a/src/main/resources/web/js/rs/models/relay.js b/src/main/resources/web/js/rs/models/relay.js index a3b0d42..cdbe3a3 100644 --- a/src/main/resources/web/js/rs/models/relay.js +++ b/src/main/resources/web/js/rs/models/relay.js @@ -273,6 +273,8 @@ define([ relay.is_bridge = true; } if (relay) { + relay.onionooVersion = data.version; + relay.buildRevision = data.build_revision; relay.bridgesPublished = data.bridges_published; relay.relaysPublished = data.relays_published; model.processRelay(options, model, relay); diff --git a/src/main/resources/web/js/rs/router.js b/src/main/resources/web/js/rs/router.js index 1f65c9f..c67c4a1 100644 --- a/src/main/resources/web/js/rs/router.js +++ b/src/main/resources/web/js/rs/router.js @@ -96,8 +96,11 @@ define([ query = ""; } aggregateSearchView.collection.lookup({ - success: function(err, relaysPublished, bridgesPublished){ + success: function(err, onionooVersion, buildRevision, relaysPublished, + bridgesPublished){ aggregateSearchView.error = err; + aggregateSearchView.onionooVersion = onionooVersion; + aggregateSearchView.buildRevision = buildRevision; aggregateSearchView.relaysPublished = relaysPublished; aggregateSearchView.bridgesPublished = bridgesPublished; aggregateSearchView.render(query); @@ -137,8 +140,11 @@ define([ query = ""; } aggregateMapView.collection.lookup({ - success: function(err, relaysPublished, bridgesPublished){ + success: function(err, onionooVersion, buildRevision, relaysPublished, + bridgesPublished){ aggregateMapView.error = err; + aggregateMapView.onionooVersion = onionooVersion; + aggregateMapView.buildRevision = buildRevision; aggregateMapView.relaysPublished = relaysPublished; aggregateMapView.bridgesPublished = bridgesPublished; aggregateMapView.render(query); @@ -176,7 +182,8 @@ define([ doSearchView.collection.url = doSearchView.collection.baseurl + this.hashFingerprint(query); doSearchView.collection.lookup({ - success: function(err, relaysPublished, bridgesPublished){ + success: function(err, onionooVersion, buildRevision, + relaysPublished, bridgesPublished){ doSearchView.relays = doSearchView.collection.models; // Redirect to the details page when there is exactly one // search result. @@ -185,7 +192,9 @@ define([ doSearchView.relays[0].fingerprint); return; } - doSearchView.error = err; + doSearchView.error = err; + doSearchView.onionooVersion = onionooVersion; + doSearchView.buildRevision = buildRevision; doSearchView.relaysPublished = relaysPublished; doSearchView.bridgesPublished = bridgesPublished; doSearchView.render(query); diff --git a/src/main/resources/web/js/rs/views/aggregate/map.js b/src/main/resources/web/js/rs/views/aggregate/map.js index fe69bc0..a573e32 100644 --- a/src/main/resources/web/js/rs/views/aggregate/map.js +++ b/src/main/resources/web/js/rs/views/aggregate/map.js @@ -246,6 +246,8 @@ define([ aggregates: this.collection.models, countries: CountryCodes, error: this.error, + onionooVersion: this.onionooVersion, + buildRevision: this.buildRevision, relaysPublished: this.relaysPublished, bridgesPublished: this.bridgesPublished}));
diff --git a/src/main/resources/web/js/rs/views/aggregate/search.js b/src/main/resources/web/js/rs/views/aggregate/search.js index 3c656fc..a259332 100644 --- a/src/main/resources/web/js/rs/views/aggregate/search.js +++ b/src/main/resources/web/js/rs/views/aggregate/search.js @@ -25,6 +25,8 @@ define([ aType: this.collection.aType, countries: CountryCodes, error: this.error, + onionooVersion: this.onionooVersion, + buildRevision: this.buildRevision, relaysPublished: this.relaysPublished, bridgesPublished: this.bridgesPublished}));
diff --git a/src/main/resources/web/js/rs/views/search/do.js b/src/main/resources/web/js/rs/views/search/do.js index 53c80e6..16ee7a9 100644 --- a/src/main/resources/web/js/rs/views/search/do.js +++ b/src/main/resources/web/js/rs/views/search/do.js @@ -24,6 +24,8 @@ define([ relays: relays, countries: CountryCodes, error: this.error, + onionooVersion: this.onionooVersion, + buildRevision: this.buildRevision, relaysPublished: this.relaysPublished, bridgesPublished: this.bridgesPublished}));
diff --git a/src/main/resources/web/templates/rs/aggregate/map.html b/src/main/resources/web/templates/rs/aggregate/map.html index 87ce0dc..b30e800 100644 --- a/src/main/resources/web/templates/rs/aggregate/map.html +++ b/src/main/resources/web/templates/rs/aggregate/map.html @@ -64,4 +64,6 @@ <a class="btn btn-secondary" id="permalink">Permalink</a> </div> </div> +<p>Information for relays was published: <%= relaysPublished %> UTC.<p> +<p><small>Onionoo version: <%= onionooVersion %>/<%= buildRevision %></small></p> <% } %> diff --git a/src/main/resources/web/templates/rs/aggregate/search.html b/src/main/resources/web/templates/rs/aggregate/search.html index 6679846..151afb6 100644 --- a/src/main/resources/web/templates/rs/aggregate/search.html +++ b/src/main/resources/web/templates/rs/aggregate/search.html @@ -146,5 +146,6 @@ probabilities of using relays in a particular country or AS as a guard, middle or exit relay. The results are restricted to only relays that were running at the last time the relays data was updated and do not include bridge data.</p> <p>Information for relays was published: <%= relaysPublished %> UTC.<p> +<p><small>Onionoo version: <%= onionooVersion %>/<%= buildRevision %></small></p> <% } %> </div> diff --git a/src/main/resources/web/templates/rs/details/bridge.html b/src/main/resources/web/templates/rs/details/bridge.html index 05f4d7b..69a1cd1 100644 --- a/src/main/resources/web/templates/rs/details/bridge.html +++ b/src/main/resources/web/templates/rs/details/bridge.html @@ -201,4 +201,5 @@ </div> </div> <p>Information for bridges was published: <%= relay.get('bridgesPublished') %> UTC.</p> +<p><small>Onionoo version: <%= relay.get('onionooVersion') %>/<%= relay.get('buildRevision') %></small></p>
diff --git a/src/main/resources/web/templates/rs/details/router.html b/src/main/resources/web/templates/rs/details/router.html index 4ee4c88..db5ec03 100644 --- a/src/main/resources/web/templates/rs/details/router.html +++ b/src/main/resources/web/templates/rs/details/router.html @@ -305,3 +305,4 @@ should update it as soon as possible.</div> </div><!-- container-fluid -->
<p>Information for relays was published: <%= relay.get('relaysPublished') %> UTC.</p> +<p><small>Onionoo version: <%= relay.get('onionooVersion') %>/<%= relay.get('buildRevision') %></small></p> diff --git a/src/main/resources/web/templates/rs/search/do.html b/src/main/resources/web/templates/rs/search/do.html index 4f48a50..40745a6 100644 --- a/src/main/resources/web/templates/rs/search/do.html +++ b/src/main/resources/web/templates/rs/search/do.html @@ -144,6 +144,7 @@ bridge relays do not advertise family members in their descriptors and so there is no value shown for bridge relays.</p> <p>Information for relays was published: <%= relaysPublished %> UTC.<br> Information for bridges was published: <%= bridgesPublished %> UTC.</p> +<p><small>Onionoo version: <%= onionooVersion %>/<%= buildRevision %></small></p> <% } %> </div>
tor-commits@lists.torproject.org