git ssb

16+

Dominic / patchbay



Commit 7478b5388306a177f85de2b6a0c3bcedf8635c87

nest other modules, remove legacy plugs code

mix irving committed on 1/16/2017, 5:53:25 AM
Parent: a3d2c0a84691aab64838207f75583d4e86d564b5

Files changed

embedded.jschanged
modules_basic/compose.jschanged
modules_basic/feed.jschanged
modules_basic/follow.jschanged
modules_basic/index.jschanged
modules_basic/invite.jschanged
modules_basic/like.jschanged
modules_basic/message/link.jschanged
modules_basic/names.jschanged
modules_basic/post.jschanged
modules_basic/pub.jschanged
modules_basic/public.jschanged
modules_basic/relationships.jschanged
modules_basic/search-box.jschanged
modules_basic/setup.jschanged
modules_basic/suggest-mentions.jschanged
modules_basic/thread.jschanged
modules_basic/avatar-edit.jsdeleted
modules_basic/avatar/avatar.jsadded
modules_basic/avatar/edit.jsadded
modules_basic/avatar/image.jsadded
modules_basic/avatar/link.jsadded
modules_basic/avatar/name.jsadded
modules_basic/avatar/profile.jsadded
modules_basic/avatar-image.jsdeleted
modules_basic/avatar-link.jsdeleted
modules_basic/avatar-name.jsdeleted
modules_basic/avatar-profile.jsdeleted
modules_basic/avatar.jsdeleted
modules_core/app.jschanged
modules_core/index.jschanged
modules_core/menu.jschanged
modules_core/tabs.jschanged
modules_core/style-mixins.jsdeleted
modules_core/style/mixins.jsadded
modules_core/style/styles.jsadded
modules_core/styles.jsdeleted
modules_embedded/index.jschanged
modules_extra/audio-mp3.jschanged
modules_extra/emoji.jschanged
modules_extra/git-ssb.jschanged
modules_extra/git.jschanged
modules_extra/index.jschanged
modules_extra/key.jschanged
modules_extra/meta-image.jschanged
modules_extra/network.jschanged
modules_extra/notifications.jschanged
modules_extra/query.jschanged
modules_extra/raw.jschanged
modules_extra/search.jschanged
modules_extra/split.jschanged
modules_extra/suggest-emoji.jschanged
modules_extra/music-release-cc.jsdeleted
modules_extra/music/release-cc.jsadded
modules_extra/music/release.jsadded
modules_extra/music-release.jsdeleted
embedded.jsView
@@ -1,9 +1,12 @@
1 +// polyfills
2 +require('setimmediate')
3 +
14 require('depject')(
25 require('./modules_embedded'),
36 require('./modules_basic'),
47 require('./modules_extra')
5-).plugs.app[0]()
8 +).app[0]()
69
710
811
912
modules_basic/compose.jsView
@@ -5,15 +5,8 @@
55 const suggest = require('suggest-box')
66 const mentions = require('ssb-mentions')
77 const cont = require('cont')
88
9-//var plugs = require('../plugs')
10-//var suggest_mentions= plugs.asyncConcat(exports.suggest_mentions = [])
11-//var publish = plugs.first(exports.sbot_publish = [])
12-//var message_content = plugs.first(exports.message_content = [])
13-//var message_confirm = plugs.first(exports.message_confirm = [])
14-//var file_input = plugs.first(exports.file_input = [])
15-
169 exports.needs = {
1710 suggest_mentions: 'map', //<-- THIS MUST BE REWRITTEN
1811 publish: 'first',
1912 message_content: 'first',
modules_basic/feed.jsView
@@ -3,14 +3,8 @@
33 var h = require('hyperscript')
44 var pull = require('pull-stream')
55 var u = require('../util')
66
7-//var plugs = require('../plugs')
8-//var sbot_user_feed = plugs.first(exports.sbot_user_feed = [])
9-//var message_render = plugs.first(exports.message_render = [])
10-//var avatar_profile = plugs.first(exports.avatar_profile = [])
11-//var signifier = plugs.first(exports.signifier = [])
12-
137 exports.needs = {
148 sbot_user_feed: 'first',
159 message_render: 'first',
1610 avatar_profile: 'first',
modules_basic/follow.jsView
@@ -1,14 +1,8 @@
11 var h = require('hyperscript')
22 var u = require('../util')
33 var pull = require('pull-stream')
44
5-//var plugs = require('../plugs')
6-//var avatar = plugs.first(exports.avatar = [])
7-//var avatar_name = plugs.first(exports.avatar_name = [])
8-//var avatar_link = plugs.first(exports.avatar_link = [])
9-//var message_confirm = plugs.first(exports.message_confirm = [])
10-//var follower_of = plugs.first(exports.follower_of = [])
115
126 //render a message when someone follows someone,
137 //so you see new users
148 function isRelated(value, name) {
modules_basic/index.jsView
@@ -1,35 +1,37 @@
11 module.exports = {
2- "about.js": require('./about'),
3- "avatar-edit.js": require('./avatar-edit'),
4- "avatar-image.js": require('./avatar-image'),
5- "avatar-link.js": require('./avatar-link'),
6- "avatar-name.js": require('./avatar-name'),
7- "avatar-profile.js": require('./avatar-profile'),
8- "avatar.js": require('./avatar'),
9- "compose.js": require('./compose'),
10- "feed.js": require('./feed'),
11- "follow.js": require('./follow'),
12- "invite.js": require('./invite'),
13- "like.js": require('./like'),
14- "markdown.js": require('./markdown'),
15- message: {
16- author: require('./message/author'),
17- backlinks: require('./message/backlinks'),
18- link: require('./message/link'),
19- name: require('./message/name'),
20- render: require('./message/render'),
2 + 'about': require('./about'),
3 + 'avatar': {
4 + 'edit': require('./avatar/edit'),
5 + 'image': require('./avatar/image'),
6 + 'link': require('./avatar/link'),
7 + 'name': require('./avatar/name'),
8 + 'profile': require('./avatar/profile'),
9 + 'avatar': require('./avatar/avatar')
2110 },
22- "names.js": require('./names'),
23- "post.js": require('./post'),
24- "private.js": require('./private'),
25- "pub.js": require('./pub'),
26- "public.js": require('./public'),
27- "relationships.js": require('./relationships'),
28- "reply.js": require('./reply'),
29- "search-box.js": require('./search-box'),
30- "setup.js": require('./setup'),
31- "suggest-mentions.js": require('./suggest-mentions'),
32- "thread.js": require('./thread'),
33- "timestamp.js": require('./timestamp')
11 + 'compose': require('./compose'),
12 + 'feed': require('./feed'),
13 + 'follow': require('./follow'),
14 + 'invite': require('./invite'),
15 + 'like': require('./like'),
16 + 'markdown': require('./markdown'),
17 + 'message': {
18 + 'author': require('./message/author'),
19 + 'backlinks': require('./message/backlinks'),
20 + 'link': require('./message/link'),
21 + 'name': require('./message/name'),
22 + 'render': require('./message/render'),
23 + },
24 + 'names': require('./names'),
25 + 'post': require('./post'),
26 + 'private': require('./private'),
27 + 'pub': require('./pub'),
28 + 'public': require('./public'),
29 + 'relationships': require('./relationships'),
30 + 'reply': require('./reply'),
31 + 'search-box': require('./search-box'),
32 + 'setup': require('./setup'),
33 + 'suggest-mentions': require('./suggest-mentions'),
34 + 'thread': require('./thread'),
35 + 'timestamp': require('./timestamp')
3436 }
3537
modules_basic/invite.jsView
@@ -5,13 +5,8 @@
55 var h = require('hyperscript')
66
77 var Progress = require('hyperprogress')
88
9-//var plugs = require('../plugs')
10-//var sbot_publish = plugs.first(exports.sbot_publish = [])
11-//var sbot_gossip_connect = plugs.first(exports.sbot_gossip_connect = [])
12-//var follower_of = plugs.first(exports.follower_of = [])
13-
149 exports.needs = {
1510 sbot_publish: 'first',
1611 sbot_gossip_connect: 'first',
1712 follower_of: 'first',
modules_basic/like.jsView
@@ -2,14 +2,8 @@
22 var h = require('hyperscript')
33 var u = require('../util')
44 var pull = require('pull-stream')
55
6-var plugs = require('../plugs')
7-
8-//var message_confirm = plugs.first(exports.message_confirm = [])
9-//var message_link = plugs.first(exports.message_link = [])
10-//var sbot_links = plugs.first(exports.sbot_links = [])
11-
126 exports.needs = {
137 avatar_name: 'first',
148 message_confirm: 'first',
159 message_link: 'first',
modules_basic/message/link.jsView
@@ -1,11 +1,7 @@
11 var h = require('hyperscript')
22 var ref = require('ssb-ref')
33
4-//var first = require('../plugs').first
5-//var sbot_get = first(exports.sbot_get = [])
6-//var message_name = first(exports.message_name = [])
7-
84 exports.needs = {
95 message_name: 'first'
106 }
117
modules_basic/names.jsView
@@ -5,12 +5,8 @@
55 function all(stream, cb) {
66 pull(stream, pull.collect(cb))
77 }
88
9-//var plugs = require('../plugs')
10-//var sbot_links2 = plugs.first(exports.sbot_links2 = [])
11-//var sbot_query = plugs.first(exports.sbot_query = [])
12-//
139 exports.needs = {
1410 sbot_links2: 'first',
1511 sbot_query: 'first'
1612 }
modules_basic/post.jsView
@@ -4,13 +4,8 @@
44 var ref = require('ssb-ref')
55
66 //render a message
77
8-//var plugs = require('../plugs')
9-//var message_link = plugs.first(exports.message_link = [])
10-//var markdown = plugs.first(exports.markdown = [])
11-//
12-
138 exports.needs = {
149 message_link: 'first',
1510 markdown: 'first'
1611 }
modules_basic/pub.jsView
@@ -1,9 +1,6 @@
11 var h = require('hyperscript')
2-//var plugs = require('../plugs')
3-//var avatar_name = plugs.first(exports.avatar_name = [])
4-//var avatar_link = plugs.first(exports.avatar_link = [])
5-//
2 +
63 exports.needs = {
74 avatar_name: 'first',
85 avatar_link: 'first'
96 }
modules_basic/public.jsView
@@ -2,13 +2,8 @@
22 var u = require('../util')
33 var pull = require('pull-stream')
44 var Scroller = require('pull-scroll')
55
6-//var plugs = require('../plugs')
7-//var message_render = plugs.first(exports.message_render = [])
8-//var message_compose = plugs.first(exports.message_compose = [])
9-//var sbot_log = plugs.first(exports.sbot_log = [])
10-
116 exports.needs = {
127 message_render: 'first',
138 message_compose: 'first',
149 sbot_log: 'first',
modules_basic/relationships.jsView
@@ -1,22 +1,19 @@
11 var pull = require('pull-stream')
2-//var plugs = require('../plugs')
32
4-//var sbot_query = plugs.first(exports.sbot_query = [])
5-
63 //this is a bit crude, and doesn't actually show unfollows yet.
74
85 function makeQuery (a, b) {
96 return {"$filter": {
10- value: {
11- author: a,
12- content: {
13- type: 'contact',
14- contact: b,
15- following: true
16- }
17- },
18- }}
7 + value: {
8 + author: a,
9 + content: {
10 + type: 'contact',
11 + contact: b,
12 + following: true
13 + }
14 + },
15 + }}
1916 }
2017
2118
2219 exports.needs = { sbot_query: 'first' }
modules_basic/search-box.jsView
@@ -3,13 +3,8 @@
33 var h = require('hyperscript')
44 var suggest = require('suggest-box')
55 var pull = require('pull-stream')
66
7-//var plugs = require('../plugs')
8-//var sbot_query = plugs.first(exports.sbot_query = [])
9-//var sbot_links2 = plugs.first(exports.sbot_links2 = [])
10-//var suggest_search = plugs.asyncConcat(exports.suggest_search = [])
11-
127 exports.needs = {
138 sbot_query: 'first', sbot_links2: 'first',
149 suggest_search: 'map' //REWRITE
1510 }
modules_basic/setup.jsView
@@ -1,17 +1,8 @@
11
22 var h = require('hyperscript')
33 var pull = require('pull-stream')
44
5-//var plugs = require('../plugs')
6-//
7-//var avatar_edit = plugs.first(exports.avatar_edit = [])
8-//var invite_parse = plugs.first(exports.invite_parse = [])
9-//var invite_accept = plugs.first(exports.invite_accept = [])
10-//var sbot_progress = plugs.first(exports.sbot_progress = [])
11-//var sbot_query = plugs.first(exports.sbot_query = [])
12-//var avatar = plugs.first(exports.avatar = [])
13-
145 exports.needs = {
156 avatar: 'first',
167 avatar_edit: 'first',
178 invite_parse: 'first',
modules_basic/suggest-mentions.jsView
@@ -2,13 +2,8 @@
22 function isImage (filename) {
33 return /\.(gif|jpg|png|svg)$/i.test(filename)
44 }
55
6-//var sbot_links2 = require('../plugs').first(exports.sbot_links2 = [])
7-//var blob_url = require('../plugs').first(exports.blob_url = [])
8-//var signified = require('../plugs').first(exports.signified = [])
9-//var builtin_tabs = require('../plugs').map(exports.builtin_tabs = [])
10-
116 exports.needs = {
127 sbot_links2: 'first',
138 blob_url: 'first',
149 signified: 'first',
modules_basic/thread.jsView
@@ -20,18 +20,8 @@
2020 })
2121 }
2222 }
2323
24-//var plugs = require('../plugs')
25-//
26-//var message_render = plugs.first(exports.message_render = [])
27-//var message_name = plugs.first(exports.message_name = [])
28-//var message_compose = plugs.first(exports.message_compose = [])
29-//var message_unbox = plugs.first(exports.message_unbox = [])
30-//
31-//var sbot_get = plugs.first(exports.sbot_get = [])
32-//var sbot_links = plugs.first(exports.sbot_links = [])
33-
3424 exports.needs = {
3525 message_render: 'first',
3626 message_name: 'first',
3727 message_compose: 'first',
modules_basic/avatar-edit.jsView
@@ -1,152 +1,0 @@
1-'use strict'
2-var dataurl = require('dataurl-')
3-var hyperfile = require('hyperfile')
4-var hypercrop = require('hypercrop')
5-var hyperlightbox = require('hyperlightbox')
6-var h = require('hyperscript')
7-var pull = require('pull-stream')
8-var getAvatar = require('ssb-avatar')
9-var plugs = require('../plugs')
10-var ref = require('ssb-ref')
11-var visualize = require('visualize-buffer')
12-var self_id = require('../keys').id
13-
14-//var confirm = plugs.first(exports.message_confirm = [])
15-//var sbot_blobs_add = plugs.first(exports.sbot_blobs_add = [])
16-//var blob_url = plugs.first(exports.blob_url = [])
17-//var sbot_links = plugs.first(exports.sbot_links = [])
18-//var avatar_name = plugs.first(exports.avatar_name = [])
19-//
20-
21-function crop (d, cb) {
22- var data
23- var canvas = hypercrop(h('img', {src: d}))
24-
25- return h('div.column.avatar_pic',
26- canvas,
27- //canvas.selection,
28- h('div.row.avatar_pic__controls',
29- h('button', 'okay', {onclick: function () {
30- cb(null, canvas.selection.toDataURL())
31- }}),
32- h('button', 'cancel', {onclick: function () {
33- cb(new Error('canceled'))
34- }})
35- )
36- )
37-}
38-
39-exports.needs = {
40- message_confirm: 'first',
41- sbot_blobs_add: 'first',
42- blob_url: 'first',
43- sbot_links: 'first',
44- avatar_name: 'first'
45-}
46-
47-exports.gives = 'avatar_edit'
48-
49-exports.create = function (api) {
50- return function (id) {
51-
52- var img = visualize(new Buffer(id.substring(1), 'base64'), 256)
53- img.classList.add('avatar--large')
54-
55- var lb = hyperlightbox()
56- var name_input = h('input', {placeholder: 'rename'})
57- var name = api.avatar_name(id)
58- var selected = null, selected_data = null
59-
60- getAvatar({links: api.sbot_links}, self_id, id, function (err, avatar) {
61- if (err) return console.error(err)
62- //don't show user has already selected an avatar.
63- if(selected) return
64- if(ref.isBlob(avatar.image))
65- img.src = api.blob_url(avatar.image)
66- })
67-
68- var also_pictured = h('div.profile__alsopicturedas.wrap')
69-
70- pull(
71- api.sbot_links({dest: id, rel: 'about', values: true}),
72- pull.map(function (e) {
73- return e.value.content.image
74- }),
75- pull.filter(function (e) {
76- return e && 'string' == typeof e.link
77- }),
78- pull.unique('link'),
79- pull.drain(function (image) {
80- also_pictured.appendChild(
81- h('a', {href:'#', onclick: function (ev) {
82- ev.stopPropagation()
83- ev.preventDefault()
84- selected = image
85- img.src = api.blob_url(image.link || image)
86- }},
87- h('img.avatar--thumbnail', {src: api.blob_url(image)})
88- )
89- )
90- })
91- )
92-
93- return h('div.row.profile',
94- lb,
95- img,
96- h('div.column.profile__info',
97- h('strong', name),
98- name_input,
99-
100- hyperfile.asDataURL(function (data) {
101- var el = crop(data, function (err, data) {
102- if(data) {
103- img.src = data
104- var _data = dataurl.parse(data)
105- pull(
106- pull.once(_data.data),
107- api.sbot_blobs_add(function (err, hash) {
108- //TODO. Alerts are EVIL.
109- //I use them only in a moment of weakness.
110-
111- if(err) return alert(err.stack)
112- selected = {
113- link: hash,
114- size: _data.data.length,
115- type: _data.mimetype,
116- width: 512,
117- height: 512
118- }
119-
120- })
121- )
122- }
123- lb.close()
124- })
125- lb.show(el)
126- }),
127- h('button', 'update', {onclick: function () {
128- if(name_input.value)
129- name.textContent = name_input.value
130-
131- if(selected)
132- api.message_confirm({
133- type: 'about',
134- about: id,
135- name: name_input.value || undefined,
136- image: selected
137- })
138- else if(name_input.value) //name only
139- api.message_confirm({
140- type: 'about',
141- about: id,
142- name: name_input.value || undefined,
143- })
144- else
145- //another moment of weakness
146- alert('must select a name or image')
147- }}),
148- also_pictured
149- )
150- )
151- }
152-}
modules_basic/avatar/avatar.jsView
@@ -1,0 +1,45 @@
1 +var h = require('hyperscript')
2 +var u = require('../../util')
3 +
4 +exports.needs = {
5 + avatar_name: 'first',
6 + avatar_image: 'first',
7 + avatar_link: 'first'
8 +}
9 +
10 +exports.gives = {
11 + avatar: true,
12 + avatar_image_name_link: true,
13 + avatar_image_link: true,
14 + avatar_name_link: true
15 +}
16 +
17 +exports.create = function (api) {
18 + return {
19 + avatar,
20 + avatar_image_name_link,
21 + avatar_image_link,
22 + avatar_name_link
23 + }
24 +
25 + function avatar (author, classes) {
26 + return exports.avatar_image_name_link(author, classes)
27 + }
28 +
29 + function avatar_image_name_link (author, classes) {
30 + return api.avatar_link(author, [
31 + api.avatar_image(author, classes),
32 + api.avatar_name(author)
33 + ])
34 + }
35 +
36 + function avatar_image_link (author, classes) {
37 + return api.avatar_link(author, api.avatar_image(author, classes))
38 + }
39 +
40 + function avatar_name_link (author, classes) {
41 + return api.avatar_link(author, api.avatar_name(author))
42 + }
43 +}
44 +
45 +
modules_basic/avatar/edit.jsView
@@ -1,0 +1,144 @@
1 +'use strict'
2 +var dataurl = require('dataurl-')
3 +var hyperfile = require('hyperfile')
4 +var hypercrop = require('hypercrop')
5 +var hyperlightbox = require('hyperlightbox')
6 +var h = require('hyperscript')
7 +var pull = require('pull-stream')
8 +var getAvatar = require('ssb-avatar')
9 +var ref = require('ssb-ref')
10 +var visualize = require('visualize-buffer')
11 +var self_id = require('../../keys').id
12 +
13 +function crop (d, cb) {
14 + var data
15 + var canvas = hypercrop(h('img', {src: d}))
16 +
17 + return h('div.column.avatar_pic',
18 + canvas,
19 + //canvas.selection,
20 + h('div.row.avatar_pic__controls',
21 + h('button', 'okay', {onclick: function () {
22 + cb(null, canvas.selection.toDataURL())
23 + }}),
24 + h('button', 'cancel', {onclick: function () {
25 + cb(new Error('canceled'))
26 + }})
27 + )
28 + )
29 +}
30 +
31 +exports.needs = {
32 + message_confirm: 'first',
33 + sbot_blobs_add: 'first',
34 + blob_url: 'first',
35 + sbot_links: 'first',
36 + avatar_name: 'first'
37 +}
38 +
39 +exports.gives = 'avatar_edit'
40 +
41 +exports.create = function (api) {
42 + return function (id) {
43 +
44 + var img = visualize(new Buffer(id.substring(1), 'base64'), 256)
45 + img.classList.add('avatar--large')
46 +
47 + var lb = hyperlightbox()
48 + var name_input = h('input', {placeholder: 'rename'})
49 + var name = api.avatar_name(id)
50 + var selected = null, selected_data = null
51 +
52 + getAvatar({links: api.sbot_links}, self_id, id, function (err, avatar) {
53 + if (err) return console.error(err)
54 + //don't show user has already selected an avatar.
55 + if(selected) return
56 + if(ref.isBlob(avatar.image))
57 + img.src = api.blob_url(avatar.image)
58 + })
59 +
60 + var also_pictured = h('div.profile__alsopicturedas.wrap')
61 +
62 + pull(
63 + api.sbot_links({dest: id, rel: 'about', values: true}),
64 + pull.map(function (e) {
65 + return e.value.content.image
66 + }),
67 + pull.filter(function (e) {
68 + return e && 'string' == typeof e.link
69 + }),
70 + pull.unique('link'),
71 + pull.drain(function (image) {
72 + also_pictured.appendChild(
73 + h('a', {href:'#', onclick: function (ev) {
74 + ev.stopPropagation()
75 + ev.preventDefault()
76 + selected = image
77 + img.src = api.blob_url(image.link || image)
78 + }},
79 + h('img.avatar--thumbnail', {src: api.blob_url(image)})
80 + )
81 + )
82 + })
83 + )
84 +
85 + return h('div.row.profile',
86 + lb,
87 + img,
88 + h('div.column.profile__info',
89 + h('strong', name),
90 + name_input,
91 +
92 + hyperfile.asDataURL(function (data) {
93 + var el = crop(data, function (err, data) {
94 + if(data) {
95 + img.src = data
96 + var _data = dataurl.parse(data)
97 + pull(
98 + pull.once(_data.data),
99 + api.sbot_blobs_add(function (err, hash) {
100 + //TODO. Alerts are EVIL.
101 + //I use them only in a moment of weakness.
102 +
103 + if(err) return alert(err.stack)
104 + selected = {
105 + link: hash,
106 + size: _data.data.length,
107 + type: _data.mimetype,
108 + width: 512,
109 + height: 512
110 + }
111 +
112 + })
113 + )
114 + }
115 + lb.close()
116 + })
117 + lb.show(el)
118 + }),
119 + h('button', 'update', {onclick: function () {
120 + if(name_input.value)
121 + name.textContent = name_input.value
122 +
123 + if(selected)
124 + api.message_confirm({
125 + type: 'about',
126 + about: id,
127 + name: name_input.value || undefined,
128 + image: selected
129 + })
130 + else if(name_input.value) //name only
131 + api.message_confirm({
132 + type: 'about',
133 + about: id,
134 + name: name_input.value || undefined,
135 + })
136 + else
137 + //another moment of weakness
138 + alert('must select a name or image')
139 + }}),
140 + also_pictured
141 + )
142 + )
143 + }
144 +}
modules_basic/avatar/image.jsView
@@ -1,0 +1,111 @@
1 +'use strict'
2 +var getAvatar = require('ssb-avatar')
3 +var h = require('hyperscript')
4 +var ref = require('ssb-ref')
5 +var path = require('path')
6 +var visualize = require('visualize-buffer')
7 +
8 +var pull = require('pull-stream')
9 +
10 +var self_id = require('../../keys').id
11 +
12 +exports.needs = {
13 + sbot_query: 'first',
14 + blob_url: 'first'
15 +}
16 +
17 +exports.gives = {
18 + connection_status: true, avatar_image: true
19 +}
20 +
21 +function isFunction (f) {
22 + return 'function' === typeof f
23 +}
24 +
25 +
26 +var ready = false
27 +var waiting = []
28 +
29 +var last = 0
30 +
31 +var cache = {}
32 +
33 +exports.create = function (api) {
34 + var avatars = {}
35 +
36 + //blah blah
37 + return {
38 + connection_status: function (err) {
39 + if (err) return
40 + pull(
41 + api.sbot_query({
42 + query: [{
43 + $filter: {
44 + timestamp: {$gt: last || 0 },
45 + value: { content: {
46 + type: "about",
47 + about: {$prefix: "@"},
48 + image: {link: {$prefix: "&"}}
49 + }}
50 + }},
51 + {
52 + $map: {
53 + id: ["value", "content", "about"],
54 + image: ["value", "content", "image", "link"],
55 + by: ["value", "author"],
56 + ts: 'timestamp'
57 + }}],
58 + live: true
59 + }),
60 + pull.drain(function (a) {
61 + if(a.sync) {
62 + ready = true
63 + while(waiting.length) waiting.shift()()
64 + return
65 + }
66 + last = a.ts
67 + //set image for avatar.
68 + //overwrite another avatar
69 + //you picked.
70 + if(
71 + //if there is no avatar
72 + (!avatars[a.id]) ||
73 + //if i chose this avatar
74 + (a.by == self_id) ||
75 + //they chose their own avatar,
76 + //and current avatar was not chosen by me
77 + (a.by === a.id && avatars[a.id].by != self_id)
78 + )
79 + avatars[a.id] = a
80 +
81 + })
82 + )
83 + },
84 +
85 + avatar_image: function (author, classes) {
86 + classes = classes || ''
87 + if(classes && 'string' === typeof classes) classes = '.avatar--'+classes
88 +
89 + function gen (id) {
90 + if(cache[id]) return h('img', {src: cache[id]})
91 + var img = visualize(new Buffer(author.substring(1), 'base64'), 256)
92 + cache[id] = img.src
93 + return img
94 + }
95 +
96 + var img = ready && avatars[author] ? h('img', {src: api.blob_url(avatars[author].image)}) : gen(author)
97 +
98 + ;(classes || '').split('.').filter(Boolean).forEach(function (c) {
99 + img.classList.add(c)
100 + })
101 +
102 + if(!ready)
103 + waiting.push(function () {
104 + if(avatars[author]) img.src = api.blob_url(avatars[author].image)
105 + })
106 +
107 + return img
108 + }
109 + }
110 +}
111 +
modules_basic/avatar/link.jsView
@@ -1,0 +1,24 @@
1 +var h = require('hyperscript')
2 +
3 +exports.needs = {
4 + signifier: 'first'
5 +}
6 +
7 +exports.gives = 'avatar_link'
8 +
9 +exports.create = function (api) {
10 + return function (id, element) {
11 +
12 + var link = h('a.avatar', {href: "#"+id, title: id}, element)
13 +
14 + api.signifier(id, function (_, names) {
15 + if(names.length)
16 + link.title = names[0].name + '\n '+id
17 + })
18 +
19 + return link
20 + }
21 +}
22 +
23 +
24 +
modules_basic/avatar/name.jsView
@@ -1,0 +1,29 @@
1 +var h = require('hyperscript')
2 +
3 +exports.needs = {
4 + signifier: 'first'
5 +}
6 +
7 +exports.gives = 'avatar_name'
8 +
9 +exports.create = function (api) {
10 +
11 + return function name (id) {
12 + var n = h('span', id ? id.substring(0, 10) : "")
13 +
14 + //choose the most popular name for this person.
15 + //for anything like this you'll see I have used sbot.links2
16 + //which is the ssb-links plugin. as you'll see the query interface
17 + //is pretty powerful!
18 + //TODO: "most popular" name is easily gameable.
19 + //must come up with something better than this.
20 +
21 + api.signifier(id, function (_, names) {
22 + if(names.length) n.textContent = names[0].name
23 + })
24 +
25 + return n
26 + }
27 +
28 +}
29 +
modules_basic/avatar/profile.jsView
@@ -1,0 +1,80 @@
1 +var h = require('hyperscript')
2 +var pull = require('pull-stream')
3 +
4 +exports.needs = {
5 + avatar_image_link: 'first',
6 + avatar_action: 'map',
7 + avatar_edit: 'first',
8 + follows: 'first',
9 + followers: 'first'
10 +}
11 +
12 +exports.gives = 'avatar_profile'
13 +
14 +function streamToList(stream, el) {
15 + pull(
16 + stream,
17 + pull.drain(function (item) {
18 + if(item) el.appendChild(item)
19 + })
20 + )
21 + return el
22 +}
23 +
24 +exports.create = function (api) {
25 +
26 + function image_link (id) {
27 + return api.avatar_image_link(id, 'thumbnail')
28 + }
29 +
30 + return function (id) {
31 +
32 + var follows_el = h('div.profile__follows.wrap')
33 + var friends_el = h('div.profile__friendss.wrap')
34 + var followers_el = h('div.profile__followers.wrap')
35 + var a, b
36 +
37 + pull(api.follows(id), pull.unique(), pull.collect(function (err, ary) {
38 + a = ary || []; next()
39 + }))
40 + pull(api.followers(id), pull.unique(), pull.collect(function (err, ary) {
41 + b = ary || {}; next()
42 + }))
43 +
44 + function next () {
45 + if(!(a && b)) return
46 + var _c = [], _a = [], _b = []
47 +
48 + a.forEach(function (id) {
49 + if(!~b.indexOf(id)) _a.push(id)
50 + else _c.push(id)
51 + })
52 + b.forEach(function (id) {
53 + if(!~_c.indexOf(id)) _b.push(id)
54 + })
55 + function add (ary, el) {
56 + ary.forEach(function (id) { el.appendChild(image_link(id)) })
57 + }
58 +
59 + add(_a, follows_el)
60 + add(_c, friends_el)
61 + add(_b, followers_el)
62 + }
63 +
64 +
65 + return h('div.column.profile',
66 + api.avatar_edit(id),
67 + api.avatar_action(id),
68 + h('div.profile__relationships.column',
69 + h('strong', 'follows'),
70 + follows_el,
71 + h('strong', 'friends'),
72 + friends_el,
73 + h('strong', 'followers'),
74 + followers_el
75 + )
76 + )
77 + }
78 +
79 +}
80 +
modules_basic/avatar-image.jsView
@@ -1,117 +1,0 @@
1-'use strict'
2-var getAvatar = require('ssb-avatar')
3-var h = require('hyperscript')
4-var ref = require('ssb-ref')
5-var path = require('path')
6-var visualize = require('visualize-buffer')
7-
8-var pull = require('pull-stream')
9-
10-var self_id = require('../keys').id
11-
12-//var plugs = require('../plugs')
13-//var sbot_query = plugs.first(exports.sbot_query = [])
14-//var blob_url = require('../plugs').first(exports.blob_url = [])
15-//
16-
17-exports.needs = {
18- sbot_query: 'first',
19- blob_url: 'first'
20-}
21-
22-exports.gives = {
23- connection_status: true, avatar_image: true
24-}
25-
26-
27-function isFunction (f) {
28- return 'function' === typeof f
29-}
30-
31-
32-var ready = false
33-var waiting = []
34-
35-var last = 0
36-
37-var cache = {}
38-
39-exports.create = function (api) {
40- var avatars = {}
41-
42- //blah blah
43- return {
44- connection_status: function (err) {
45- if (err) return
46- pull(
47- api.sbot_query({
48- query: [{
49- $filter: {
50- timestamp: {$gt: last || 0 },
51- value: { content: {
52- type: "about",
53- about: {$prefix: "@"},
54- image: {link: {$prefix: "&"}}
55- }}
56- }},
57- {
58- $map: {
59- id: ["value", "content", "about"],
60- image: ["value", "content", "image", "link"],
61- by: ["value", "author"],
62- ts: 'timestamp'
63- }}],
64- live: true
65- }),
66- pull.drain(function (a) {
67- if(a.sync) {
68- ready = true
69- while(waiting.length) waiting.shift()()
70- return
71- }
72- last = a.ts
73- //set image for avatar.
74- //overwrite another avatar
75- //you picked.
76- if(
77- //if there is no avatar
78- (!avatars[a.id]) ||
79- //if i chose this avatar
80- (a.by == self_id) ||
81- //they chose their own avatar,
82- //and current avatar was not chosen by me
83- (a.by === a.id && avatars[a.id].by != self_id)
84- )
85- avatars[a.id] = a
86-
87- })
88- )
89- },
90-
91- avatar_image: function (author, classes) {
92- classes = classes || ''
93- if(classes && 'string' === typeof classes) classes = '.avatar--'+classes
94-
95- function gen (id) {
96- if(cache[id]) return h('img', {src: cache[id]})
97- var img = visualize(new Buffer(author.substring(1), 'base64'), 256)
98- cache[id] = img.src
99- return img
100- }
101-
102- var img = ready && avatars[author] ? h('img', {src: api.blob_url(avatars[author].image)}) : gen(author)
103-
104- ;(classes || '').split('.').filter(Boolean).forEach(function (c) {
105- img.classList.add(c)
106- })
107-
108- if(!ready)
109- waiting.push(function () {
110- if(avatars[author]) img.src = api.blob_url(avatars[author].image)
111- })
112-
113- return img
114- }
115- }
116-}
117-
modules_basic/avatar-link.jsView
@@ -1,22 +1,0 @@
1-var h = require('hyperscript')
2-
3-exports.needs = {signifier: 'first'}
4-
5-exports.gives = 'avatar_link'
6-
7-exports.create = function (api) {
8- return function (id, element) {
9-
10- var link = h('a.avatar', {href: "#"+id, title: id}, element)
11-
12- api.signifier(id, function (_, names) {
13- if(names.length)
14- link.title = names[0].name + '\n '+id
15- })
16-
17- return link
18- }
19-}
20-
21-
22-
modules_basic/avatar-name.jsView
@@ -1,29 +1,0 @@
1-
2-var signifier = require('../plugs').first(exports.signifier = [])
3-var h = require('hyperscript')
4-
5-exports.needs = { signifier: 'first' }
6-
7-exports.gives = 'avatar_name'
8-
9-exports.create = function (api) {
10-
11- return function name (id) {
12- var n = h('span', id ? id.substring(0, 10) : "")
13-
14- //choose the most popular name for this person.
15- //for anything like this you'll see I have used sbot.links2
16- //which is the ssb-links plugin. as you'll see the query interface
17- //is pretty powerful!
18- //TODO: "most popular" name is easily gameable.
19- //must come up with something better than this.
20-
21- api.signifier(id, function (_, names) {
22- if(names.length) n.textContent = names[0].name
23- })
24-
25- return n
26- }
27-
28-}
29-
modules_basic/avatar-profile.jsView
@@ -1,88 +1,0 @@
1-var h = require('hyperscript')
2-var pull = require('pull-stream')
3-
4-//var plugs = require('../plugs')
5-//var avatar_image_link = plugs.first(exports.avatar_image_link = [])
6-//var avatar_action = plugs.map(exports.avatar_action = [])
7-//var avatar_edit = plugs.first(exports.avatar_edit = [])
8-
9-//var follows = plugs.first(exports.follows = [])
10-//var followers = plugs.first(exports.followers = [])
11-//
12-exports.needs = {
13- avatar_image_link: 'first',
14- avatar_action: 'map',
15- avatar_edit: 'first',
16- follows: 'first',
17- followers: 'first'
18-}
19-
20-exports.gives = 'avatar_profile'
21-
22-function streamToList(stream, el) {
23- pull(
24- stream,
25- pull.drain(function (item) {
26- if(item) el.appendChild(item)
27- })
28- )
29- return el
30-}
31-
32-exports.create = function (api) {
33-
34- function image_link (id) {
35- return api.avatar_image_link(id, 'thumbnail')
36- }
37-
38- return function (id) {
39-
40- var follows_el = h('div.profile__follows.wrap')
41- var friends_el = h('div.profile__friendss.wrap')
42- var followers_el = h('div.profile__followers.wrap')
43- var a, b
44-
45- pull(api.follows(id), pull.unique(), pull.collect(function (err, ary) {
46- a = ary || []; next()
47- }))
48- pull(api.followers(id), pull.unique(), pull.collect(function (err, ary) {
49- b = ary || {}; next()
50- }))
51-
52- function next () {
53- if(!(a && b)) return
54- var _c = [], _a = [], _b = []
55-
56- a.forEach(function (id) {
57- if(!~b.indexOf(id)) _a.push(id)
58- else _c.push(id)
59- })
60- b.forEach(function (id) {
61- if(!~_c.indexOf(id)) _b.push(id)
62- })
63- function add (ary, el) {
64- ary.forEach(function (id) { el.appendChild(image_link(id)) })
65- }
66-
67- add(_a, follows_el)
68- add(_c, friends_el)
69- add(_b, followers_el)
70- }
71-
72-
73- return h('div.column.profile',
74- api.avatar_edit(id),
75- api.avatar_action(id),
76- h('div.profile__relationships.column',
77- h('strong', 'follows'),
78- follows_el,
79- h('strong', 'friends'),
80- friends_el,
81- h('strong', 'followers'),
82- followers_el
83- )
84- )
85- }
86-
87-}
88-
modules_basic/avatar.jsView
@@ -1,45 +1,0 @@
1-var h = require('hyperscript')
2-var u = require('../util')
3-
4-exports.needs = {
5- avatar_name: 'first',
6- avatar_image: 'first',
7- avatar_link: 'first'
8-}
9-
10-exports.gives = {
11- avatar: true,
12- avatar_image_name_link: true,
13- avatar_image_link: true,
14- avatar_name_link: true
15-}
16-
17-exports.create = function (api) {
18- return {
19- avatar,
20- avatar_image_name_link,
21- avatar_image_link,
22- avatar_name_link
23- }
24-
25- function avatar (author, classes) {
26- return exports.avatar_image_name_link(author, classes)
27- }
28-
29- function avatar_image_name_link (author, classes) {
30- return api.avatar_link(author, [
31- api.avatar_image(author, classes),
32- api.avatar_name(author)
33- ])
34- }
35-
36- function avatar_image_link (author, classes) {
37- return api.avatar_link(author, api.avatar_image(author, classes))
38- }
39-
40- function avatar_name_link (author, classes) {
41- return api.avatar_link(author, api.avatar_name(author))
42- }
43-}
44-
45-
modules_core/app.jsView
@@ -1,5 +1,4 @@
1-var plugs = require('../plugs')
21 var h = require('hyperscript')
32 var insertCss = require('insert-css')
43
54 module.exports = {
modules_core/index.jsView
@@ -1,17 +1,18 @@
11 module.exports = {
2-// "_screen_view.js": require('./_screen_view.js'),
3- "app.js": require('./app'),
4- "blob-url.js": require('./blob-url'),
5- "crypto.js": require('./crypto'),
6- "external-confirm.js": require('./external-confirm'),
7- "file-input.js": require('./file-input'),
8- "menu.js": require('./menu'),
9- message: {
10- confirm: require('./message/confirm')
2 + 'app': require('./app'),
3 + 'blob-url': require('./blob-url'),
4 + 'crypto': require('./crypto'),
5 + 'external-confirm': require('./external-confirm'),
6 + 'file-input': require('./file-input'),
7 + 'menu': require('./menu'),
8 + 'message': {
9 + 'confirm': require('./message/confirm')
1110 },
12- "tabs.js": require('./tabs'),
13- "sbot.js": require('./sbot'),
14- "styles.js": require('./styles'),
15- "style-mixins.js": require('./style-mixins')
11 + 'tabs': require('./tabs'),
12 + 'sbot': require('./sbot'),
13 + 'style': {
14 + 'styles': require('./style/styles'),
15 + 'mixins': require('./style/mixins')
16 + }
1617 }
1718
modules_core/menu.jsView
@@ -1,13 +1,12 @@
1-var plugs = require('../plugs')
21 var h = require('hyperscript')
32
43 module.exports = {
54 needs: {menu_items: 'map'},
65 gives: {connection_status: true, menu: true},
76 create: function (api) {
87
9- var menu_items = api.menu_items //plugs.map(exports.menu_items = [])
8 + var menu_items = api.menu_items
109
1110 var status = h('div.status.error') //start off disconnected
1211 var list = h('div.menu.column', {style: 'display: none;'})
1312
modules_core/tabs.jsView
@@ -10,15 +10,15 @@
1010 if(el.tagName !== 'A') return ancestor(el.parentElement)
1111 return el
1212 }
1313
14-//var plugs = require('../plugs')
15-//var screen_view = plugs.first(exports._screen_view = [])
16-//var search_box = plugs.first(exports.search_box = [])
17-//var menu = plugs.first(exports.menu = [])
14 +exports.needs = {
15 + screen_view: 'first',
16 + search_box: 'first',
17 + menu: 'first',
18 + 'external_confirm':'first'
19 +}
1820
19-exports.needs = {screen_view: 'first', search_box: 'first', menu: 'first', 'external_confirm':'first'}
20-
2121 exports.gives = 'screen_view'
2222
2323 exports.create = function (api) {
2424 return function (path) {
modules_core/style-mixins.jsView
@@ -1,22 +1,0 @@
1-
2-const mixins = `
3- $textPrimary {
4- color: #222
5- }
6-
7- $textSubtle {
8- color: gray
9- }
10-`
11-
12-module.exports = {
13- gives: {
14- mcss: true
15- },
16- create: function (api) {
17- return {
18- mcss: () => mixins
19- }
20- }
21-}
22-
modules_core/style/mixins.jsView
@@ -1,0 +1,22 @@
1 +
2 +const mixins = `
3 + $textPrimary {
4 + color: #222
5 + }
6 +
7 + $textSubtle {
8 + color: gray
9 + }
10 +`
11 +
12 +module.exports = {
13 + gives: {
14 + mcss: true
15 + },
16 + create: function (api) {
17 + return {
18 + mcss: () => mixins
19 + }
20 + }
21 +}
22 +
modules_core/style/styles.jsView
@@ -1,0 +1,34 @@
1 +var h = require('../../h')
2 +var compile = require('micro-css')
3 +var fs = require('fs')
4 +var Path = require('path')
5 +
6 +// TODO distribute these styles across all
7 +// the relevant modules, not as a core style.
8 +var coreStyle = fs.readFileSync(Path.join(__dirname, '../../style.css'))
9 +
10 +module.exports = {
11 + needs: {
12 + mcss: 'map',
13 + css: 'map'
14 + },
15 + gives: {
16 + mcss: true,
17 + css: true,
18 + styles: true
19 + },
20 + create: function (api) {
21 + var styles = ''
22 + process.nextTick(function () {
23 + var mcss = api.mcss().join('\n')
24 + var css = api.css().join('\n')
25 + styles = coreStyle + compile(mcss) + css
26 + })
27 + return {
28 + styles: function () { return styles },
29 + // export empty styles
30 + mcss: function () { return '' },
31 + css: function () { return '' }
32 + }
33 + }
34 +}
modules_core/styles.jsView
@@ -1,34 +1,0 @@
1-var h = require('../h')
2-var compile = require('micro-css')
3-var fs = require('fs')
4-var Path = require('path')
5-
6-// TODO distribute these styles across all
7-// the relevant modules, not as a core style.
8-var coreStyle = fs.readFileSync(Path.join(__dirname, '../style.css'))
9-
10-module.exports = {
11- needs: {
12- mcss: 'map',
13- css: 'map'
14- },
15- gives: {
16- mcss: true,
17- css: true,
18- styles: true
19- },
20- create: function (api) {
21- var styles = ''
22- process.nextTick(function () {
23- var mcss = api.mcss().join('\n')
24- var css = api.css().join('\n')
25- styles = coreStyle + compile(mcss) + css
26- })
27- return {
28- styles: function () { return styles },
29- // export empty styles
30- mcss: function () { return '' },
31- css: function () { return '' }
32- }
33- }
34-}
modules_embedded/index.jsView
@@ -1,11 +1,12 @@
11 module.exports = {
2- "_screen_view.js": require('../modules_core/_screen_view.js'),
3- "app.js": require('../modules_core/app.js'),
4- "blob-url.js": require('../modules_core/blob-url.js'),
5- "crypto.js": require('../modules_core/crypto.js'),
6- "file-input.js": require('../modules_core/file-input.js'),
7- "menu.js": require('../modules_core/menu.js'),
8- "message-confirm.js": require('../modules_core/message-confirm.js'),
9- "tabs.js": require('../modules_core/tabs.js'),
10- "sbot.js": require('./sbot.js')
2 + "_screen_view.": require('../modules_core/_screen_view.'),
3 + "app.": require('../modules_core/app.'),
4 + "blob-url.": require('../modules_core/blob-url.'),
5 + "crypto.": require('../modules_core/crypto.'),
6 + "file-input.": require('../modules_core/file-input.'),
7 + "menu.": require('../modules_core/menu.'),
8 + "message-confirm.": require('../modules_core/message-confirm.'),
9 + "tabs.": require('../modules_core/tabs.'),
10 + "sbot.": require('./sbot.')
1111 }
12 +
modules_extra/audio-mp3.jsView
@@ -4,14 +4,8 @@
44 var ref = require('ssb-ref');
55
66 //render a message
77
8-//var plugs = require('../plugs');
9-//var message_link = plugs.first(exports.message_link = []);
10-//var message_confirm = plugs.first(exports.message_confirm = []);
11-//var sbot_links = plugs.first(exports.sbot_links = []);
12-//var blob_url = plugs.first(exports.blob_url = []);
13-//
148 exports.needs = {
159 // message_link: 'first',
1610 // message_confirm: 'first',
1711 // sbot_links: 'first',
modules_extra/emoji.jsView
@@ -1,11 +1,7 @@
11 var emojis = require('emoji-named-characters')
22 var emojiNames = Object.keys(emojis)
33
4-//var plugs = require('../plugs')
5-//var blob_url = plugs.first(exports.blob_url = [])
6-//
7-
84 exports.needs = { blob_url: 'first' }
95 exports.gives = { emoji_names: true, emoji_url: true }
106
117 exports.create = function (api) {
modules_extra/git-ssb.jsView
@@ -2,13 +2,8 @@
22 var u = require('../util')
33 var pull = require('pull-stream')
44 var Scroller = require('pull-scroll')
55
6-//var plugs = require('../plugs')
7-//var message_render = plugs.first(exports.message_render = [])
8-//var message_compose = plugs.first(exports.message_compose = [])
9-//var sbot_log = plugs.first(exports.sbot_log = [])
10-
116 exports.needs = {
127 message_render: 'first',
138 message_compose: 'first',
149 sbot_log: 'first'
modules_extra/git.jsView
@@ -9,17 +9,8 @@
99 var getAvatar = require('ssb-avatar')
1010 var KVGraph = require('kvgraph')
1111 var mergeRepo = require('ssb-git/merge')
1212
13-//var plugs = require('../plugs')
14-//var message_link = plugs.first(exports.message_link = [])
15-//var message_confirm = plugs.first(exports.message_confirm = [])
16-//var message_compose = plugs.first(exports.message_compose = [])
17-//var sbot_links = plugs.first(exports.sbot_links = [])
18-//var sbot_links2 = plugs.first(exports.sbot_links2 = [])
19-//var sbot_get = plugs.first(exports.sbot_get = [])
20-//var avatar_name = plugs.first(exports.avatar_name = [])
21-//var markdown = plugs.first(exports.markdown = [])
2213
2314 exports.needs = {
2415 message_link: 'first',
2516 message_confirm: 'first',
modules_extra/index.jsView
@@ -1,23 +1,25 @@
11 module.exports = {
2- // "audio-mp3.js": require('./audio-mp3.js'),
3- "blob.js": require('./blob.js'),
4- "channel.js": require('./channel.js'),
5- "emoji.js": require('./emoji.js'),
6- "suggest-emoji.js": require('./suggest-emoji.js'),
7- "dns.js": require('./dns.js'),
8- "git.js": require('./git.js'),
9- "git-ssb.js": require('./git-ssb.js'),
10- "key.js": require('./key.js'),
11- "notifications.js": require('./notifications.js'),
12- "meta-image.js": require('./meta-image.js'),
13- "music-release-cc.js": require('./music-release-cc.js'),
14- "music-release.js": require('./music-release.js'),
15- "network.js": require('./network.js'),
16- "query.js": require('./query.js'),
17- "raw.js": require('./raw.js'),
18- "search.js": require('./search'),
19- "split.js": require('./split.js'),
20- "versions.js": require('./versions.js')
2 + // 'audio-mp3': require('./audio-mp3'),
3 + 'blob': require('./blob'),
4 + 'channel': require('./channel'),
5 + 'emoji': require('./emoji'),
6 + 'suggest-emoji': require('./suggest-emoji'),
7 + 'dns': require('./dns'),
8 + 'git': require('./git'),
9 + 'git-ssb': require('./git-ssb'),
10 + 'key': require('./key'),
11 + 'notifications': require('./notifications'),
12 + 'meta-image': require('./meta-image'),
13 + 'music': {
14 + 'release-cc': require('./music/release-cc'),
15 + 'release': require('./music/release')
16 + },
17 + 'network': require('./network'),
18 + 'query': require('./query'),
19 + 'raw': require('./raw'),
20 + 'search': require('./search'),
21 + 'split': require('./split'),
22 + 'versions': require('./versions')
2123 }
2224
2325
modules_extra/key.jsView
@@ -2,16 +2,12 @@
22 var u = require('../util')
33 var pull = require('pull-stream')
44 var Scroller = require('pull-scroll')
55
6-//var plugs = require('../plugs')
7-// var message_render = plugs.first(exports.message_render = [])
8-// var message_compose = plugs.first(exports.message_compose = [])
9-// var sbot_log = plugs.first(exports.sbot_log = [])
106
11-
127 exports.gives = {
13- menu_items: true, screen_view: true
8 + menu_items: true,
9 + screen_view: true
1410 }
1511
1612 exports.create = function (api) {
1713 return {
modules_extra/meta-image.jsView
@@ -4,14 +4,8 @@
44 var ref = require('ssb-ref');
55
66 //render a message
77
8-//var plugs = require('../plugs');
9-//var message_link = plugs.first(exports.message_link = []);
10-//var message_confirm = plugs.first(exports.message_confirm = []);
11-//var sbot_links = plugs.first(exports.sbot_links = []);
12-//var blob_url = plugs.first(exports.blob_url = []);
13-//
148 exports.needs = { blob_url: 'first' }
159 exports.gives = 'message_content'
1610
1711 exports.create = function (api) {
modules_extra/network.jsView
@@ -7,12 +7,8 @@
77 Struct, Value, Dict,
88 dictToCollection, map: mutantMap, when, computed
99 } = require('@mmckegg/mutant')
1010
11-//var avatar = plugs.first(exports.avatar = [])
12-//var sbot_gossip_peers = plugs.first(exports.sbot_gossip_peers = [])
13-//var sbot_gossip_connect = plugs.first(exports.sbot_gossip_connect = [])
14-
1511 exports.needs = {
1612 avatar_image_link: 'first',
1713 avatar_name_link: 'first',
1814 sbot_gossip_peers: 'first',
modules_extra/notifications.jsView
@@ -3,18 +3,11 @@
33 var u = require('../util')
44 var pull = require('pull-stream')
55 var Scroller = require('pull-scroll')
66 var paramap = require('pull-paramap')
7-var plugs = require('../plugs')
87 var cont = require('cont')
98 var ref = require('ssb-ref')
109
11-//var message_render = plugs.first(exports.message_render = [])
12-//var sbot_log = plugs.first(exports.sbot_log = [])
13-//var sbot_get = plugs.first(exports.sbot_get = [])
14-//var sbot_user_feed = plugs.first(exports.sbot_user_feed = [])
15-//var message_unbox = plugs.first(exports.message_unbox = [])
16-
1710 exports.needs = {
1811 message_render: 'first',
1912 sbot_log: 'first',
2013 sbot_get: 'first',
modules_extra/query.jsView
@@ -1,10 +1,8 @@
11 var h = require('hyperscript')
22 var pull = require('pull-stream')
33 var HJSON = require('hjson')
44
5-//var sbot_query = require('../plugs').first(exports.sbot_query = [])
6-
75 exports.needs = { sbot_query: 'first' }
86
97 exports.gives = {
108 menu_items: true,
modules_extra/raw.jsView
@@ -2,12 +2,8 @@
22 var u = require('../util')
33 var pull = require('pull-stream')
44 var Scroller = require('pull-scroll')
55
6-var plugs = require('../plugs')
7-//var message_render = plugs.first(exports.message_render = [])
8-//var message_compose = plugs.first(exports.message_compose = [])
9-
106 // from ssb-ref
117 var refRegex = /((?:@|%|&)[A-Za-z0-9\/+]{43}=\.[\w\d]+)/g
128
139 exports.gives = 'message_meta'
modules_extra/search.jsView
@@ -3,12 +3,8 @@
33 var pull = require('pull-stream')
44 var Scroller = require('pull-scroll')
55 var TextNodeSearcher = require('text-node-searcher')
66
7-//var plugs = require('../plugs')
8-//var message_render = plugs.first(exports.message_render = [])
9-//var sbot_log = plugs.first(exports.sbot_log = [])
10-
117 exports.needs = {
128 message_render: 'first',
139 sbot_log: 'first'
1410 }
modules_extra/split.jsView
@@ -1,10 +1,6 @@
11 var h = require('hyperscript')
22
3-//var screen_view =
4-// require('../plugs').first(exports._screen_view = [])
5-
6-
73 exports.needs = {
84 screen_view: 'first'
95 }
106
modules_extra/suggest-emoji.jsView
@@ -1,7 +1,4 @@
1-//var plugs = require('../plugs')
2-//var emoji_url = plugs.first(exports.emoji_url = [])
3-//var emoji_names = plugs.first(exports.emoji_names = [])
41
52 exports.needs = {
63 emoji_url: 'first',
74 emoji_names: 'first'
modules_extra/music-release-cc.jsView
@@ -1,87 +1,0 @@
1-var markdown = require('ssb-markdown');
2-var h = require('hyperscript');
3-var u = require('../util');
4-var ref = require('ssb-ref');
5-
6-//render a message
7-
8-//var plugs = require('../plugs');
9-//var message_link = plugs.first(exports.message_link = []);
10-//var message_confirm = plugs.first(exports.message_confirm = []);
11-//var sbot_links = plugs.first(exports.sbot_links = []);
12-//var blob_url = plugs.first(exports.blob_url = []);
13-//
14-
15-exports.needs = { blob_url: 'first' }
16-exports.gives = 'message_content'
17-
18-exports.create = function (api) {
19- return function(msg, sbot) {
20- if (msg.value.content.type !== 'music-release-cc')
21- return;
22-
23- var tracks = msg.value.content.tracks;
24- return h('div',
25- h('img', { "src" : api.blob_url(msg.value.content.cover) }),
26- h('h1', msg.value.content.title),
27- h('ol',
28- Object.keys(tracks).map(function(k) {
29- var t = tracks[k];
30- return h('li', t.fname,
31- h("br"),
32- h('audio', {
33- "controls" : true,
34- "src" : api.blob_url(t.link)
35- }))
36- })),
37- h('p',
38- "More info:", h('a', { href : msg.value.content.archivedotorg }, "archive.org"),
39- h("br"),
40- "License:", h('a', { href : msg.value.content.license }, "Link")))
41- }
42-}
43-
44-// copied from like.js
45-
46-// inspiration for waveform range selection
47-
48-// idea: handout invite codes for upload of tracks to be cached by the pub
49-
50-// exports.message_meta = function (msg, sbot) {
51-
52-// var yupps = h('a')
53-
54-// pull(
55-// sbot_links({dest: msg.key, rel: 'vote'}),
56-// pull.collect(function (err, votes) {
57-// if(votes.length === 1)
58-// yupps.textContent = ' 1 yup'
59-// if(votes.length)
60-// yupps.textContent = ' ' + votes.length + ' yupps'
61-// })
62-// )
63-
64-// return yupps
65-// }
66-
67-// exports.message_action = function (msg, sbot) {
68-// if(msg.value.content.type !== 'vote')
69-// return h('a', {href: '#', onclick: function () {
70-// var yup = {
71-// type: 'vote',
72-// vote: { link: msg.key, value: 1, expression: 'yup' }
73-// }
74-// if(msg.value.content.recps) {
75-// yup.recps = msg.value.content.recps.map(function (e) {
76-// return e && typeof e !== 'string' ? e.link : e
77-// })
78-// yup.private = true
79-// }
80-// //TODO: actually publish...
81-
82-// message_confirm(yup)
83-// }}, 'yup')
84-
85-// }
86-
87-
modules_extra/music/release-cc.jsView
@@ -1,0 +1,87 @@
1 +var markdown = require('ssb-markdown');
2 +var h = require('hyperscript');
3 +var u = require('../../util');
4 +var ref = require('ssb-ref');
5 +
6 +//render a message
7 +
8 +exports.needs = {
9 + blob_url: 'first'
10 +}
11 +
12 +exports.gives = 'message_content'
13 +
14 +exports.create = function (api) {
15 + return function(msg, sbot) {
16 + if (msg.value.content.type !== 'music-release-cc')
17 + return;
18 +
19 + var tracks = msg.value.content.tracks;
20 + return h('div',
21 + h('img', { "src" : api.blob_url(msg.value.content.cover) }),
22 + h('h1', msg.value.content.title),
23 + h('ol',
24 + Object.keys(tracks).map(function(k) {
25 + var t = tracks[k];
26 + return h('li', t.fname,
27 + h("br"),
28 + h('audio', {
29 + "controls" : true,
30 + "src" : api.blob_url(t.link)
31 + })
32 + )
33 + })
34 + ),
35 + h('p',
36 + "More info:", h('a', { href : msg.value.content.archivedotorg }, "archive.org"),
37 + h("br"),
38 + "License:", h('a', { href : msg.value.content.license }, "Link")
39 + )
40 + )
41 + }
42 +}
43 +
44 +// copied from like.js
45 +
46 +// inspiration for waveform range selection
47 +
48 +// idea: handout invite codes for upload of tracks to be cached by the pub
49 +
50 +// exports.message_meta = function (msg, sbot) {
51 +
52 +// var yupps = h('a')
53 +
54 +// pull(
55 +// sbot_links({dest: msg.key, rel: 'vote'}),
56 +// pull.collect(function (err, votes) {
57 +// if(votes.length === 1)
58 +// yupps.textContent = ' 1 yup'
59 +// if(votes.length)
60 +// yupps.textContent = ' ' + votes.length + ' yupps'
61 +// })
62 +// )
63 +
64 +// return yupps
65 +// }
66 +
67 +// exports.message_action = function (msg, sbot) {
68 +// if(msg.value.content.type !== 'vote')
69 +// return h('a', {href: '#', onclick: function () {
70 +// var yup = {
71 +// type: 'vote',
72 +// vote: { link: msg.key, value: 1, expression: 'yup' }
73 +// }
74 +// if(msg.value.content.recps) {
75 +// yup.recps = msg.value.content.recps.map(function (e) {
76 +// return e && typeof e !== 'string' ? e.link : e
77 +// })
78 +// yup.private = true
79 +// }
80 +// //TODO: actually publish...
81 +
82 +// message_confirm(yup)
83 +// }}, 'yup')
84 +
85 +// }
86 +
87 +
modules_extra/music/release.jsView
@@ -1,0 +1,43 @@
1 +var markdown = require('ssb-markdown');
2 +var h = require('hyperscript');
3 +var u = require('../../util');
4 +var ref = require('ssb-ref');
5 +
6 +//render a message
7 +
8 +exports.gives = 'message_content'
9 +
10 +exports.create = function () {
11 +
12 + return function(msg, sbot) {
13 + if (msg.value.content.type !== 'music-release')
14 + return;
15 +
16 + var v = msg.value.content;
17 + return h('div', [
18 + // h('img', { "src" : "http://localhost:7777/" + encodeURIComponent(v.cover) }),
19 + h('h1', v.Title),
20 + h("p", v.Description),
21 + h("dl", [
22 + h("dt", "Creator"),
23 + h("dd", v.Creator),
24 +
25 + h("dt", "Identifier"),
26 + h("dd", v.Identifier),
27 +
28 + h("dt", "Published"),
29 + h("dd", v.Publicdate),
30 +
31 + h("dt", "Runtime"),
32 + h("dd", v.Runtime),
33 +
34 + h("dt", "Source"),
35 + h("dd", v.Source),
36 +
37 + h("dt", "License"),
38 + h("dd", h('a', { href : v.Licenseurl }, "Link"))
39 + ])
40 + ])
41 + }
42 +}
43 +
modules_extra/music-release.jsView
@@ -1,46 +1,0 @@
1-var markdown = require('ssb-markdown');
2-var h = require('hyperscript');
3-var u = require('../util');
4-var ref = require('ssb-ref');
5-
6-//render a message
7-
8-//var plugs = require('../plugs');
9-//var message_link = plugs.first(exports.message_link = []);
10-//var message_confirm = plugs.first(exports.message_confirm = []);
11-//var sbot_links = plugs.first(exports.sbot_links = []);
12-//
13-exports.gives = 'message_content'
14-
15-exports.create = function () {
16-
17- return function(msg, sbot) {
18- if (msg.value.content.type !== 'music-release')
19- return;
20-
21- var v = msg.value.content;
22- return h('div',
23- // h('img', { "src" : "http://localhost:7777/" + encodeURIComponent(v.cover) }),
24- h('h1', v.Title),
25- h("p", v.Description),
26- h("dl",
27-
28- h("dt", "Creator"),
29- h("dd", v.Creator),
30-
31- h("dt", "Identifier"),
32- h("dd", v.Identifier),
33-
34- h("dt", "Published"),
35- h("dd", v.Publicdate),
36-
37- h("dt", "Runtime"),
38- h("dd", v.Runtime),
39-
40- h("dt", "Source"),
41- h("dd", v.Source),
42-
43- h("dt", "License"),
44- h("dd", h('a', { href : v.Licenseurl }, "Link"))))
45- }
46-}

Built with git-ssb-web