git ssb

10+

Matt McKegg / patchwork



Tree: 5e556245f4b2af5556f1aee173f191d73949b988

Files: 5e556245f4b2af5556f1aee173f191d73949b988 / server-process.js

1553 bytesRaw
1var fs = require('fs')
2var Path = require('path')
3var electron = require('electron')
4var spawn = require('child_process').spawn
5var fixPath = require('fix-path')
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-search'))
21 .use(require('ssb-ws'))
22 // .use(require('ssb-ebt')) // enable at your own risk!
23 .use(require('./sbot'))
24
25fixPath()
26
27module.exports = function (ssbConfig) {
28 var context = {
29 sbot: createSbot(ssbConfig),
30 config: ssbConfig
31 }
32 ssbConfig.manifest = context.sbot.getManifest()
33 fs.writeFileSync(Path.join(ssbConfig.path, 'manifest.json'), JSON.stringify(ssbConfig.manifest))
34 electron.ipcRenderer.send('server-started', ssbConfig)
35
36 // check if we are using a custom ssb path (which would break git-ssb-web)
37 if (!ssbConfig.customPath) {
38 // attempt to run git-ssb if it is installed and in path
39 var gitSsb = spawn('git-ssb', [ 'web' ], {
40 stdio: 'inherit'
41 })
42 gitSsb.on('error', () => {
43 console.log('git-ssb is not installed, or not available in path')
44 })
45 process.on('exit', () => {
46 gitSsb.kill()
47 })
48 }
49}
50

Built with git-ssb-web