git ssb

2+

ev / mvd



Commit 3ccd1c2c0111305dd97838649d9aba1f1a265232

implement mentions tab with ssb-backlinks

Ev Bogue committed on 5/28/2018, 9:54:38 PM
Parent: c909de36e0325388afbaa5b1d6050b073e2fd3f8

Files changed

bin.jschanged
index.jschanged
scuttlebot.jschanged
views.jschanged
bin.jsView
@@ -33,8 +33,9 @@
3333 .use(require('ssb-friends'))
3434 .use(require('ssb-blobs'))
3535 .use(require('ssb-query'))
3636 .use(require('ssb-links'))
37 + .use(require('ssb-backlinks'))
3738 .use(require('ssb-ebt'))
3839 .use(require('ssb-ooo'))
3940 .use(require('scuttlebot/plugins/invite'))
4041 .use(require('scuttlebot/plugins/local'))
index.jsView
@@ -29,11 +29,11 @@
2929 }
3030 }
3131 }
3232 })),
33- h('li', h('a', {href: '#'}, 'Public')),
34- h('li', h('a', {href: '#private' }, 'Private')),
33 + h('li', h('a', {href: '#'}, 'Stream')),
3534 h('li', h('a', {href: '#mentions' }, 'Mentions')),
35 + h('li', h('a', {href: '#private' }, 'Inbox')),
3636 h('li', h('a', {href: '#key' }, 'Key')),
3737 h('li.right', h('a', {href: '#about'}, '?'))
3838 )
3939 )
scuttlebot.jsView
@@ -61,8 +61,11 @@
6161 CACHE[e.key] = CACHE[e.key] || e.value
6262 })
6363 )
6464 }),
65 + backlinks: rec.source(function (query) {
66 + return sbot.backlinks.read(query)
67 + }),
6568 query: rec.source(function (query) {
6669 return sbot.query.read(query)
6770 }),
6871 get: rec.async(function (key, cb) {
views.jsView
@@ -8,8 +8,10 @@
88 var ref = require('ssb-ref')
99
1010 var config = require('./config')()
1111
12 +var id = require('./keys').id
13 +
1214 var fs = require('fs')
1315
1416 var compose = require('./compose')
1517
@@ -22,8 +24,34 @@
2224
2325 screen.appendChild(hyperscroll(content))
2426 }
2527
28 +var mentionsStream = function () {
29 + var content = h('div.content')
30 +
31 + var screen = document.getElementById('screen')
32 +
33 + screen.appendChild(hyperscroll(content))
34 +
35 + function createStream (opts) {
36 + return pull(
37 + sbot.backlinks({query: [{$filter: {dest: id}}], reverse: true}),
38 + pull.map(function (msg) {
39 + console.log(msg)
40 + if (msg.value.private == true)
41 + return 'ignoring private message'
42 + else
43 + return render(msg)
44 + })
45 + )
46 + }
47 +
48 + pull(
49 + createStream({reverse: true, limit: 10}),
50 + stream.bottom(content)
51 + )
52 +}
53 +
2654 var logStream = function () {
2755 var content = h('div.content')
2856 var screen = document.getElementById('screen')
2957 screen.appendChild(hyperscroll(content))
@@ -33,8 +61,9 @@
3361 More(sbot.createLogStream, opts),
3462 pull.map(function (msg) {
3563 return render(msg)
3664 })
65 +
3766 )
3867 }
3968
4069 pull(
@@ -148,8 +177,11 @@
148177 if (ref.isFeed(src)) {
149178 userStream(src)
150179 } else if (ref.isMsg(src)) {
151180 msgThread(src)
181 + } else if (src == 'mentions') {
182 + console.log('mentions')
183 + mentionsStream()
152184 } else if (src == 'about') {
153185 about()
154186 } else if (src == 'key') {
155187 keyPage()

Built with git-ssb-web