Feature/settings add new socks proxy settings (#617)

* Add new socks settings

* [VersionMapping] Require server version "r1493" for preview
This commit is contained in:
schroda
2024-02-22 00:25:12 +01:00
committed by GitHub
parent ab0ecf4da0
commit 629b742140
7 changed files with 79 additions and 19 deletions

View File

@@ -16,14 +16,18 @@ import { useLocalStorage } from '@/util/useLocalStorage.tsx';
import { TextSetting } from '@/components/settings/text/TextSetting.tsx';
import { ServerSettings as GqlServerSettings } from '@/typings.ts';
import { NumberSetting } from '@/components/settings/NumberSetting.tsx';
import { SelectSetting } from '@/components/settings/SelectSetting.tsx';
type ServerSettingsType = Pick<
GqlServerSettings,
| 'ip'
| 'port'
| 'socksProxyEnabled'
| 'socksProxyVersion'
| 'socksProxyHost'
| 'socksProxyPort'
| 'socksProxyUsername'
| 'socksProxyPassword'
| 'debugLogsEnabled'
| 'gqlDebugLogsEnabled'
| 'systemTrayEnabled'
@@ -41,8 +45,11 @@ const extractServerSettings = (settings: GqlServerSettings): ServerSettingsType
ip: settings.ip,
port: settings.port,
socksProxyEnabled: settings.socksProxyEnabled,
socksProxyVersion: settings.socksProxyVersion,
socksProxyHost: settings.socksProxyHost,
socksProxyPort: settings.socksProxyPort,
socksProxyUsername: settings.socksProxyUsername,
socksProxyPassword: settings.socksProxyPassword,
debugLogsEnabled: settings.debugLogsEnabled,
gqlDebugLogsEnabled: settings.gqlDebugLogsEnabled,
systemTrayEnabled: settings.systemTrayEnabled,
@@ -144,6 +151,17 @@ export const ServerSettings = () => {
onChange={(e) => updateSetting('socksProxyEnabled', e.target.checked)}
/>
</ListItem>
<SelectSetting<number>
settingName={t('settings.server.socks_proxy.label.version')}
value={serverSettings?.socksProxyVersion}
defaultValue={5}
values={[
[4, { text: '4' }],
[5, { text: '5' }],
]}
handleChange={(socksProxyVersion) => updateSetting('socksProxyVersion', socksProxyVersion)}
disabled={!serverSettings?.socksProxyEnabled}
/>
<TextSetting
settingName={t('settings.server.socks_proxy.label.host')}
value={serverSettings?.socksProxyHost}
@@ -156,6 +174,19 @@ export const ServerSettings = () => {
handleChange={(proxyPort) => updateSetting('socksProxyPort', proxyPort)}
disabled={!serverSettings?.socksProxyEnabled}
/>
<TextSetting
settingName={t('settings.server.socks_proxy.label.username')}
value={serverSettings?.socksProxyUsername}
handleChange={(proxyUsername) => updateSetting('socksProxyUsername', proxyUsername)}
disabled={!serverSettings?.socksProxyEnabled}
/>
<TextSetting
settingName={t('settings.server.socks_proxy.label.password')}
value={serverSettings?.socksProxyPassword}
handleChange={(proxyPassword) => updateSetting('socksProxyPassword', proxyPassword)}
disabled={!serverSettings?.socksProxyEnabled}
isPassword
/>
</List>
<List
subheader={