git ssb

1+

punkmonk.termux / mvd



forked from ev / mvd

Commit 7ede3c7a935ddf6b575e9a503f49956005a87a3d

use default ssb config to try and fix ws issue

Ev Bogue committed on 10/21/2018, 7:37:40 PM
Parent: 85956a908fc91d4dac9978d391e83b124402bdd5

Files changed

bin.jschanged
config/inject.jschanged
package.jsonchanged
bin.jsView
@@ -9,14 +9,10 @@
99
1010 var SEC = 1e3
1111 var MIN = 60*SEC
1212
13-var network = 'ssb'
14-//var network = 'decent'
15-//var network = 'testnet'
13+var config = require('./config/inject')()
1614
17-var config = require('./config/inject')(network)
18-
1915 config.keys = ssbKeys.loadOrCreateSync(path.join(config.path, 'secret'))
2016
2117 var mvdClient = fs.readFileSync(path.join('./build/index.html'))
2218
config/inject.jsView
@@ -1,82 +1,42 @@
11 var path = require('path')
22 var home = require('os-homedir')
3+
34 var nonPrivate = require('non-private-ip')
45 var merge = require('deep-extend')
5-var id = require('ssb-keys')
6+
67 var RC = require('rc')
8+
79 var SEC = 1e3
810 var MIN = 60*SEC
911
1012 module.exports = function (name, override) {
11- console.log('Using the ' + name + ' config')
12-
13- var network
14-
15- if (name === 'ssb') {
16- network = {
17- port: 8008,
18- ws: {
19- port: 8989
20- },
21- caps: {
22- shs: '1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=',
23- sign: null
24- }
25- }
26- }
27-
28- if (name === 'decent') {
29- network = {
30- port: 3333,
31- ws: {
32- port: 3939
33- },
34- caps: {
35- shs: 'EVRctE2Iv8GrO/BpQCF34e2FMPsDJot9x0j846LjVtc=',
36- sign: null
37- }
38- }
39- }
40-
41- if (name === 'testnet') {
42- network = {
43- port: 9999,
44- ws: {
45- port: 9191
46- },
47- caps: {
48- shs: 'sR74I0+OW6LBYraQQ2YtFtqV5Ns77Tv5DyMfyWbrlpI=',
49- sign: null
50- }
51- }
52- }
53-
13+ name = name || 'ssb'
5414 var HOME = home() || 'browser' //most probably browser
55-
56- return RC(name, merge(network, {
57- name: name,
58- //standard stuff that probably doesn't need to change below
15+ var result = RC(name || 'ssb', merge({
16+ //just use an ipv4 address by default.
17+ //there have been some reports of seemingly non-private
18+ //ipv6 addresses being returned and not working.
19+ //https://github.com/ssbc/scuttlebot/pull/102
20+ party: true,
5921 host: nonPrivate.v4 || '',
22+ port: 8008,
6023 timeout: 0,
61- allowPrivate: true,
6224 pub: true,
6325 local: true,
6426 friends: {
6527 dunbar: 150,
6628 hops: 3
6729 },
30+ ws: {
31+ port: 8989
32+ },
6833 gossip: {
6934 connections: 3
7035 },
7136 connections: {
72- incoming: {
73- net: [{ port: 8008, host: "localhost", scope: "local", "transform": "shs" }],
74- ws: [{ "scope": "public", "transform": "shs" }]
75- },
7637 outgoing: {
77- net: [{ transform: "shs" }],
78- ws: [{ "scope": "public", "transform": "shs" }]
38+ net: [{ transform: "shs" }]
7939 }
8040 },
8141 path: path.join(HOME, '.' + name),
8242 timers: {
@@ -84,8 +44,27 @@
8444 reconnect: 5*SEC,
8545 ping: 5*MIN,
8646 handshake: 5*SEC
8747 },
48+ //change these to make a test network that will not connect to the main network.
49+ caps: {
50+ //this is the key for accessing the ssb protocol.
51+ //this will be updated whenever breaking changes are made.
52+ //(see secret-handshake paper for a full explaination)
53+ //(generated by crypto.randomBytes(32).toString('base64'))
54+ shs: '1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=',
55+
56+ //used to sign messages
57+ sign: null
58+ },
8859 master: [],
89- party: true //disable quotas
60+ logging: { level: 'notice' }
9061 }, override || {}))
62+
63+ if (!result.connections.incoming) {
64+ result.connections.incoming = {
65+ net: [{ host: result.host, port: result.port, scope: "public", "transform": "shs" }],
66+ ws: [{ host: result.host, scope: "device", "transform": "shs" }]
67+ }
68+ }
69+ return result
9170 }
package.jsonView
@@ -35,9 +35,9 @@
3535 "pull-reconnect": "0.0.3",
3636 "pull-stream": "^3.6.9",
3737 "pull-stringify": "^2.0.0",
3838 "rc": "^1.2.8",
39- "scuttlebot": "^12.2.3",
39+ "scuttlebot": "^13.0.0",
4040 "simple-mime": "^0.1.0",
4141 "split-buffer": "^1.0.0",
4242 "ssb-avatar": "^0.2.0",
4343 "ssb-backlinks": "^0.7.3",

Built with git-ssb-web