forked from ssbc/patchbay
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.js
More file actions
32 lines (24 loc) · 774 Bytes
/
config.js
File metadata and controls
32 lines (24 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var URL = require('url')
module.exports = function () {
var remote = 'undefined' === typeof localStorage
? null //'ws://localhost:8989~shs:' + require('./keys')
: localStorage.remote
//TODO: use _several_ remotes, so if one goes down,
// you can still communicate via another...
// also, if a blob does not load, use another pub...
//if we are the light client, get our blobs from the same domain.
var blobsUrl
if(remote) {
var r = URL.parse(remote.split('~')[0])
//this will work for ws and wss.
r.protocol = r.protocol.replace('ws', 'http')
r.pathname = '/blobs/get'
blobsUrl = URL.format(r)
}
else
blobsUrl = 'http://localhost:8989/blobs/get'
return {
remote: remote,
blobsUrl: blobsUrl
}
}