summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/css/new-style.css4
-rw-r--r--src/js/models/OnionooDetail.js8
-rw-r--r--src/js/models/defaults.js7
-rw-r--r--src/js/templates/relayDetail.hbs13
-rw-r--r--test/unit/onionoodetail.test.js3
5 files changed, 27 insertions, 8 deletions
diff --git a/src/css/new-style.css b/src/css/new-style.css
index 34bac6e..58e2cda 100644
--- a/src/css/new-style.css
+++ b/src/css/new-style.css
@@ -456,6 +456,10 @@ code {
background-color: #f7f7f7; }
.item-list li:last-of-type {
border-bottom: 0; }
+ .item-list li.alleged {
+ background-color: #ffe2c9; }
+ .item-list li.alleged:nth-child(even) {
+ background-color: #ffefe0; }
.flags-list i.fa {
margin-right: 10px; }
diff --git a/src/js/models/OnionooDetail.js b/src/js/models/OnionooDetail.js
index f229d90..6f4db42 100644
--- a/src/js/models/OnionooDetail.js
+++ b/src/js/models/OnionooDetail.js
@@ -27,6 +27,7 @@ GLOBE.OnionooDetail.reopenClass({
var relay = $.extend({}, defaults.relay, result.relays[i]);
var relayObj = GLOBE.OnionooRelayDetail.create(relay);
var relayLastSeenMoment = moment.utc(relayObj.get('last_seen'));
+ var emptyFamily = true;
// check if consensus.relays and lastSeenMoment exist
if ( consensus.relays && relayLastSeenMoment &&
@@ -34,6 +35,13 @@ GLOBE.OnionooDetail.reopenClass({
consensus.relays.isValid() && relayLastSeenMoment.isValid()) {
relayObj.set('inLatestConsensus', consensus.relays.isSame(relayLastSeenMoment));
}
+
+ // family field is replaced by the union of both effective and alleged family fields
+ if( relayObj.effective_family.length > 0 || relayObj.alleged_family.length > 0 ) {
+ emptyFamily = false;
+ }
+
+ relayObj.set('emptyFamily', emptyFamily);
details.relays.push(relayObj);
diff --git a/src/js/models/defaults.js b/src/js/models/defaults.js
index d5c2c29..1685a99 100644
--- a/src/js/models/defaults.js
+++ b/src/js/models/defaults.js
@@ -23,7 +23,7 @@ GLOBE.defaults.OnionooBridgeDetail = {
/**
* default relay detail object
* @see {@link https://onionoo.torproject.org/#details}
- * @type {{nickname: string, fingerprint: string, hashed_fingerprint: string, or_addresses: Array, exit_addresses: Array, dir_address: string, last_seen: string, last_changed_address_or_port: string, first_seen: string, running: null, flags: Array, country: string, country_name: string, region_name: string, city_name: string, latitude: number, longitude: number, as_number: string, as_name: string, consensus_weight: number, host_name: string, last_restarted: string, bandwidth_rate: number, bandwidth_burst: number, observed_bandwidth: number, advertised_bandwidth: number, exit_policy: Array, exit_policy_summary: Array, contact: string, platform: string, family: Array, advertised_bandwidth_fraction: number, consensus_weight_fraction: number, guard_probability: number, middle_probability: number, exit_probability: number}}
+ * @type {{nickname: string, fingerprint: string, hashed_fingerprint: string, or_addresses: Array, exit_addresses: Array, dir_address: string, last_seen: string, last_changed_address_or_port: string, first_seen: string, running: null, flags: Array, country: string, country_name: string, region_name: string, city_name: string, latitude: number, longitude: number, as_number: string, as_name: string, consensus_weight: number, host_name: string, last_restarted: string, bandwidth_rate: number, bandwidth_burst: number, observed_bandwidth: number, advertised_bandwidth: number, exit_policy: Array, exit_policy_summary: Array, contact: string, platform: string, effective_family: Array, alleged_family: Array, advertised_bandwidth_fraction: number, consensus_weight_fraction: number, guard_probability: number, middle_probability: number, exit_probability: number}}
*/
GLOBE.defaults.OnionooRelayDetail = {
nickname: 'Unnamed',
@@ -58,7 +58,8 @@ GLOBE.defaults.OnionooRelayDetail = {
exit_policy_summary: [],
contact: '',
platform: '',
- family: [],
+ effective_family: [],
+ alleged_family: [],
advertised_bandwidth_fraction: -1,
consensus_weight_fraction: -1,
guard_probability: -1,
@@ -78,4 +79,4 @@ GLOBE.defaults.History = {
factor: 1,
count: 0,
values: []
-}; \ No newline at end of file
+};
diff --git a/src/js/templates/relayDetail.hbs b/src/js/templates/relayDetail.hbs
index 1e9e449..ea7d133 100644
--- a/src/js/templates/relayDetail.hbs
+++ b/src/js/templates/relayDetail.hbs
@@ -171,11 +171,16 @@
title="Other family members of this relay.">Family Members</h5>
<div class="property-content">
<ul class="item-list">
- {{#each family}}
- <li><i {{action 'visitFamilyMember' this}} title="open family member details" class="button fa fa-external-link-square"></i> {{unbound familyToFingerprint this }}</li>
- {{else}}
+ {{#if emptyFamily}}
<li>none</li>
- {{/each}}
+ {{else}}
+ {{#each effective_family}}
+ <li><i {{action 'visitFamilyMember' this}} title="open family member details" class="button fa fa-external-link-square"></i> {{unbound familyToFingerprint this }}</li>
+ {{/each}}
+ {{#each alleged_family}}
+ <li class="alleged"><i {{action 'visitFamilyMember' this}} title="open (alleged) family member details" class="button fa fa-external-link-square"></i> {{unbound familyToFingerprint this }}</li>
+ {{/each}}
+ {{/if}}
</ul>
</div>
</div>
diff --git a/test/unit/onionoodetail.test.js b/test/unit/onionoodetail.test.js
index 3ac9733..c241abf 100644
--- a/test/unit/onionoodetail.test.js
+++ b/test/unit/onionoodetail.test.js
@@ -62,7 +62,8 @@ test('detail defaults test', function(){
'exit_policy_summary',
'contact',
'platform',
- 'family',
+ 'effective_family',
+ 'alleged_family',
'advertised_bandwidth_fraction',
'consensus_weight_fraction',
'guard_probability',