feat(config): saving configuration

This commit is contained in:
Alexey Kasyanchuk
2018-02-02 04:10:40 +03:00
parent 5fc8ddde2b
commit 316072008a
7 changed files with 85 additions and 75 deletions
+5 -5
View File
@@ -15,14 +15,14 @@ export default class AdminPage extends Page {
this.loadSettings()
}
loadSettings() {
window.torrentSocket.emit('admin', window.customLoader((options) => {
window.torrentSocket.emit('config', window.customLoader((options) => {
this.options = options;
console.log(this.options)
this.forceUpdate();
}));
}
saveSettings() {
window.torrentSocket.emit('setAdmin', this.options)
window.torrentSocket.emit('setConfig', this.options)
this.forceUpdate()
}
render() {
@@ -32,12 +32,12 @@ export default class AdminPage extends Page {
<div className='column center w100p pad0-75'>
<Toggle
style={{marginTop: '10px'}}
label="Disable DHT scanning"
toggled={this.options.dhtDisabled}
label="Enabled network scanning"
toggled={this.options.indexer}
thumbSwitchedStyle={{backgroundColor: 'red'}}
trackSwitchedStyle={{backgroundColor: '#ff9d9d'}}
onToggle={(e, checked) => {
this.options.dhtDisabled = checked
this.options.indexer = checked
this.saveSettings()
}}
/>
+6
View File
@@ -40,6 +40,12 @@ const { ipcRenderer, remote } = require('electron');
});
ipcRenderer.on('url', (event, url) => {
console.log('url', url)
router(url)
});
// Needed for onTouchTap
// http://stackoverflow.com/a/34015469/988941
injectTapEventPlugin();
+1 -1
View File
@@ -71,7 +71,7 @@ router('/DMCA', () => {
});
router('/admi5p', () => {
router('/config', () => {
//singleton
let pie = new PagesPie;
pie.open(AdminPage, {replace: 'all'});