Commit bd6ae13c2995c4eadfe1d7e1c04489af84bebda4
Merge pull request #829 from stripedpajamas/custom-path
Add support for custom ssb pathMatt McKegg authored on 7/11/2018, 6:05:27 AM
GitHub committed on 7/11/2018, 6:05:27 AM
Parent: dde0f66d805ad433984e8d28ac8554e739f47ec7
Parent: 57dc1fb0228dd6a5ab98a2ef6d9d102ac02d540e
Files changed
index.js | changed |
server-process.js | changed |
index.js | ||
---|---|---|
@@ -38,14 +38,20 @@ | ||
38 | 38 … | electron.app.quit() |
39 | 39 … | } |
40 | 40 … | } |
41 | 41 … | |
42 … | +var config = { | |
43 … | + server: !(process.argv.includes('-g') || process.argv.includes('--use-global-ssb')) | |
44 … | +} | |
45 … | +// a flag so we don't start git-ssb-web if a custom path is passed in | |
46 … | +if (process.argv.includes('--path')) { | |
47 … | + config.customPath = true | |
48 … | +} | |
49 … | + | |
42 | 50 … | quitIfAlreadyRunning() |
43 | 51 … | |
44 | 52 … | electron.app.on('ready', () => { |
45 | - setupContext('ssb', { | |
46 | - server: !(process.argv.includes('-g') || process.argv.includes('--use-global-ssb')) | |
47 | - }, () => { | |
53 … | + setupContext('ssb', config, () => { | |
48 | 54 … | var browserWindow = openMainWindow() |
49 | 55 … | var menu = defaultMenu(electron.app, electron.shell) |
50 | 56 … | |
51 | 57 … | menu.splice(4, 0, { |
server-process.js | |||
---|---|---|---|
@@ -32,15 +32,18 @@ | |||
32 | 32 … | ssbConfig.manifest = context.sbot.getManifest() | |
33 | 33 … | fs.writeFileSync(Path.join(ssbConfig.path, 'manifest.json'), JSON.stringify(ssbConfig.manifest)) | |
34 | 34 … | electron.ipcRenderer.send('server-started', ssbConfig) | |
35 | 35 … | ||
36 | - // attempt to run git-ssb if it is installed and in path | ||
37 | - var gitSsb = spawn('git-ssb', [ 'web' ], { | ||
38 | - stdio: 'inherit' | ||
39 | - }) | ||
40 | - gitSsb.on('error', () => { | ||
41 | - console.log('git-ssb is not installed, or not available in path') | ||
42 | - }) | ||
43 | - process.on('exit', () => { | ||
44 | - gitSsb.kill() | ||
45 | - }) | ||
36 … | + // check if we are using a custom ssb path (which would break git-ssb-web) | ||
37 … | + if (!ssbConfig.customPath) { | ||
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 … | + } | ||
46 | 49 … | } |
Built with git-ssb-web