Files: 1b278c0d3db1a06da713381ecb515687f4359b71 / server-process.js
1464 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 | var fixPath = require('fix-path') |
7 | |
8 | var 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-contacts')) |
22 | //.use(require('ssb-ebt')) // enable at your own risk! |
23 | .use(require('./sbot')) |
24 | |
25 | fixPath() |
26 | |
27 | module.exports = function (ssbConfig) { |
28 | var context = { |
29 | sbot: createSbot(ssbConfig), |
30 | config: ssbConfig |
31 | } |
32 | ssbConfig.manifest = context.sbot.getManifest() |
33 | serveBlobs(context) |
34 | fs.writeFileSync(Path.join(ssbConfig.path, 'manifest.json'), JSON.stringify(ssbConfig.manifest)) |
35 | electron.ipcRenderer.send('server-started', ssbConfig) |
36 | |
37 | // attempt to run git-ssb if it is installed and in path |
38 | var gitSsb = spawn('git-ssb', [ 'web' ], { |
39 | stdio: 'inherit' |
40 | }) |
41 | gitSsb.on('error', () => { |
42 | console.log('git-ssb is not installed, or not available in path') |
43 | }) |
44 | process.on('exit', () => { |
45 | gitSsb.kill() |
46 | }) |
47 | } |
48 |
Built with git-ssb-web