const nest = require('depnest') const ref = require('ssb-ref') const { h } = require('mutant') exports.gives = nest('app.html.page') exports.needs = nest('blob.sync.url', 'first') exports.create = (api) => { return nest('app.html.page', blobView) 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: '' }) ]) } }