Commit 3068af308439c6051b8c9e06bc9316b15827aa23
/network add "remote peers"
mixmix committed on 1/15/2019, 1:41:53 AMParent: a9195c696583b3d711feccb0b9ec40bc2ea10f1e
Files changed
app/page/network.js | changed |
app/page/network.mcss | changed |
app/page/network.js | ||
---|---|---|
@@ -17,9 +17,10 @@ | ||
17 | 17 … | exports.needs = nest({ |
18 | 18 … | 'about.html.avatar': 'first', |
19 | 19 … | 'app.sync.goTo': 'first', |
20 | 20 … | 'sbot.obs.connection': 'first', |
21 | - 'sbot.obs.localPeers': 'first' | |
21 … | + 'sbot.obs.localPeers': 'first', | |
22 … | + 'sbot.obs.connectedPeers': 'first' | |
22 | 23 … | }) |
23 | 24 … | |
24 | 25 … | exports.create = function (api) { |
25 | 26 … | return nest({ |
@@ -43,18 +44,36 @@ | ||
43 | 44 … | const page = h('NetworkPage', { title: '/network' }, [ |
44 | 45 … | h('div.container', [ |
45 | 46 … | h('h1', 'Network'), |
46 | 47 … | h('section', [ |
47 | - h('h2', 'Local Peers'), | |
48 … | + h('h2', [ | |
49 … | + 'Local Peers', | |
50 … | + h('i.fa.fa-question-circle-o', { title: 'these are people on the same WiFi/ LAN as you right now. You might not know some of them yet, but you can click through to find out more about them and follow them if you like.' }) | |
51 … | + ]), | |
48 | 52 … | computed(state.localPeers, peers => { |
49 | - if (!peers.length) return h('p', 'There aren\'t currently any peers on the same wifi / LAN as you') | |
53 … | + if (!peers.length) return h('p', 'No local peers (on same wifi/ LAN)') | |
50 | 54 … | |
51 | 55 … | return peers.map(peer => api.about.html.avatar(peer)) |
52 | 56 … | }) |
53 | 57 … | ]), |
54 | 58 … | h('section', [ |
55 | - h('h2', 'Received'), | |
56 | - h('p', `Messages received per ${minsPerStep}-minute block over the last ${scale / DAY} days`), | |
59 … | + h('h2', [ | |
60 … | + 'Remote Peers', | |
61 … | + h('i.fa.fa-question-circle-o', { title: 'these are peers which have fixed addresses, and are likely friends of friends (a.k.a. pubs)' }) | |
62 … | + ]), | |
63 … | + computed(state.remotePeers, peers => { | |
64 … | + if (!peers.length) return h('p', 'No remote peers connected') | |
65 … | + | |
66 … | + return peers.map(peer => api.about.html.avatar(peer)) | |
67 … | + }) | |
68 … | + ]), | |
69 … | + h('section', [ | |
70 … | + h('h2', [ | |
71 … | + 'Received Messages', | |
72 … | + h('i.fa.fa-question-circle-o', { | |
73 … | + title: `Messages received per ${minsPerStep}-minute block over the last ${scale / DAY} days` | |
74 … | + }) | |
75 … | + ]), | |
57 | 76 … | canvas |
58 | 77 … | ]) |
59 | 78 … | ]) |
60 | 79 … | ]) |
@@ -126,12 +145,18 @@ | ||
126 | 145 … | lower: latest + minsPerStep * MINUTE - scale |
127 | 146 … | } |
128 | 147 … | }) |
129 | 148 … | |
149 … | + const localPeers = throttle(api.sbot.obs.localPeers(), 1000) | |
150 … | + const remotePeers = computed([localPeers, throttle(api.sbot.obs.connectedPeers(), 1000)], (local, connected) => { | |
151 … | + return connected.filter(peer => !local.includes(peer)) | |
152 … | + }) | |
153 … | + | |
130 | 154 … | return { |
131 | 155 … | data, |
132 | 156 … | range, |
133 | - localPeers: throttle(api.sbot.obs.localPeers(), 1000) | |
157 … | + localPeers, | |
158 … | + remotePeers | |
134 | 159 … | } |
135 | 160 … | } |
136 | 161 … | |
137 | 162 … | function getData ({ data, server, minsPerStep, scale }) { |
Built with git-ssb-web