import React from 'react'; import Page from './page'; import Toggle from 'material-ui/Toggle'; import RaisedButton from 'material-ui/RaisedButton'; import TextField from 'material-ui/TextField' import Slider from 'material-ui/Slider' import fs from 'fs' const {dialog} = require('electron').remote export default class ConfigPage extends Page { constructor(props) { super(props) this.setTitle('Rats settings'); this.options = {} } componentDidMount() { this.loadSettings() } loadSettings() { window.torrentSocket.emit('config', window.customLoader((options) => { this.options = options; console.log(this.options) this.forceUpdate(); })); } saveSettings() { window.torrentSocket.emit('setConfig', this.options) this.settingsSavedMessage = true this.forceUpdate() setTimeout(() => { this.settingsSavedMessage = false this.forceUpdate() }, 1000) } render() { return (
{ window.router('/') }} />
{ this.options.indexer = checked if(!this.options.indexer) this.options.p2p = false this.forceUpdate() }} />
Scanning port
0 ? undefined : "This field is required"} value={this.options.spiderPort} onChange={(e, value) => { if(!value) value = 0 if(value > 65535) value = 65535 this.options.spiderPort = parseInt(value) this.forceUpdate() }} />
* For current work TCP and UDP ports must be fully open and forward in case of router usage
Trackers responce port
0 ? undefined : "This field is required"} value={this.options.udpTrackersPort} onChange={(e, value) => { if(!value) value = 0 if(value > 65535) value = 65535 this.options.udpTrackersPort = parseInt(value) this.forceUpdate() }} />
* For current work UDP port must be fully open and forward in case of router usage
{ this.options.upnp = checked this.forceUpdate() }} />
Collection directory
0 ? undefined : "This field is required"} value={this.options.dbPath} onChange={(e, value) => { if(!fs.existsSync(value)) return this.options.dbPath = value this.forceUpdate() }} /> { const dir = dialog.showOpenDialog({properties: ['openDirectory']})[0] if(dir) { this.options.dbPath = dir this.forceUpdate() } }} />
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() } }} />
P2P Rats network settings:
{ this.options.p2p = this.options.indexer && checked this.forceUpdate() }} />
{ this.options.p2pBootstrap = checked this.forceUpdate() }} />
* Use extrnral bootstrap nodes to get p2p peers when network setted wrong or need external source
Max peers limit (current: {this.options.p2pConnections})
{ this.options.p2pConnections = value this.forceUpdate() }} />
{ this.options.p2pReplication = checked this.forceUpdate() }} />
* Enable torrents replication from another rats clients. Dont recomended if torrent scanner works correct.
Torrent network scanner settings:
Scanner walk speed (current: {this.options.spider && this.options.spider.walkInterval}) [affected after program reload]
{ this.options.spider.walkInterval = value this.forceUpdate() }} />
* Low value - fast initial scanning and high cpu usage. High Value - low cpu usage but very slow scanning. Good value between 3-60. Defaul value: 5
Nodes usage (current: {this.options.spider && this.options.spider.nodesUsage})
{ this.options.spider.nodesUsage = value this.forceUpdate() }} />
* Low Value - very low usage of nodes, low network traffic, slow torrent scanning. High value - high traffic, fast scanning, high routers usage. Recomended value between 10-1000. Defaul value: 100. 0 - Ignore this option (no limit).
Reduce network packages (current: {this.options.spider && this.options.spider.packagesLimit})
{ this.options.spider.packagesLimit = value this.forceUpdate() }} />
* Low Value - ignore more usless network packages, lower traffic and routers usage. High Value - high traffic and router usage in prospectю Recomended value between 300-2000. Defaul value: 500. 0 - Ignore this option (no limit).
{ this.settingsSavedMessage &&
Settings saved
}
{ this.saveSettings() }} />
); } }