Merge pull request #70 from fraction/meta-names
Add prototype for names in peer list
This commit is contained in:
commit
d1b3232e65
12
src/index.js
12
src/index.js
|
@ -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;
|
||||
|
|
|
@ -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 => {
|
||||
|
|
Loading…
Reference in New Issue