git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Tree: c50f73d28c82ec782f6fca2e0a41d3b4d138becb

Files: c50f73d28c82ec782f6fca2e0a41d3b4d138becb / server-process.js

1377 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
6
7var 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/progress-stream'))
22
23module.exports = function (ssbConfig) {
24 var context = {
25 sbot: createSbot(ssbConfig),
26 config: ssbConfig
27 }
28 ssbConfig.manifest = context.sbot.getManifest()
29 serveBlobs(context)
30 fs.writeFileSync(Path.join(ssbConfig.path, 'manifest.json'), JSON.stringify(ssbConfig.manifest))
31 electron.ipcRenderer.send('server-started', ssbConfig)
32
33 // attempt to run git-ssb if it is installed and in path
34 var gitSsb = spawn('git-ssb', [ 'web' ], {
35 stdio: 'inherit'
36 })
37 gitSsb.on('error', () => {
38 console.log('git-ssb is not installed, or not available in path')
39 })
40 process.on('exit', () => {
41 gitSsb.kill()
42 })
43}
44

Built with git-ssb-web