Skip to content

Commit

Permalink
add setting to pane
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Mar 20, 2018
1 parent fdc975a commit 3ffb2d8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ function ensurePath (path) {
const ipfsAppData = ensurePath(path.join(app.getPath('appData'), 'ipfs-desktop'))
const logsPath = ensurePath(path.join(ipfsAppData, 'logs'))

const settingsStore = new KeyValueStore(path.join(ipfsAppData, 'config.json'))
const settingsStore = new KeyValueStore(path.join(ipfsAppData, 'config.json'), {
dhtClient: true
})

if (!settingsStore.get('ipfsPath')) {
const p = path.join(process.env.IPFS_PATH || (process.env.HOME || process.env.USERPROFILE), '.ipfs')
Expand Down
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ function onStartDaemon (node) {
}
}

node.start(['--routing=dhtclient'], (err, api) => {
const flags = []
if (config.settingsStore.get('dhtClient')) {
flags.push('--routing=dhtclient')
}

node.start(flags, (err, api) => {
if (err) {
handleKnownErrors(err)
return
Expand Down
10 changes: 10 additions & 0 deletions src/panes/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ const options = [
</span>
)
},
{
title: 'DHT client profile',
setting: 'dhtClient',
description: (
<span>
Make your IPFS node act as a DHT client and not a DHT server, consuming less network and battery.
Restarting your node is required.
</span>
)
},
{
title: 'Light theme',
setting: 'lightTheme'
Expand Down
4 changes: 2 additions & 2 deletions src/utils/key-value-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import FileStore from './file-store'
* @extends FileStore
*/
export default class KeyValueStore extends FileStore {
constructor (location) {
super(location, {})
constructor (location, d = {}) {
super(location, d)
}

/**
Expand Down

0 comments on commit 3ffb2d8

Please sign in to comment.