git ssb

16+

Dominic / patchbay



Tree: 86ea5da17a73751facaa9e0d8540e9877b49f402

Files: 86ea5da17a73751facaa9e0d8540e9877b49f402 / modules_extra / blob.js

556 bytesRaw
1const fs = require('fs')
2const h = require('../h')
3const ref = require('ssb-ref')
4
5exports.needs = {
6 blob_url: 'first'
7}
8
9exports.gives = {
10 'screen_view': true,
11 'mcss': true
12}
13
14exports.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