Show peers by name, by host, or by key

This commit is contained in:
Cinnamon 2020-01-23 12:46:09 -08:00
parent d1b3232e65
commit b2e7652b31
1 changed files with 15 additions and 10 deletions

View File

@ -174,9 +174,14 @@ exports.metaView = ({ status, peers, theme, themeNames }) => {
return div(label({ for: id }, key), progress({ id, value: val, max }, val));
});
const peerList = (peers || []).map(([, data]) =>
li(a({ href: `/author/${encodeURIComponent(data.key)}` }, code(data.name)))
);
const peerList = (peers || []).map(([, data]) => {
return li(
a(
{ href: `/author/${encodeURIComponent(data.key)}` },
data.name || data.host || data.key
)
);
});
const themeElements = themeNames.map(cur => {
const isCurrentTheme = cur === theme;
@ -237,13 +242,13 @@ exports.metaView = ({ status, peers, theme, themeNames }) => {
button({ type: "submit" }, "set theme")
),
base16Elements,
h2('Status'),
h3('Peer Connections 💻⚡️💻'),
p('Your computer is syncing data with these other computers. It will connect to any scuttlebutt pub and peer it can find, even if you have no relationship with them, as it looks for data from your friends.'),
peerList.length > 0
? ul(peerList)
: code('no peers connected'),
h3('Indexes'),
h2("Status"),
h3("Peer Connections 💻⚡️💻"),
p(
"Your computer is syncing data with these other computers. It will connect to any scuttlebutt pub and peer it can find, even if you have no relationship with them, as it looks for data from your friends."
),
peerList.length > 0 ? ul(peerList) : code("no peers connected"),
h3("Indexes"),
progressElements
)
);