git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Tree: 3d5a912d4f26780685c60d2ccc930cd6dd9567cc

Files: 3d5a912d4f26780685c60d2ccc930cd6dd9567cc / server-process.js

1474 bytesRaw
1global.i18n = require('./lib/i18n').i18n
2
3var serveBlobs = require('./lib/serve-blobs')
4var fs = require('fs')
5var Path = require('path')
6var electron = require('electron')
7var spawn = require('child_process').spawn
8var fixPath = require('fix-path')
9
10var createSbot = require('scuttlebot')
11 .use(require('scuttlebot/plugins/master'))
12 .use(require('scuttlebot/plugins/gossip'))
13 .use(require('scuttlebot/plugins/replicate'))
14 .use(require('ssb-friends'))
15 .use(require('ssb-blobs'))
16 .use(require('ssb-backlinks'))
17 .use(require('ssb-private'))
18 .use(require('scuttlebot/plugins/invite'))
19 .use(require('scuttlebot/plugins/local'))
20 .use(require('scuttlebot/plugins/logging'))
21 .use(require('ssb-query'))
22 .use(require('ssb-about'))
23 //.use(require('ssb-ebt')) // enable at your own risk!
24 .use(require('./sbot'))
25
26fixPath()
27
28module.exports = function (ssbConfig) {
29 var context = {
30 sbot: createSbot(ssbConfig),
31 config: ssbConfig
32 }
33 ssbConfig.manifest = context.sbot.getManifest()
34 serveBlobs(context)
35 fs.writeFileSync(Path.join(ssbConfig.path, 'manifest.json'), JSON.stringify(ssbConfig.manifest))
36 electron.ipcRenderer.send('server-started', ssbConfig)
37
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

Built with git-ssb-web