mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
refactor server settings
as in TorrServe
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import axios from 'axios'
|
||||
import ListItem from '@material-ui/core/ListItem'
|
||||
import ListItemIcon from '@material-ui/core/ListItemIcon'
|
||||
import ListItemText from '@material-ui/core/ListItemText'
|
||||
@@ -11,7 +12,6 @@ import DialogActions from '@material-ui/core/DialogActions'
|
||||
import Button from '@material-ui/core/Button'
|
||||
import { FormControlLabel, InputLabel, Select, Switch } from '@material-ui/core'
|
||||
import { settingsHost, setTorrServerHost, getTorrServerHost } from 'utils/Hosts'
|
||||
import axios from 'axios'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export default function SettingsDialog() {
|
||||
@@ -52,7 +52,16 @@ export default function SettingsDialog() {
|
||||
if (type === 'number' || type === 'select-one') {
|
||||
sets[id] = Number(value)
|
||||
} else if (type === 'checkbox') {
|
||||
sets[id] = Boolean(checked)
|
||||
if (
|
||||
id === 'DisableTCP' ||
|
||||
id === 'DisableUTP' ||
|
||||
id === 'DisableUPNP' ||
|
||||
id === 'DisableDHT' ||
|
||||
id === 'DisablePEX' ||
|
||||
id === 'DisableUpload'
|
||||
)
|
||||
sets[id] = Boolean(!checked)
|
||||
else sets[id] = Boolean(checked)
|
||||
} else if (type === 'url') {
|
||||
sets[id] = value
|
||||
}
|
||||
@@ -115,10 +124,7 @@ export default function SettingsDialog() {
|
||||
type='number'
|
||||
fullWidth
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Switch checked={PreloadBuffer} onChange={inputForm} id='PreloadBuffer' color='primary' />}
|
||||
label={t('PreloadBuffer')}
|
||||
/>
|
||||
<br />
|
||||
<TextField
|
||||
onChange={inputForm}
|
||||
margin='dense'
|
||||
@@ -129,14 +135,11 @@ export default function SettingsDialog() {
|
||||
fullWidth
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={PreloadBuffer} onChange={inputForm} id='PreloadBuffer' color='primary' />}
|
||||
label={t('PreloadBuffer')}
|
||||
/>
|
||||
<br />
|
||||
<InputLabel htmlFor='RetrackersMode'>{t('RetrackersMode')}</InputLabel>
|
||||
<Select onChange={inputForm} type='number' native id='RetrackersMode' value={RetrackersMode}>
|
||||
<option value={0}>{t('DontAddRetrackers')}</option>
|
||||
<option value={1}>{t('AddRetrackers')}</option>
|
||||
<option value={2}>{t('RemoveRetrackers')}</option>
|
||||
<option value={3}>{t('ReplaceRetrackers')}</option>
|
||||
</Select>
|
||||
<TextField
|
||||
onChange={inputForm}
|
||||
margin='dense'
|
||||
@@ -146,91 +149,6 @@ export default function SettingsDialog() {
|
||||
type='number'
|
||||
fullWidth
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Switch checked={EnableIPv6} onChange={inputForm} id='EnableIPv6' color='primary' />}
|
||||
label={t('EnableIPv6')}
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={ForceEncrypt} onChange={inputForm} id='ForceEncrypt' color='primary' />}
|
||||
label={t('ForceEncrypt')}
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={DisableTCP} onChange={inputForm} id='DisableTCP' color='primary' />}
|
||||
label={t('DisableTCP')}
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={DisableUTP} onChange={inputForm} id='DisableUTP' color='primary' />}
|
||||
label={t('DisableUTP')}
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={DisableUPNP} onChange={inputForm} id='DisableUPNP' color='primary' />}
|
||||
label={t('DisableUPNP')}
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={DisableDHT} onChange={inputForm} id='DisableDHT' color='primary' />}
|
||||
label={t('DisableDHT')}
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={DisablePEX} onChange={inputForm} id='DisablePEX' color='primary' />}
|
||||
label={t('DisablePEX')}
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={DisableUpload} onChange={inputForm} id='DisableUpload' color='primary' />}
|
||||
label={t('DisableUpload')}
|
||||
/>
|
||||
<br />
|
||||
<TextField
|
||||
onChange={inputForm}
|
||||
margin='dense'
|
||||
id='DownloadRateLimit'
|
||||
label={t('DownloadRateLimit')}
|
||||
value={DownloadRateLimit}
|
||||
type='number'
|
||||
fullWidth
|
||||
/>
|
||||
<TextField
|
||||
onChange={inputForm}
|
||||
margin='dense'
|
||||
id='UploadRateLimit'
|
||||
label={t('UploadRateLimit')}
|
||||
value={UploadRateLimit}
|
||||
type='number'
|
||||
fullWidth
|
||||
/>
|
||||
<TextField
|
||||
onChange={inputForm}
|
||||
margin='dense'
|
||||
id='ConnectionsLimit'
|
||||
label={t('ConnectionsLimit')}
|
||||
value={ConnectionsLimit}
|
||||
type='number'
|
||||
fullWidth
|
||||
/>
|
||||
<TextField
|
||||
onChange={inputForm}
|
||||
margin='dense'
|
||||
id='DhtConnectionLimit'
|
||||
label={t('DhtConnectionLimit')}
|
||||
value={DhtConnectionLimit}
|
||||
type='number'
|
||||
fullWidth
|
||||
/>
|
||||
<TextField
|
||||
onChange={inputForm}
|
||||
margin='dense'
|
||||
id='PeersListenPort'
|
||||
label={t('PeersListenPort')}
|
||||
value={PeersListenPort}
|
||||
type='number'
|
||||
fullWidth
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={UseDisk} onChange={inputForm} id='UseDisk' color='primary' />}
|
||||
@@ -255,6 +173,105 @@ export default function SettingsDialog() {
|
||||
type='url'
|
||||
fullWidth
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={EnableIPv6} onChange={inputForm} id='EnableIPv6' color='primary' />}
|
||||
label={t('EnableIPv6')}
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={!DisableTCP} onChange={inputForm} id='DisableTCP' color='primary' />}
|
||||
label={t('TCP')}
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={!DisableUTP} onChange={inputForm} id='DisableUTP' color='primary' />}
|
||||
label={t('UTP')}
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={!DisablePEX} onChange={inputForm} id='DisablePEX' color='primary' />}
|
||||
label={t('PEX')}
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={ForceEncrypt} onChange={inputForm} id='ForceEncrypt' color='primary' />}
|
||||
label={t('ForceEncrypt')}
|
||||
/>
|
||||
<br />
|
||||
<TextField
|
||||
onChange={inputForm}
|
||||
margin='dense'
|
||||
id='ConnectionsLimit'
|
||||
label={t('ConnectionsLimit')}
|
||||
value={ConnectionsLimit}
|
||||
type='number'
|
||||
fullWidth
|
||||
/>
|
||||
<br />
|
||||
<TextField
|
||||
onChange={inputForm}
|
||||
margin='dense'
|
||||
id='DownloadRateLimit'
|
||||
label={t('DownloadRateLimit')}
|
||||
value={DownloadRateLimit}
|
||||
type='number'
|
||||
fullWidth
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={!DisableUpload} onChange={inputForm} id='DisableUpload' color='primary' />}
|
||||
label={t('Upload')}
|
||||
/>
|
||||
<br />
|
||||
<TextField
|
||||
onChange={inputForm}
|
||||
margin='dense'
|
||||
id='UploadRateLimit'
|
||||
label={t('UploadRateLimit')}
|
||||
value={UploadRateLimit}
|
||||
type='number'
|
||||
fullWidth
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={!DisableDHT} onChange={inputForm} id='DisableDHT' color='primary' />}
|
||||
label={t('DHT')}
|
||||
/>
|
||||
<br />
|
||||
<TextField
|
||||
onChange={inputForm}
|
||||
margin='dense'
|
||||
id='DhtConnectionLimit'
|
||||
label={t('DhtConnectionLimit')}
|
||||
value={DhtConnectionLimit}
|
||||
type='number'
|
||||
fullWidth
|
||||
/>
|
||||
<br />
|
||||
<TextField
|
||||
onChange={inputForm}
|
||||
margin='dense'
|
||||
id='PeersListenPort'
|
||||
label={t('PeersListenPort')}
|
||||
value={PeersListenPort}
|
||||
type='number'
|
||||
fullWidth
|
||||
/>
|
||||
<br />
|
||||
<FormControlLabel
|
||||
control={<Switch checked={!DisableUPNP} onChange={inputForm} id='DisableUPNP' color='primary' />}
|
||||
label={t('UPNP')}
|
||||
/>
|
||||
<br />
|
||||
<InputLabel htmlFor='RetrackersMode'>{t('RetrackersMode')}</InputLabel>
|
||||
<Select onChange={inputForm} type='number' native id='RetrackersMode' value={RetrackersMode}>
|
||||
<option value={0}>{t('DontAddRetrackers')}</option>
|
||||
<option value={1}>{t('AddRetrackers')}</option>
|
||||
<option value={2}>{t('RemoveRetrackers')}</option>
|
||||
<option value={3}>{t('ReplaceRetrackers')}</option>
|
||||
</Select>
|
||||
<br />
|
||||
</>
|
||||
)}
|
||||
</DialogContent>
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
"DeleteTorrents?": "Delete All Torrents?",
|
||||
"Details": "Details",
|
||||
"DhtConnectionLimit": "DHT Connection Limit",
|
||||
"DisableDHT": "Disable DHT",
|
||||
"DisablePEX": "Disable PEX",
|
||||
"DisableTCP": "Disable TCP",
|
||||
"DisableUpload": "Disable Upload",
|
||||
"DisableUPNP": "Disable UPNP",
|
||||
"DisableUTP": "Disable UTP",
|
||||
"DHT": "DHT (Distributed Hash Table)",
|
||||
"PEX": "PEX (Peer Exchange)",
|
||||
"TCP": "TCP (Transmission Control Protocol)",
|
||||
"Upload": "Upload (not recommended to disable)",
|
||||
"UPNP": "UPnP (Universal Plug and Play)",
|
||||
"UTP": "μTP (Micro Transport Protocol)",
|
||||
"Donate": "Donate",
|
||||
"DownloadRateLimit": "Download Rate Limit",
|
||||
"DownloadRateLimit": "Download Rate Limit (Kilobytes)",
|
||||
"Drop": "Drop",
|
||||
"EnableIPv6": "Enable IPv6",
|
||||
"EnableIPv6": "IPv6",
|
||||
"ForceEncrypt": "Force Encrypt Headers",
|
||||
"Host": "Host",
|
||||
"Name": "Name",
|
||||
@@ -47,6 +47,6 @@
|
||||
"TorrentDisconnectTimeout": "Torrent Disconnect Timeout",
|
||||
"TorrentsSavePath": "Torrents Save Path",
|
||||
"UploadFile": "Upload File",
|
||||
"UploadRateLimit": "Upload Rate Limit",
|
||||
"UploadRateLimit": "Upload Rate Limit (Kilobytes)",
|
||||
"UseDisk": "Use Disk"
|
||||
}
|
||||
@@ -5,34 +5,34 @@
|
||||
"Cancel": "Отмена",
|
||||
"Close": "Закрыть",
|
||||
"CloseServer": "Выкл. сервер",
|
||||
"ConnectionsLimit": "Торрент-соединения",
|
||||
"ConnectionsLimit": "Торрент-соединения (рек. 20-25)",
|
||||
"Delete": "Удалить",
|
||||
"DeleteTorrent?": "Удалить торрент?",
|
||||
"DeleteTorrents?": "Удалить все торренты?",
|
||||
"Details": "Информация",
|
||||
"Details": "Подробно",
|
||||
"DhtConnectionLimit": "Лимит подключений DHT",
|
||||
"DisableDHT": "Откл. DHT",
|
||||
"DisablePEX": "Откл. PEX",
|
||||
"DisableTCP": "Откл. TCP",
|
||||
"DisableUpload": "Откл. отдачу",
|
||||
"DisableUPNP": "Откл. UPNP",
|
||||
"DisableUTP": "Откл. UTP",
|
||||
"DHT": "DHT (Distributed Hash Table)",
|
||||
"PEX": "PEX (Peer Exchange)",
|
||||
"TCP": "TCP (Transmission Control Protocol)",
|
||||
"Upload": "Отдача (не рекомендуется отключать)",
|
||||
"UPNP": "UPnP (Universal Plug and Play)",
|
||||
"UTP": "μTP (Micro Transport Protocol)",
|
||||
"Donate": "Поддержка",
|
||||
"DownloadRateLimit": "Ограничение скорости загрузки",
|
||||
"DownloadRateLimit": "Ограничение скорости загрузки (Килобайты)",
|
||||
"Drop": "Отключить",
|
||||
"EnableIPv6": "Вкл. IPv6",
|
||||
"EnableIPv6": "IPv6",
|
||||
"ForceEncrypt": "Принудительное шифрование заголовков",
|
||||
"Host": "Хост",
|
||||
"Name": "Имя",
|
||||
"OK": "OK",
|
||||
"Peers": "Подключения",
|
||||
"Peers": "Подкл./Пиры",
|
||||
"PeersListenPort": "Порт для входящих подключений",
|
||||
"PlaylistAll": "Плейлист всех",
|
||||
"PreloadBuffer": "Наполнять кеш перед началом воспроизведения",
|
||||
"ReaderReadAHead": "Кеш предзагрузки (5-100%, рек.95%)",
|
||||
"ReaderReadAHead": "Кеш предзагрузки (5-100%, рек. 95%)",
|
||||
"RemoveAll": "Удалить все",
|
||||
"RemoveCacheOnDrop": "Очищать кеш на диске при отключении торрента",
|
||||
"RemoveCacheOnDropDesc": "Если отключено, кеш очищается при удалении торрента.",
|
||||
"RemoveCacheOnDropDesc": "Если отключено, кэш очищается при удалении торрента.",
|
||||
"RetrackersMode": "Ретрекеры",
|
||||
"DontAddRetrackers": "Ничего не делать",
|
||||
"AddRetrackers": "Добавлять",
|
||||
@@ -47,6 +47,6 @@
|
||||
"TorrentDisconnectTimeout": "Тайм-аут отключения торрента (секунды)",
|
||||
"TorrentsSavePath": "Путь хранения кеша",
|
||||
"UploadFile": "Загрузить файл",
|
||||
"UploadRateLimit": "Ограничение скорости отдачи",
|
||||
"UploadRateLimit": "Ограничение скорости отдачи (Килобайты)",
|
||||
"UseDisk": "Использовать кеш на диске"
|
||||
}
|
||||
Reference in New Issue
Block a user