From d3204489034d60cf7eecc856a5489a8312d73714 Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Thu, 8 Feb 2018 15:36:34 +0300 Subject: [PATCH] feat(config): download torrents directory in config --- src/app/admin-page.js | 25 ++++++++++++++++++++++++- src/background/config.js | 3 ++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/app/admin-page.js b/src/app/admin-page.js index 3c36b15..05439b1 100644 --- a/src/app/admin-page.js +++ b/src/app/admin-page.js @@ -98,7 +98,7 @@ export default class AdminPage extends Page {
Collection directory
0 ? undefined : "This field is required"} value={this.options.dbPath} onChange={(e, value) => { @@ -137,6 +137,29 @@ export default class AdminPage extends Page { />
+
+
Download torrents directory
+ { + if(!fs.existsSync(value)) + return + + this.options.client.downloadPath = value + this.forceUpdate() + }} + /> + { + const dir = dialog.showOpenDialog({properties: ['openDirectory']})[0] + if(dir) + { + this.options.client.downloadPath = dir + this.forceUpdate() + } + }} /> +
+ { this.settingsSavedMessage && diff --git a/src/background/config.js b/src/background/config.js index 8884d70..127361b 100644 --- a/src/background/config.js +++ b/src/background/config.js @@ -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' } }