Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
content.mentions.forEach(function (mention) {
if(ref.isBlob(mention.link)) {
sbot.blobs.push(mention.link, function (err) {
if(err) console.error(err)
})
}
})
getAvatar({links: api.sbot_links}, self_id, id, (err, _avatar) => {
if (err) return console.error(err)
//don't show user has already selected an avatar.
if(ref.isBlob(_avatar.image))
avatar.original.set(api.blob_url(_avatar.image))
})
content.mentions.forEach((mention: any) => {
if (Ref.isBlob(mention.link)) {
sbot.blobs.push(mention.link, (err: any) => {
if (err) console.error(err);
});
}
});
}
publish(content: NonNullable<content>, cb: Callback) {
if (content.recps) {
content = ssbKeys.box(
content,
content.recps.map((e: any) => {
return Ref.isFeed(e) ? e : e.link;
}),
);
} else if ((content as PostContent).mentions) {
for (const mention of (content as PostContent).mentions!) {
if (Ref.isBlob(mention.link)) {
ssb.blobs.push(mention.link, (err: any) => {
if (err) console.error(err);
});
}
}
}
ssb.publish(content, (err: any, msg: any) => {
if (err) console.error(err);
if (cb) cb(err, msg);
});
},
</content>
blobId: function (v) {
if (!ref.isBlob(v))
return 'type'
},
toUrl: function (id) {
if(ref.isBlob(id)) return api.blob_url(id)
return '#'+(mentions[id]?mentions[id]:id)
}
})
function(value) {
if (!ref.isBlob(value)) return
return h('a', {href: `${config.blobsRoot}/${value}`}, value)
},
ho.basic()
traverse(kv.value.content || {}).forEach( function(v) {
if (ref.isBlob(v)) {
let blob = v
let newBlob = !knownBlobs.has(blob)
if (newBlob) {
knownBlobs.add(blob)
refs++
updateStuff()
if (!sizeObs[blob]) {
sizeObs[blob] = Value('...')
if (blobsLs.includes(blob)) {
getSize(blob)
} else {
sizeObs[blob].set('wanted ...')
ssb.blobs.want(blob, err => {
if (err) return sizeObs[blob].set(err.message)
function blobView (path) {
if (!ref.isBlob(path)) return
return h('Blob', { id: path, title: path.slice(0, 9) + '...' }, [
h('iframe', {
src: api.blob.sync.url(path),
sandbox: ''
})
])
}
}