git ssb

10+

Matt McKegg / patchwork



Tree: 130286f770625230c71948c18c13ba3dd97a5d07

Files: 130286f770625230c71948c18c13ba3dd97a5d07 / server-process.js

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

Built with git-ssb-web