Files: bea0d6f86662e5db7348deb37bef697f1226edae / config.js
763 bytesRaw
1 | var http = require('http') |
2 | |
3 | module.exports = function () { |
4 | //var host = window.location.origin |
5 | |
6 | var host = 'http://100.115.92.2:9191' |
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 | console.log(config) |
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