Commit 1d2a8b5a23e6c1810b78b10c60f7c1a05c9d76ae
get cyphertunes working
Dominic Tarr committed on 7/25/2016, 6:25:33 AMParent: 0421b743029a777a497ace8139b0c5f576195292
Parent: 1a2e89c1945e9b2330e4834a9e544adbc12b171d
Files changed
.gitignore | changed |
modules/index.js | changed |
modules/suggest-mentions.js | changed |
modules/audio-mp3.js | added |
modules/meta-image.js | added |
modules/music-release-cc.js | added |
modules/music-release.js | added |
package.json | changed |
modules/index.js | ||
---|---|---|
@@ -1,8 +1,9 @@ | ||
1 | 1 | module.exports = { |
2 | 2 | "_screen_view.js": require('./_screen_view.js'), |
3 | 3 | "about.js": require('./about.js'), |
4 | 4 | "avatar-edit.js": require('./avatar-edit.js'), |
5 | + "audio-mp3.js": require('./audio-mp3.js'), | |
5 | 6 | "avatar-image.js": require('./avatar-image.js'), |
6 | 7 | "avatar-profile.js": require('./avatar-profile.js'), |
7 | 8 | "avatar.js": require('./avatar.js'), |
8 | 9 | "blob-url.js": require('./blob-url.js'), |
@@ -20,8 +21,11 @@ | ||
20 | 21 | "message-confirm.js": require('./message-confirm.js'), |
21 | 22 | "message-link.js": require('./message-link.js'), |
22 | 23 | "message-name.js": require('./message-name.js'), |
23 | 24 | "message.js": require('./message.js'), |
25 | + "meta-image.js": require('./meta-image.js'), | |
26 | + "music-release-cc.js": require('./music-release-cc.js'), | |
27 | + "music-release.js": require('./music-release.js'), | |
24 | 28 | "names.js": require('./names.js'), |
25 | 29 | "notifications.js": require('./notifications.js'), |
26 | 30 | "post.js": require('./post.js'), |
27 | 31 | "private.js": require('./private.js'), |
@@ -37,4 +41,7 @@ | ||
37 | 41 | } |
38 | 42 | |
39 | 43 | |
40 | 44 | |
45 | + | |
46 | + | |
47 | + |
modules/suggest-mentions.js | ||
---|---|---|
@@ -4,8 +4,9 @@ | ||
4 | 4 | return /\.(gif|jpg|png|svg)$/i.test(filename) |
5 | 5 | } |
6 | 6 | |
7 | 7 | var sbot_links2 = require('../plugs').first(exports.sbot_links2 = []) |
8 | +var blob_url = require('../plugs').first(exports.blob_url = []) | |
8 | 9 | |
9 | 10 | exports.suggest = cont.to(function (word, cb) { |
10 | 11 | if(!/^[@%&!]/.test(word[0])) return cb() |
11 | 12 | if(word.length < 2) return cb() |
@@ -32,12 +33,13 @@ | ||
32 | 33 | return { |
33 | 34 | title: e.name + ': ' + e.id.substring(0,10)+' ('+e.rank+')', |
34 | 35 | value: embed+'['+e.name+']('+e.id+')', |
35 | 36 | rank: e.rank, |
36 | - image: isImage(e.name) ? 'http://localhost:7777/'+e.id : undefined | |
37 | + image: isImage(e.name) ? blob_url(e.id) : undefined | |
37 | 38 | } |
38 | 39 | }) |
39 | 40 | cb(null, ary) |
40 | 41 | }) |
41 | 42 | ) |
42 | 43 | }) |
43 | 44 | |
45 | + |
modules/audio-mp3.js | ||
---|---|---|
@@ -1,0 +1,51 @@ | ||
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 | +exports.message_content = function(msg, sbot) { | |
15 | + if (msg.value.content.type !== 'audio-mp3') | |
16 | + return; | |
17 | + | |
18 | + var v = msg.value.content; | |
19 | + return h('div', | |
20 | + h('h2', "(" + v.Track + ") " + v.Title), | |
21 | + // h('img', { "src" : blob_url(v.cover) }), | |
22 | + h('audio', { | |
23 | + "controls" : true, | |
24 | + "src" : blob_url(v.link) | |
25 | + })) | |
26 | + // h('dl', | |
27 | + // Object.keys(v).map(function(k) { | |
28 | + // return [ | |
29 | + // h("dt", k), | |
30 | + // h("dd", v[k]), | |
31 | + // ] | |
32 | + // }))) | |
33 | + | |
34 | + // "Album": "the fall of", | |
35 | + // "Crc32": "038becab", | |
36 | + // "Creator": "bleupulp", | |
37 | + // "Format": "VBR MP3", | |
38 | + // "Height": "0", | |
39 | + // "Length": "375.23", | |
40 | + // "Md5": "2c517c8e813da5f940c8c7e77d4b7f3f", | |
41 | + // "Mtime": "1399498698", | |
42 | + // "Name": "2_bleupulp_-_clouds.mp3", | |
43 | + // "Sha1": "9f6a96a3d5571ed1ec2a7da38ffebdcd5f181482", | |
44 | + // "Size": "15009000", | |
45 | + | |
46 | + // "Title": "clouds", | |
47 | + // "Track": "2", | |
48 | + // "Width": "0", | |
49 | + | |
50 | +} | |
51 | + |
modules/meta-image.js | ||
---|---|---|
@@ -1,0 +1,48 @@ | ||
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 | +exports.message_content = function(msg, sbot) { | |
15 | + if (msg.value.content.type !== 'meta-image') | |
16 | + return; | |
17 | + | |
18 | + var v = msg.value.content; | |
19 | + return h('div', | |
20 | + // h('h2', "(" + v.Track + ") " + v.Title), | |
21 | + h('img', { "src" : blob_url(v.link) })) | |
22 | + | |
23 | + // h('dl', | |
24 | + // Object.keys(v).map(function(k) { | |
25 | + // return [ | |
26 | + // h("dt", k), | |
27 | + // h("dd", v[k]), | |
28 | + // ] | |
29 | + // }))) | |
30 | + | |
31 | + // "Album": "the fall of", | |
32 | + // "Crc32": "038becab", | |
33 | + // "Creator": "bleupulp", | |
34 | + // "Format": "VBR MP3", | |
35 | + // "Height": "0", | |
36 | + // "Length": "375.23", | |
37 | + // "Md5": "2c517c8e813da5f940c8c7e77d4b7f3f", | |
38 | + // "Mtime": "1399498698", | |
39 | + // "Name": "2_bleupulp_-_clouds.mp3", | |
40 | + // "Sha1": "9f6a96a3d5571ed1ec2a7da38ffebdcd5f181482", | |
41 | + // "Size": "15009000", | |
42 | + | |
43 | + // "Title": "clouds", | |
44 | + // "Track": "2", | |
45 | + // "Width": "0", | |
46 | + | |
47 | +} | |
48 | + |
modules/music-release-cc.js | ||
---|---|---|
@@ -1,0 +1,80 @@ | ||
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 | +exports.message_content = function(msg, sbot) { | |
15 | + if (msg.value.content.type !== 'music-release-cc') | |
16 | + return; | |
17 | + | |
18 | + var tracks = msg.value.content.tracks; | |
19 | + return h('div', | |
20 | + h('img', { "src" : blob_url(msg.value.content.cover) }), | |
21 | + h('h1', msg.value.content.title), | |
22 | + h('ol', | |
23 | + Object.keys(tracks).map(function(k) { | |
24 | + var t = tracks[k]; | |
25 | + return h('li', t.fname, | |
26 | + h("br"), | |
27 | + h('audio', { | |
28 | + "controls" : true, | |
29 | + "src" : blob_url(t.link) | |
30 | + })) | |
31 | + })), | |
32 | + h('p', | |
33 | + "More info:", h('a', { href : msg.value.content.archivedotorg }, "archive.org"), | |
34 | + h("br"), | |
35 | + "License:", h('a', { href : msg.value.content.license }, "Link"))) | |
36 | +} | |
37 | + | |
38 | +// copied from like.js | |
39 | + | |
40 | +// inspiration for waveform range selection | |
41 | + | |
42 | +// idea: handout invite codes for upload of tracks to be cached by the pub | |
43 | + | |
44 | +// exports.message_meta = function (msg, sbot) { | |
45 | + | |
46 | +// var yupps = h('a') | |
47 | + | |
48 | +// pull( | |
49 | +// sbot_links({dest: msg.key, rel: 'vote'}), | |
50 | +// pull.collect(function (err, votes) { | |
51 | +// if(votes.length === 1) | |
52 | +// yupps.textContent = ' 1 yup' | |
53 | +// if(votes.length) | |
54 | +// yupps.textContent = ' ' + votes.length + ' yupps' | |
55 | +// }) | |
56 | +// ) | |
57 | + | |
58 | +// return yupps | |
59 | +// } | |
60 | + | |
61 | +// exports.message_action = function (msg, sbot) { | |
62 | +// if(msg.value.content.type !== 'vote') | |
63 | +// return h('a', {href: '#', onclick: function () { | |
64 | +// var yup = { | |
65 | +// type: 'vote', | |
66 | +// vote: { link: msg.key, value: 1, expression: 'yup' } | |
67 | +// } | |
68 | +// if(msg.value.content.recps) { | |
69 | +// yup.recps = msg.value.content.recps.map(function (e) { | |
70 | +// return e && typeof e !== 'string' ? e.link : e | |
71 | +// }) | |
72 | +// yup.private = true | |
73 | +// } | |
74 | +// //TODO: actually publish... | |
75 | + | |
76 | +// message_confirm(yup) | |
77 | +// }}, 'yup') | |
78 | + | |
79 | +// } | |
80 | + |
modules/music-release.js | ||
---|---|---|
@@ -1,0 +1,41 @@ | ||
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.message_content = function(msg, sbot) { | |
14 | + if (msg.value.content.type !== 'music-release') | |
15 | + return; | |
16 | + | |
17 | + var v = msg.value.content; | |
18 | + return h('div', | |
19 | + // h('img', { "src" : "http://localhost:7777/" + encodeURIComponent(v.cover) }), | |
20 | + h('h1', v.Title), | |
21 | + h("p", v.Description), | |
22 | + h("dl", | |
23 | + | |
24 | + h("dt", "Creator"), | |
25 | + h("dd", v.Creator), | |
26 | + | |
27 | + h("dt", "Identifier"), | |
28 | + h("dd", v.Identifier), | |
29 | + | |
30 | + h("dt", "Published"), | |
31 | + h("dd", v.Publicdate), | |
32 | + | |
33 | + h("dt", "Runtime"), | |
34 | + h("dd", v.Runtime), | |
35 | + | |
36 | + h("dt", "Source"), | |
37 | + h("dd", v.Source), | |
38 | + | |
39 | + h("dt", "License"), | |
40 | + h("dd", h('a', { href : v.Licenseurl }, "Link")))) | |
41 | +} |
Built with git-ssb-web