Files: 70fb8c8a016f2f59cb6933d6505c3d65dd426581 / router / html / page / blob.js
494 bytesRaw
1 | const nest = require('depnest') |
2 | const ref = require('ssb-ref') |
3 | const { h } = require('mutant') |
4 | |
5 | exports.gives = nest('router.html.page') |
6 | |
7 | exports.needs = nest('blob.sync.url', 'first') |
8 | |
9 | exports.create = (api) => { |
10 | return nest('router.html.page', blobView) |
11 | |
12 | function blobView (path) { |
13 | if (!ref.isBlob(path)) return |
14 | |
15 | return h('Blob', { id: path, title: path.slice(0, 9) + '...' }, [ |
16 | h('iframe', { |
17 | src: api.blob.sync.url(path), |
18 | sandbox: '' |
19 | }) |
20 | ]) |
21 | } |
22 | } |
23 | |
24 |
Built with git-ssb-web