git ssb

7+

dinoworm 🐛 / patchcore



Commit 25e2fb0669e059599ae9e87eedd209517a3a7efa

use ssb-ref fork to support secret blobs

Matt McKegg committed on 4/13/2018, 10:30:56 AM
Parent: a61f3a4f15d549be32ee33146be221e1f525cea3

Files changed

message/html/markdown.jschanged
package.jsonchanged
message/html/markdown.jsView
@@ -3,8 +3,9 @@
33 const ref = require('ssb-ref')
44 const nest = require('depnest')
55 var htmlEscape = require('html-escape')
66 var watch = require('mutant/watch')
7 +const querystring = require('querystring');
78
89 exports.needs = nest({
910 'blob.sync.url': 'first',
1011 'blob.obs.has': 'first',
@@ -45,17 +46,15 @@
4546 : api.emoji.sync.url(emoji)
4647 return renderEmoji(emoji, url)
4748 },
4849 toUrl: (id) => {
49- if (id.startsWith('&')) {
50- var url = api.blob.sync.url(id)
51-
52- if (typeLookup[id]) {
53- var separator = url.includes('?') ? '&' : '?'
54- url += separator + 'contentType=' + escape(typeLookup[id])
55- }
56-
57- return url
50 + if (ref.isBlob(id)) {
51 + var blob = ref.parseBlob(id)
52 + var url = api.blob.sync.url(blob.id)
53 + var query = {}
54 + if (blob.key) query['unbox'] = blob.key + '.boxs'
55 + if (typeLookup[blob.id]) query['contentType'] = typeLookup[blob.id]
56 + return url + '?' + querystring.stringify(query)
5857 }
5958 if (mentions[id]) {
6059 return mentions[id]
6160 } else if (ref.isLink(id) || id.startsWith('#') || id.startsWith('?')) {
package.jsonView
@@ -58,9 +58,9 @@
5858 "ssb-feed": "^2.3.0",
5959 "ssb-friends": "^2.2.3",
6060 "ssb-keys": "^7.0.9",
6161 "ssb-markdown": "^3.3.1",
62- "ssb-ref": "^2.9.0",
62 + "ssb-ref": "github:ssbc/ssb-ref#secret-blobs",
6363 "ssb-sort": "^1.0.0",
6464 "xtend": "^4.0.1"
6565 },
6666 "browserify": {

Built with git-ssb-web