Files: 5ed0ef75a42972670b29aada99be810a8bde7b80 / config.js
774 bytesRaw
1 | |
2 | var URL = require('url') |
3 | |
4 | module.exports = function () { |
5 | var remote = 'undefined' === typeof localStorage |
6 | ? null //'ws://localhost:8989~shs:' + require('./keys') |
7 | : localStorage.remote |
8 | |
9 | |
10 | //TODO: use _several_ remotes, so if one goes down, |
11 | // you can still communicate via another... |
12 | // also, if a blob does not load, use another pub... |
13 | |
14 | //if we are the light client, get our blobs from the same domain. |
15 | var blobsUrl |
16 | if(remote) { |
17 | var r = URL.parse(remote.split('~')[0]) |
18 | //this will work for ws and wss. |
19 | r.protocol = r.protocol.replace('ws', 'http') |
20 | r.pathname = '/blobs/get' |
21 | blobsUrl = URL.format(r) |
22 | } |
23 | else |
24 | blobsUrl = 'http://localhost:8989/blobs/get' |
25 | |
26 | return { |
27 | remote: remote, |
28 | blobsUrl: blobsUrl |
29 | } |
30 | } |
31 | |
32 | |
33 |
Built with git-ssb-web