Files: 6b993159aa69170259a3947c0509e821593c4fb5 / server-process.js
1391 bytesRaw
1 | var fs = require('fs') |
2 | var Path = require('path') |
3 | var electron = require('electron') |
4 | var spawn = require('child_process').spawn |
5 | var fixPath = require('fix-path') |
6 | |
7 | var createSbot = require('scuttlebot') |
8 | .use(require('scuttlebot/plugins/master')) |
9 | .use(require('scuttlebot/plugins/gossip')) |
10 | .use(require('scuttlebot/plugins/replicate')) |
11 | .use(require('ssb-friends')) |
12 | .use(require('ssb-blobs')) |
13 | .use(require('ssb-backlinks')) |
14 | .use(require('ssb-private')) |
15 | .use(require('scuttlebot/plugins/invite')) |
16 | .use(require('scuttlebot/plugins/local')) |
17 | .use(require('scuttlebot/plugins/logging')) |
18 | .use(require('ssb-query')) |
19 | .use(require('ssb-about')) |
20 | .use(require('ssb-ws')) |
21 | // .use(require('ssb-ebt')) // enable at your own risk! |
22 | .use(require('./sbot')) |
23 | |
24 | fixPath() |
25 | |
26 | module.exports = function (ssbConfig) { |
27 | var context = { |
28 | sbot: createSbot(ssbConfig), |
29 | config: ssbConfig |
30 | } |
31 | ssbConfig.manifest = context.sbot.getManifest() |
32 | fs.writeFileSync(Path.join(ssbConfig.path, 'manifest.json'), JSON.stringify(ssbConfig.manifest)) |
33 | electron.ipcRenderer.send('server-started', ssbConfig) |
34 | |
35 | // attempt to run git-ssb if it is installed and in path |
36 | var gitSsb = spawn('git-ssb', [ 'web' ], { |
37 | stdio: 'inherit' |
38 | }) |
39 | gitSsb.on('error', () => { |
40 | console.log('git-ssb is not installed, or not available in path') |
41 | }) |
42 | process.on('exit', () => { |
43 | gitSsb.kill() |
44 | }) |
45 | } |
46 |
Built with git-ssb-web