git ssb

0+

ev / gitmx



Tree: b3bdb4f23168852c91700c8b3e7a474dc7b7eb2c

Files: b3bdb4f23168852c91700c8b3e7a474dc7b7eb2c / config.js

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

Built with git-ssb-web