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