Add help to desktop configuration options

This commit is contained in:
Igor Katson 2023-12-06 22:09:31 +00:00
parent 66561e64a1
commit ea4193aa2e
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5

View file

@ -11,7 +11,8 @@ const FormCheck: React.FC<{
checked: boolean, checked: boolean,
onChange: (e: any) => void, onChange: (e: any) => void,
disabled?: boolean, disabled?: boolean,
}> = ({ label, name, checked, onChange, disabled }) => { help?: string,
}> = ({ label, name, checked, onChange, disabled, help }) => {
return <Form.Group as={Row} controlId={name} className="mb-3"> return <Form.Group as={Row} controlId={name} className="mb-3">
<Form.Label className="col-4">{label}</Form.Label> <Form.Label className="col-4">{label}</Form.Label>
<div className="col-8"> <div className="col-8">
@ -23,6 +24,7 @@ const FormCheck: React.FC<{
disabled={disabled} disabled={disabled}
/> />
</div> </div>
{help && <div className="form-text">{help}</div>}
</Form.Group> </Form.Group>
} }
@ -33,7 +35,8 @@ const FormInput: React.FC<{
inputType: string, inputType: string,
onChange: (e: any) => void, onChange: (e: any) => void,
disabled?: boolean, disabled?: boolean,
}> = ({ label, name, value, inputType, onChange, disabled }) => { help?: string
}> = ({ label, name, value, inputType, onChange, disabled, help }) => {
return <Form.Group as={Row} controlId={name} className="mb-3"> return <Form.Group as={Row} controlId={name} className="mb-3">
<Form.Label className="col-4 col-form-label">{label}</Form.Label> <Form.Label className="col-4 col-form-label">{label}</Form.Label>
<div className="col-8"> <div className="col-8">
@ -45,6 +48,7 @@ const FormInput: React.FC<{
disabled={disabled} disabled={disabled}
/> />
</div> </div>
{help && <div className="form-text">{help}</div>}
</Form.Group> </Form.Group>
} }
@ -128,6 +132,7 @@ export const ConfigModal: React.FC<{
value={config.default_download_location} value={config.default_download_location}
inputType="text" inputType="text"
onChange={handleInputChange} onChange={handleInputChange}
help="Where to download torrents by default. You can override this per torrent."
/> />
</Tab> </Tab>
@ -139,6 +144,7 @@ export const ConfigModal: React.FC<{
name="dht.disable" name="dht.disable"
checked={!config.dht.disable} checked={!config.dht.disable}
onChange={handleToggleChange} onChange={handleToggleChange}
help="DHT is required to read magnet links. There's no good reason to disable it, unless you know what you are doing."
/> />
<FormCheck <FormCheck
@ -146,6 +152,7 @@ export const ConfigModal: React.FC<{
name="dht.disable_persistence" name="dht.disable_persistence"
checked={!config.dht.disable_persistence} checked={!config.dht.disable_persistence}
onChange={handleToggleChange} onChange={handleToggleChange}
help="Enable to store DHT state in a file periodically. If disabled, DHT will bootstrap from scratch on restart."
/> />
<FormInput <FormInput
@ -154,6 +161,7 @@ export const ConfigModal: React.FC<{
value={config.dht.persistence_filename} value={config.dht.persistence_filename}
inputType="text" inputType="text"
onChange={handleInputChange} onChange={handleInputChange}
help="The filename to store DHT state into"
/> />
</Tab> </Tab>
@ -165,6 +173,7 @@ export const ConfigModal: React.FC<{
name="tcp_listen.disable" name="tcp_listen.disable"
checked={!config.tcp_listen.disable} checked={!config.tcp_listen.disable}
onChange={handleToggleChange} onChange={handleToggleChange}
help="Listen for torrent requests on TCP. Required for peers to be able to connect to you, mainly for uploading."
/> />
<FormCheck <FormCheck
@ -172,6 +181,7 @@ export const ConfigModal: React.FC<{
name="tcp_listen.disable" name="tcp_listen.disable"
checked={!config.tcp_listen.disable} checked={!config.tcp_listen.disable}
onChange={handleToggleChange} onChange={handleToggleChange}
help="Advertise your port over UPnP. This is required for peers to be able to connect to you from the internet. Will only work if your router has a static IP."
/> />
<FormInput <FormInput
@ -181,6 +191,7 @@ export const ConfigModal: React.FC<{
value={config.tcp_listen.min_port} value={config.tcp_listen.min_port}
disabled={config.tcp_listen.disable} disabled={config.tcp_listen.disable}
onChange={handleInputChange} onChange={handleInputChange}
help="The min port to try to listen on. First successful is taken."
/> />
<FormInput <FormInput
@ -190,6 +201,7 @@ export const ConfigModal: React.FC<{
value={config.tcp_listen.max_port} value={config.tcp_listen.max_port}
disabled={config.tcp_listen.disable} disabled={config.tcp_listen.disable}
onChange={handleInputChange} onChange={handleInputChange}
help="The max port to try to listen on."
/> />
</Tab> </Tab>
@ -202,6 +214,7 @@ export const ConfigModal: React.FC<{
name="persistence.disable" name="persistence.disable"
checked={!config.persistence.disable} checked={!config.persistence.disable}
onChange={handleToggleChange} onChange={handleToggleChange}
help="If you disable session persistence, rqbit won't remember the torrents you had before restart."
/> />
<FormInput <FormInput
@ -222,6 +235,7 @@ export const ConfigModal: React.FC<{
name="peer_opts.connect_timeout" name="peer_opts.connect_timeout"
value={config.peer_opts.connect_timeout} value={config.peer_opts.connect_timeout}
onChange={handleInputChange} onChange={handleInputChange}
help="How much to wait for outgoing connections to connect. Default is low to prefer faster peers."
/> />
<FormInput <FormInput
@ -230,6 +244,7 @@ export const ConfigModal: React.FC<{
name="peer_opts.read_write_timeout" name="peer_opts.read_write_timeout"
value={config.peer_opts.read_write_timeout} value={config.peer_opts.read_write_timeout}
onChange={handleInputChange} onChange={handleInputChange}
help="Peer socket read/write timeout."
/> />
</Tab> </Tab>
@ -241,14 +256,16 @@ export const ConfigModal: React.FC<{
name="http_api.disable" name="http_api.disable"
checked={!config.http_api.disable} checked={!config.http_api.disable}
onChange={handleToggleChange} onChange={handleToggleChange}
help="If enabled you can access the HTTP API at the address below"
/> />
<FormCheck <FormCheck
label="Read Only" label="Read only"
name="http_api.read_only" name="http_api.read_only"
checked={config.http_api.read_only} checked={config.http_api.read_only}
disabled={config.http_api.disable} disabled={config.http_api.disable}
onChange={handleToggleChange} onChange={handleToggleChange}
help="If enabled, only GET requests will be allowed through the API"
/> />
<FormInput <FormInput
@ -258,6 +275,7 @@ export const ConfigModal: React.FC<{
value={config.http_api.listen_addr} value={config.http_api.listen_addr}
disabled={config.http_api.disable} disabled={config.http_api.disable}
onChange={handleInputChange} onChange={handleInputChange}
help={`You'll access the API at http://${config.http_api.listen_addr}`}
/> />
</Tab> </Tab>