git ssb

0+

mixmix / scuttle-blog



Tree: e3887a34e8e4f6b4cbc0d1d1b0e549b50157b48c

Files: e3887a34e8e4f6b4cbc0d1d1b0e549b50157b48c / obs / get.js

588 bytesRaw
1const { Struct, Value } = require('mutant')
2const fetch = require('../../async/fetch')
3
4module.exports = function (server) {
5 return function get (blog) {
6 fetch(blog, (err, success)
7 if (!isBlog(blog)) return cb(`Not a valid blog ${JSON.stringify(blog, null, 2)}`)
8
9 server.blobs.want(getBlob(blog), (err, success) => {
10 if (err) throw err
11
12 if (success) cb(null, success)
13 else cb(null, 'Could not fetch blog content')
14 })
15 }
16}
17
18function getBlob (msg) {
19 if (msg.value.content && msg.value.content.content) return obj.value.content
20
21 return obj
22}
23
24

Built with git-ssb-web