Commit 1d5204eb5cf8d3b7004c01b71b184796a5582121
Merge pull request #28 from ticktackim/autopubs
implement an auto connecting pubmix irving authored on 8/21/2017, 4:37:54 AM
GitHub committed on 8/21/2017, 4:37:54 AM
Parent: 8f396ed5f324462779aad3261565e61d9d1156b0
Parent: 0f5f9e807fb3a5d6443be8feb5b7c37d511ac125
Files changed
config.js | changed |
main.js | changed |
default-config.json | added |
config.js | ||
---|---|---|
@@ -3,15 +3,9 @@ | ||
3 | 3 | const ssbKeys = require('ssb-keys') |
4 | 4 | const Path = require('path') |
5 | 5 | |
6 | 6 | const appName = 'ssb' //'ticktack-ssb' |
7 | -const opts = process.env.ssb_appname== 'ssb' ? {} :{ | |
8 | - port: 43750, | |
9 | - blobsPort: 43751, | |
10 | - ws: { | |
11 | - port: 43751 | |
12 | - } | |
13 | -} | |
7 | +const opts = process.env.ssb_appname== 'ssb' ? {} : require('./default-config.json') | |
14 | 8 | |
15 | 9 | exports.gives = nest('config.sync.load') |
16 | 10 | exports.create = (api) => { |
17 | 11 | var config |
@@ -25,4 +19,5 @@ | ||
25 | 19 | } |
26 | 20 | return config |
27 | 21 | }) |
28 | 22 | } |
23 | + |
main.js | ||
---|---|---|
@@ -30,22 +30,19 @@ | ||
30 | 30 | ) |
31 | 31 | |
32 | 32 | const api = entry(sockets, nest({ |
33 | 33 | 'app.html.app': 'first', |
34 | - 'invite.async.autofollow': 'first' | |
34 | + 'invite.async.autofollow': 'first', | |
35 | + 'config.sync.load': 'first' | |
35 | 36 | })) |
36 | 37 | |
37 | 38 | document.body.appendChild(api.app.html.app()) |
38 | 39 | |
39 | -api.invite.async.autofollow( | |
40 | - 'wx.larpa.net:8008:@DTNmX+4SjsgZ7xyDh5xxmNtFqa6pWi5Qtw7cE8aR9TQ=.ed25519~YIRnryeLBhtBa2il9fCWDlAIFWR37Uh63Vep0L6tk6c=', | |
41 | - function (err, follows) { | |
42 | - console.log('autofollowed', err, follows); | |
43 | -}) | |
44 | - | |
45 | - | |
46 | - | |
47 | - | |
48 | - | |
49 | - | |
50 | - | |
51 | - | |
40 | +var invite = api.config.sync.load().autoinvite | |
41 | +if(invite) | |
42 | + api.invite.async.autofollow( | |
43 | + invite, | |
44 | + function (err, follows) { | |
45 | + console.log('autofollowed', err, follows); | |
46 | + }) | |
47 | +else | |
48 | + console.log('no invite') |
default-config.json | ||
---|---|---|
@@ -1,0 +1,9 @@ | ||
1 | +{ | |
2 | + "port": 43750, | |
3 | + "blobsPort": 43751, | |
4 | + "ws": { "port": 43751 }, | |
5 | + "caps": {"shs": "ErgQF85hFQpUXp69IXtLW+nXDgFIOKKDOWFX/st2aWk="}, | |
6 | + "autoinvite": "128.199.132.182:43750:@7xMrWP8708+LDvaJrRMRQJEixWYp4Oipa9ohqY7+NyQ=.ed25519~YC4ZnjHH8qzsyHe2sihW8WDlhxSUH33IthOi4EsldwQ=" | |
7 | +} | |
8 | + | |
9 | + |
Built with git-ssb-web