Files: 10b9468f44ad8180f73a885140a5fdf7bbe3620f / server-process.js
1421 bytesRaw
1 | var serveBlobs = require('./lib/serve-blobs') |
2 | var fs = require('fs') |
3 | var Path = require('path') |
4 | var electron = require('electron') |
5 | var spawn = require('child_process').spawn |
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-contacts')) |
21 | .use(require('./lib/flumeview-channels')) |
22 | .use(require('./lib/progress-stream')) |
23 | |
24 | module.exports = function (ssbConfig) { |
25 | var context = { |
26 | sbot: createSbot(ssbConfig), |
27 | config: ssbConfig |
28 | } |
29 | ssbConfig.manifest = context.sbot.getManifest() |
30 | serveBlobs(context) |
31 | fs.writeFileSync(Path.join(ssbConfig.path, 'manifest.json'), JSON.stringify(ssbConfig.manifest)) |
32 | electron.ipcRenderer.send('server-started', ssbConfig) |
33 | |
34 | // attempt to run git-ssb if it is installed and in path |
35 | var gitSsb = spawn('git-ssb', [ 'web' ], { |
36 | stdio: 'inherit' |
37 | }) |
38 | gitSsb.on('error', () => { |
39 | console.log('git-ssb is not installed, or not available in path') |
40 | }) |
41 | process.on('exit', () => { |
42 | gitSsb.kill() |
43 | }) |
44 | } |
45 |
Built with git-ssb-web