|
|
@ -14,27 +14,25 @@ module.exports = { |
|
|
|
return onionoo |
|
|
|
.details(query) |
|
|
|
.then(response => { |
|
|
|
const details = response.body; |
|
|
|
if (details.relays) { |
|
|
|
details.relays.forEach(setNodeType('relay')); |
|
|
|
} |
|
|
|
if (details.bridges) { |
|
|
|
details.bridges.forEach(setNodeType('bridge')); |
|
|
|
} |
|
|
|
return details.relays.concat(details.bridges); |
|
|
|
const relays = response.body.relays || []; |
|
|
|
const bridges = response.body.bridges || []; |
|
|
|
relays.forEach(setNodeType('relay')); |
|
|
|
bridges.forEach(setNodeType('bridge')); |
|
|
|
return relays.concat(bridges); |
|
|
|
}); |
|
|
|
}, |
|
|
|
node: id => { |
|
|
|
return onionoo |
|
|
|
.details({ lookup: id }) |
|
|
|
.then(response => { |
|
|
|
const details = response.body; |
|
|
|
if (details.relays && details.relays[0]) { |
|
|
|
details.relays[0].type = 'relay'; |
|
|
|
return details.relays[0]; |
|
|
|
} else if (details.bridges && details.bridges[0]) { |
|
|
|
details.bridges[0].type = 'bridge'; |
|
|
|
return details.bridges[0]; |
|
|
|
const relays = response.body.relays || []; |
|
|
|
const bridges = response.body.bridges || []; |
|
|
|
if (relays[0]) { |
|
|
|
relays[0].type = 'relay'; |
|
|
|
return relays[0]; |
|
|
|
} else if (bridges[0]) { |
|
|
|
bridges[0].type = 'bridge'; |
|
|
|
return bridges[0]; |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|