feat(config): download torrents directory in config

This commit is contained in:
Alexey Kasyanchuk 2018-02-08 15:36:34 +03:00
parent 63e1af9b59
commit d320448903
2 changed files with 26 additions and 2 deletions

View File

@ -98,7 +98,7 @@ export default class AdminPage extends Page {
<div className='row inline w100p'>
<div style={{flex: 1}}>Collection directory</div>
<TextField
hintText="Port"
hintText="Db path"
errorText={this.options.dbPath && this.options.dbPath.length > 0 ? undefined : "This field is required"}
value={this.options.dbPath}
onChange={(e, value) => {
@ -137,6 +137,29 @@ export default class AdminPage extends Page {
/>
</div>
<div className='row inline w100p'>
<div style={{flex: 1}}>Download torrents directory</div>
<TextField
hintText="Download path"
value={this.options.client && this.options.client.downloadPath}
onChange={(e, value) => {
if(!fs.existsSync(value))
return
this.options.client.downloadPath = value
this.forceUpdate()
}}
/>
<RaisedButton style={{marginLeft: 20}} label="Browse" primary={true} onClick={() => {
const dir = dialog.showOpenDialog({properties: ['openDirectory']})[0]
if(dir)
{
this.options.client.downloadPath = dir
this.forceUpdate()
}
}} />
</div>
{
this.settingsSavedMessage
&&

View File

@ -1,4 +1,5 @@
import { app } from 'electron'
const os = require('os')
let config = {
indexer: true,
@ -41,7 +42,7 @@ let config = {
dbPath: '',
client: {
downloadPath: ''
downloadPath: os.homedir() + '/Downloads'
}
}