git ssb

1+

Daan Patchwork / patchwork



Tree: 4087ed91f7e663172d051c9afe142fa7b7669f1e

Files: 4087ed91f7e663172d051c9afe142fa7b7669f1e / lib / server-process.js

1792 bytesRaw
1const fs = require('fs')
2const Path = require('path')
3const electron = require('electron')
4const spawn = require('child_process').spawn
5const fixPath = require('fix-path')
6
7const 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(
20 require('ssb-social-index')({
21 namespace: 'about',
22 type: 'about',
23 destField: 'about'
24 })
25 )
26 .use(require('ssb-private'))
27 .use(require('ssb-room/tunnel/client'))
28 .use(require('ssb-dht-invite'))
29 .use(require('ssb-invite'))
30 .use(require('ssb-query'))
31 .use(require('ssb-search'))
32 .use(require('ssb-ws'))
33 .use(require('ssb-tags'))
34 .use(require('ssb-ebt'))
35 .use(require('./plugins'))
36
37fixPath()
38
39module.exports = function (ssbConfig) {
40 const context = {
41 sbot: createSbot(ssbConfig),
42 config: ssbConfig
43 }
44 ssbConfig.manifest = context.sbot.getManifest()
45 fs.writeFileSync(Path.join(ssbConfig.path, 'manifest.json'), JSON.stringify(ssbConfig.manifest))
46 electron.ipcRenderer.send('server-started', ssbConfig)
47
48 // check if we are using a custom ssb path (which would break git-ssb-web)
49 if (!ssbConfig.customPath) {
50 // attempt to run git-ssb if it is installed and in path
51 const gitSsb = spawn('git-ssb', ['web'], {
52 stdio: 'inherit'
53 })
54 gitSsb.on('error', () => {
55 console.log('git-ssb is not installed, or not available in path')
56 })
57 process.on('exit', () => {
58 gitSsb.kill()
59 })
60 }
61}
62

Built with git-ssb-web