Files: 07678ab95020edf09925a491966765d79e086d0e / modules_extra / blob.js
556 bytesRaw
1 | const fs = require('fs') |
2 | const h = require('../h') |
3 | const ref = require('ssb-ref') |
4 | |
5 | exports.needs = { |
6 | blob_url: 'first' |
7 | } |
8 | |
9 | exports.gives = { |
10 | 'screen_view': true, |
11 | 'mcss': true |
12 | } |
13 | |
14 | exports.create = (api) => { |
15 | return { |
16 | screen_view, |
17 | mcss: () => fs.readFileSync(__filename.replace(/js$/, 'mcss'), 'utf8') |
18 | } |
19 | |
20 | function screen_view (path) { |
21 | if(!ref.isBlob(path)) return |
22 | |
23 | return h('Blob', { id: path, title: path.slice(0, 9) + '...' }, [ |
24 | h('iframe', { |
25 | src: api.blob_url(path), |
26 | sandbox: '' |
27 | }) |
28 | ]) |
29 | } |
30 | } |
31 | |
32 |
Built with git-ssb-web