Files: 537b91ef87e630bc0e11a6cfe5ec069de206286c / plugs / blob / sync / url.js
484 bytesRaw
1 | var nest = require('depnest') |
2 | |
3 | exports.needs = nest({ |
4 | 'config.sync.load': 'first' |
5 | }) |
6 | |
7 | exports.gives = nest('blob.sync.url') |
8 | |
9 | exports.create = function (api) { |
10 | return nest('blob.sync.url', function (link) { |
11 | var config = api.config.sync.load() |
12 | var prefix = config.blobsPrefix != null ? config.blobsPrefix : `http://localhost:${config.blobsPort}` |
13 | if (typeof link.link === 'string') { |
14 | link = link.link |
15 | } |
16 | return `${prefix}/${encodeURIComponent(link)}` |
17 | }) |
18 | } |
19 |
Built with git-ssb-web