Files: 1a1dfa987b784a002e626f97e18aeaf2164d1299 / server-process.js
1474 bytesRaw
1 | global.i18n = require('./lib/i18n').i18n |
2 | |
3 | var serveBlobs = require('./lib/serve-blobs') |
4 | var fs = require('fs') |
5 | var Path = require('path') |
6 | var electron = require('electron') |
7 | var spawn = require('child_process').spawn |
8 | var fixPath = require('fix-path') |
9 | |
10 | var 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 | |
26 | fixPath() |
27 | |
28 | module.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