Files: 612509945be4d8cb719d3b0a5a0390a0ddbcf911 / lib / server-process.js
1696 bytesRaw
1 | const fs = require('fs') |
2 | const Path = require('path') |
3 | const electron = require('electron') |
4 | const spawn = require('child_process').spawn |
5 | const fixPath = require('fix-path') |
6 | |
7 | const createSbot = require('secret-stack')() |
8 | .use(require('ssb-db')) |
9 | .use(require('ssb-conn')) |
10 | .use(require('ssb-lan')) |
11 | .use(require('ssb-logging')) |
12 | .use(require('ssb-master')) |
13 | .use(require('ssb-no-auth')) |
14 | .use(require('ssb-replicate')) |
15 | .use(require('ssb-unix-socket')) |
16 | .use(require('ssb-friends')) // not strictly required, but helps ssb-conn a lot |
17 | .use(require('ssb-blobs')) |
18 | .use(require('ssb-backlinks')) |
19 | .use(require('ssb-about')) |
20 | .use(require('ssb-private')) |
21 | .use(require('ssb-room/tunnel/client')) |
22 | .use(require('ssb-dht-invite')) |
23 | .use(require('ssb-invite')) |
24 | .use(require('ssb-query')) |
25 | .use(require('ssb-search')) |
26 | .use(require('ssb-ws')) |
27 | .use(require('ssb-tags')) |
28 | .use(require('ssb-ebt')) |
29 | .use(require('./plugins')) |
30 | |
31 | fixPath() |
32 | |
33 | module.exports = function (ssbConfig) { |
34 | const context = { |
35 | sbot: createSbot(ssbConfig), |
36 | config: ssbConfig |
37 | } |
38 | ssbConfig.manifest = context.sbot.getManifest() |
39 | fs.writeFileSync(Path.join(ssbConfig.path, 'manifest.json'), JSON.stringify(ssbConfig.manifest)) |
40 | electron.ipcRenderer.send('server-started', ssbConfig) |
41 | |
42 | // check if we are using a custom ssb path (which would break git-ssb-web) |
43 | if (!ssbConfig.customPath) { |
44 | // attempt to run git-ssb if it is installed and in path |
45 | const gitSsb = spawn('git-ssb', ['web'], { |
46 | stdio: 'inherit' |
47 | }) |
48 | gitSsb.on('error', () => { |
49 | console.log('git-ssb is not installed, or not available in path') |
50 | }) |
51 | process.on('exit', () => { |
52 | gitSsb.kill() |
53 | }) |
54 | } |
55 | } |
56 |
Built with git-ssb-web