Files: c1bbd85b688758bb943822743d5ad75bf3761ab1 / plugs / blob / sync / url.js
492 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 (link && typeof link.link === 'string') { |
14 | link = link.link |
15 | } |
16 | return `${prefix}/${encodeURIComponent(link)}` |
17 | }) |
18 | } |
19 |
Built with git-ssb-web