Files: 9f5c802ae0f19a653aa744af250402e6fb042fda / background-process.js
1382 bytesRaw
1 | const fs = require('fs') |
2 | const Path = require('path') |
3 | const electron = require('electron') |
4 | const Client = require('ssb-client') |
5 | |
6 | // pull config options out of depject |
7 | const config = require('./config').create().config.sync.load() |
8 | |
9 | var createSbot = require('scuttlebot') |
10 | .use(require('scuttlebot/plugins/master')) |
11 | .use(require('scuttlebot/plugins/gossip')) |
12 | .use(require('scuttlebot/plugins/replicate')) |
13 | .use(require('ssb-friends')) |
14 | .use(require('ssb-blobs')) |
15 | .use(require('ssb-backlinks')) |
16 | .use(require('ssb-private')) |
17 | .use(require('scuttlebot/plugins/invite')) |
18 | .use(require('scuttlebot/plugins/local')) |
19 | .use(require('scuttlebot/plugins/logging')) |
20 | .use(require('ssb-query')) |
21 | .use(require('ssb-about')) |
22 | // .use(require('ssb-ebt')) |
23 | .use(require('ssb-ws')) |
24 | .use(require('ssb-server-channel')) |
25 | .use(require('./ssb-server-ticktack')) |
26 | |
27 | Client(config.keys, config, (err, ssbServer) => { |
28 | if (err) { |
29 | console.log('> starting sbot') |
30 | var sbot = createSbot(config) |
31 | |
32 | console.log(' > updating updating manifest.json') |
33 | var manifest = sbot.getManifest() |
34 | fs.writeFileSync(Path.join(config.path, 'manifest.json'), JSON.stringify(manifest)) |
35 | electron.ipcRenderer.send('server-started') |
36 | } else { |
37 | console.log('> sbot running elsewhere') |
38 | electron.ipcRenderer.send('server-started') |
39 | // TODO send some warning to the client side |
40 | } |
41 | }) |
42 |
Built with git-ssb-web