git ssb

0+

ev / 0qc



Tree: 231a81f9e0adf80fa3566be93221cf1f5158fcb6

Files: 231a81f9e0adf80fa3566be93221cf1f5158fcb6 / config.js

739 bytesRaw
1var http = require('http')
2
3module.exports = function () {
4 //var host = window.location.origin
5
6 var host = 'http://localhost:8989'
7
8 function getConfig () {
9 http.get(host + '/get-config', function (res) {
10 res.on('data', function (data, remote) {
11 var config = data
12 localStorage[host] = config
13 })
14 })
15 }
16
17 if (localStorage[host]) {
18 var config = JSON.parse(localStorage[host])
19 getConfig()
20 } else {
21 getConfig()
22 setTimeout(function () {
23 location.reload()
24 }, 1000)
25 }
26
27 config.blobsUrl = host + '/blobs/get/'
28 config.emojiUrl = host + '/img/emoji/'
29
30 if (config.ws.remote)
31 config.remote = config.ws.remote
32 else
33 config.remote = config.address
34
35 return config
36}
37

Built with git-ssb-web