Merge pull request #70 from fraction/meta-names

Add prototype for names in peer list
This commit is contained in:
Cinnamon 2020-01-23 12:21:53 -08:00 committed by GitHub
commit d1b3232e65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -318,10 +318,16 @@ router
const getMeta = async ({ theme }) => {
const status = await meta.status();
const peers = await meta.peers();
const peersWithNames = await Promise.all(
peers.map(async ([key, value]) => {
value.name = await about.name(value.key);
return [key, value];
})
);
return metaView({ status, peers, theme, themeNames });
};
ctx.body = await getMeta({ theme });
return metaView({ status, peers: peersWithNames, theme, themeNames });
}
ctx.body = await getMeta({ theme })
})
.get("/likes/:feed", async ctx => {
const { feed } = ctx.params;

View File

@ -175,7 +175,7 @@ exports.metaView = ({ status, peers, theme, themeNames }) => {
});
const peerList = (peers || []).map(([, data]) =>
li(a({ href: `/author/${encodeURIComponent(data.key)}` }, code(data.key)))
li(a({ href: `/author/${encodeURIComponent(data.key)}` }, code(data.name)))
);
const themeElements = themeNames.map(cur => {