Files: da0d5db6f185c041ae3e2ad7e73872e6d58c37cd / background-process.js
1365 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 | |
26 | Client(config.keys, config, (err, ssbServer) => { |
27 | if (ssbServer === undefined) { |
28 | console.log('> starting sbot') |
29 | var sbot = createSbot(config) |
30 | |
31 | console.log(' > updating updating manifest.json') |
32 | var manifest = sbot.getManifest() |
33 | fs.writeFileSync(Path.join(config.path, 'manifest.json'), JSON.stringify(manifest)) |
34 | electron.ipcRenderer.send('server-started') |
35 | } |
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 | |
43 | |
44 |
Built with git-ssb-web