5
0
mirror of https://github.com/cwinfo/yggdrasil-map synced 2024-11-25 08:51:36 +00:00

use labels from nodeinfo if they're defined

This commit is contained in:
Arceliar 2018-12-17 18:39:27 -06:00
parent 5eb884bdc8
commit 275f0dc3ee
2 changed files with 3 additions and 0 deletions

View File

@ -65,6 +65,8 @@ def get_graph_json(G):
centrality = centralities.get(n.name, 0)
size = 5*(1 + 1*centrality)
name = db.get(canonalize_ip(n.name))
# If label isn't the default value, set name to that instead
if n.attr['label'] != n.name.split(':')[-1]: name = n.attr['label']
out_data['nodes'].append({
'id': n.name,

View File

@ -35,6 +35,7 @@ def generate_graph(time_limit=60*60*3):
toAdd = []
for ip in data:
info = NodeInfo(ip, data[ip][0])
if len(data[ip]) >= 3: info.label = data[ip][2]
toAdd.append(info)
nodes = dict()