From 629b742140e21ab7cd51abd947f32b8d6dc54780 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Thu, 22 Feb 2024 00:25:12 +0100 Subject: [PATCH] Feature/settings add new socks proxy settings (#617) * Add new socks settings * [VersionMapping] Require server version "r1493" for preview --- src/components/settings/SelectSetting.tsx | 14 +++++----- src/i18n/locale/en.json | 9 ++++-- src/lib/graphql/Fragments.ts | 3 ++ src/lib/graphql/generated/apollo-helpers.ts | 18 +++++++++--- src/lib/graphql/generated/graphql.ts | 21 +++++++++++--- src/screens/settings/ServerSettings.tsx | 31 +++++++++++++++++++++ versionToServerVersionMapping.json | 2 +- 7 files changed, 79 insertions(+), 19 deletions(-) diff --git a/src/components/settings/SelectSetting.tsx b/src/components/settings/SelectSetting.tsx index d8553ac5..587b057f 100644 --- a/src/components/settings/SelectSetting.tsx +++ b/src/components/settings/SelectSetting.tsx @@ -27,9 +27,9 @@ import InfoIcon from '@mui/icons-material/Info'; import { TranslationKey } from '@/typings.ts'; export type SelectSettingValueDisplayInfo = { - text: TranslationKey; - description?: TranslationKey; - disclaimer?: TranslationKey; + text: TranslationKey | string; + description?: TranslationKey | string; + disclaimer?: TranslationKey | string; }; export type SelectSettingValue = [Value: Value, DisplayInfo: SelectSettingValueDisplayInfo]; @@ -85,7 +85,7 @@ export const SelectSetting = ({ setIsDialogOpen(true)}> @@ -105,7 +105,7 @@ export const SelectSetting = ({ whiteSpace: 'pre-line', }} > - {t(dialogValueDisplayInfo.description)} + {t(dialogValueDisplayInfo.description as TranslationKey)} )} {dialogValueDisplayInfo.disclaimer && ( @@ -119,7 +119,7 @@ export const SelectSetting = ({ whiteSpace: 'pre-line', }} > - {t(dialogValueDisplayInfo.disclaimer)} + {t(dialogValueDisplayInfo.disclaimer as TranslationKey)} )} @@ -133,7 +133,7 @@ export const SelectSetting = ({ > {values.map(([selectValue, { text: selectText }]) => ( - {t(selectText)} + {t(selectText as TranslationKey)} ))} diff --git a/src/i18n/locale/en.json b/src/i18n/locale/en.json index b2f9cb8a..3f1b432d 100644 --- a/src/i18n/locale/en.json +++ b/src/i18n/locale/en.json @@ -888,9 +888,12 @@ }, "socks_proxy": { "label": { - "enable": "Use SOCKS5 proxy", - "host": "SOCKS5 host", - "port": "SOCKS5 port" + "enable": "Use SOCKS proxy", + "host": "SOCKS host", + "password": "SOCKS password", + "port": "SOCKS port", + "username": "SOCKS username", + "version": "SOCKS version" }, "title": "SOCKS proxy" }, diff --git a/src/lib/graphql/Fragments.ts b/src/lib/graphql/Fragments.ts index 7156c0db..6fbd10ba 100644 --- a/src/lib/graphql/Fragments.ts +++ b/src/lib/graphql/Fragments.ts @@ -475,8 +475,11 @@ export const SERVER_SETTINGS = gql` # Socks proxy socksProxyEnabled + socksProxyVersion socksProxyHost socksProxyPort + socksProxyUsername + socksProxyPassword # webUI webUIFlavor diff --git a/src/lib/graphql/generated/apollo-helpers.ts b/src/lib/graphql/generated/apollo-helpers.ts index 924a3253..db7e6db5 100644 --- a/src/lib/graphql/generated/apollo-helpers.ts +++ b/src/lib/graphql/generated/apollo-helpers.ts @@ -512,7 +512,7 @@ export type PageInfoFieldPolicy = { hasPreviousPage?: FieldPolicy | FieldReadFunction, startCursor?: FieldPolicy | FieldReadFunction }; -export type PartialSettingsTypeKeySpecifier = ('autoDownloadAheadLimit' | 'autoDownloadNewChapters' | 'autoDownloadNewChaptersLimit' | 'backupInterval' | 'backupPath' | 'backupTTL' | 'backupTime' | 'basicAuthEnabled' | 'basicAuthPassword' | 'basicAuthUsername' | 'debugLogsEnabled' | 'downloadAsCbz' | 'downloadsPath' | 'electronPath' | 'excludeCompleted' | 'excludeEntryWithUnreadChapters' | 'excludeNotStarted' | 'excludeUnreadChapters' | 'extensionRepos' | 'flareSolverrEnabled' | 'flareSolverrSessionName' | 'flareSolverrSessionTtl' | 'flareSolverrTimeout' | 'flareSolverrUrl' | 'globalUpdateInterval' | 'gqlDebugLogsEnabled' | 'initialOpenInBrowserEnabled' | 'ip' | 'localSourcePath' | 'maxSourcesInParallel' | 'port' | 'socksProxyEnabled' | 'socksProxyHost' | 'socksProxyPort' | 'systemTrayEnabled' | 'updateMangas' | 'webUIChannel' | 'webUIFlavor' | 'webUIInterface' | 'webUIUpdateCheckInterval' | PartialSettingsTypeKeySpecifier)[]; +export type PartialSettingsTypeKeySpecifier = ('autoDownloadAheadLimit' | 'autoDownloadNewChapters' | 'autoDownloadNewChaptersLimit' | 'backupInterval' | 'backupPath' | 'backupTTL' | 'backupTime' | 'basicAuthEnabled' | 'basicAuthPassword' | 'basicAuthUsername' | 'debugLogsEnabled' | 'downloadAsCbz' | 'downloadsPath' | 'electronPath' | 'excludeCompleted' | 'excludeEntryWithUnreadChapters' | 'excludeNotStarted' | 'excludeUnreadChapters' | 'extensionRepos' | 'flareSolverrEnabled' | 'flareSolverrSessionName' | 'flareSolverrSessionTtl' | 'flareSolverrTimeout' | 'flareSolverrUrl' | 'globalUpdateInterval' | 'gqlDebugLogsEnabled' | 'initialOpenInBrowserEnabled' | 'ip' | 'localSourcePath' | 'maxSourcesInParallel' | 'port' | 'socksProxyEnabled' | 'socksProxyHost' | 'socksProxyPassword' | 'socksProxyPort' | 'socksProxyUsername' | 'socksProxyVersion' | 'systemTrayEnabled' | 'updateMangas' | 'webUIChannel' | 'webUIFlavor' | 'webUIInterface' | 'webUIUpdateCheckInterval' | PartialSettingsTypeKeySpecifier)[]; export type PartialSettingsTypeFieldPolicy = { autoDownloadAheadLimit?: FieldPolicy | FieldReadFunction, autoDownloadNewChapters?: FieldPolicy | FieldReadFunction, @@ -547,7 +547,10 @@ export type PartialSettingsTypeFieldPolicy = { port?: FieldPolicy | FieldReadFunction, socksProxyEnabled?: FieldPolicy | FieldReadFunction, socksProxyHost?: FieldPolicy | FieldReadFunction, + socksProxyPassword?: FieldPolicy | FieldReadFunction, socksProxyPort?: FieldPolicy | FieldReadFunction, + socksProxyUsername?: FieldPolicy | FieldReadFunction, + socksProxyVersion?: FieldPolicy | FieldReadFunction, systemTrayEnabled?: FieldPolicy | FieldReadFunction, updateMangas?: FieldPolicy | FieldReadFunction, webUIChannel?: FieldPolicy | FieldReadFunction, @@ -646,7 +649,7 @@ export type SetSourceMetaPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, meta?: FieldPolicy | FieldReadFunction }; -export type SettingsKeySpecifier = ('autoDownloadAheadLimit' | 'autoDownloadNewChapters' | 'autoDownloadNewChaptersLimit' | 'backupInterval' | 'backupPath' | 'backupTTL' | 'backupTime' | 'basicAuthEnabled' | 'basicAuthPassword' | 'basicAuthUsername' | 'debugLogsEnabled' | 'downloadAsCbz' | 'downloadsPath' | 'electronPath' | 'excludeCompleted' | 'excludeEntryWithUnreadChapters' | 'excludeNotStarted' | 'excludeUnreadChapters' | 'extensionRepos' | 'flareSolverrEnabled' | 'flareSolverrSessionName' | 'flareSolverrSessionTtl' | 'flareSolverrTimeout' | 'flareSolverrUrl' | 'globalUpdateInterval' | 'gqlDebugLogsEnabled' | 'initialOpenInBrowserEnabled' | 'ip' | 'localSourcePath' | 'maxSourcesInParallel' | 'port' | 'socksProxyEnabled' | 'socksProxyHost' | 'socksProxyPort' | 'systemTrayEnabled' | 'updateMangas' | 'webUIChannel' | 'webUIFlavor' | 'webUIInterface' | 'webUIUpdateCheckInterval' | SettingsKeySpecifier)[]; +export type SettingsKeySpecifier = ('autoDownloadAheadLimit' | 'autoDownloadNewChapters' | 'autoDownloadNewChaptersLimit' | 'backupInterval' | 'backupPath' | 'backupTTL' | 'backupTime' | 'basicAuthEnabled' | 'basicAuthPassword' | 'basicAuthUsername' | 'debugLogsEnabled' | 'downloadAsCbz' | 'downloadsPath' | 'electronPath' | 'excludeCompleted' | 'excludeEntryWithUnreadChapters' | 'excludeNotStarted' | 'excludeUnreadChapters' | 'extensionRepos' | 'flareSolverrEnabled' | 'flareSolverrSessionName' | 'flareSolverrSessionTtl' | 'flareSolverrTimeout' | 'flareSolverrUrl' | 'globalUpdateInterval' | 'gqlDebugLogsEnabled' | 'initialOpenInBrowserEnabled' | 'ip' | 'localSourcePath' | 'maxSourcesInParallel' | 'port' | 'socksProxyEnabled' | 'socksProxyHost' | 'socksProxyPassword' | 'socksProxyPort' | 'socksProxyUsername' | 'socksProxyVersion' | 'systemTrayEnabled' | 'updateMangas' | 'webUIChannel' | 'webUIFlavor' | 'webUIInterface' | 'webUIUpdateCheckInterval' | SettingsKeySpecifier)[]; export type SettingsFieldPolicy = { autoDownloadAheadLimit?: FieldPolicy | FieldReadFunction, autoDownloadNewChapters?: FieldPolicy | FieldReadFunction, @@ -681,7 +684,10 @@ export type SettingsFieldPolicy = { port?: FieldPolicy | FieldReadFunction, socksProxyEnabled?: FieldPolicy | FieldReadFunction, socksProxyHost?: FieldPolicy | FieldReadFunction, + socksProxyPassword?: FieldPolicy | FieldReadFunction, socksProxyPort?: FieldPolicy | FieldReadFunction, + socksProxyUsername?: FieldPolicy | FieldReadFunction, + socksProxyVersion?: FieldPolicy | FieldReadFunction, systemTrayEnabled?: FieldPolicy | FieldReadFunction, updateMangas?: FieldPolicy | FieldReadFunction, webUIChannel?: FieldPolicy | FieldReadFunction, @@ -689,7 +695,7 @@ export type SettingsFieldPolicy = { webUIInterface?: FieldPolicy | FieldReadFunction, webUIUpdateCheckInterval?: FieldPolicy | FieldReadFunction }; -export type SettingsTypeKeySpecifier = ('autoDownloadAheadLimit' | 'autoDownloadNewChapters' | 'autoDownloadNewChaptersLimit' | 'backupInterval' | 'backupPath' | 'backupTTL' | 'backupTime' | 'basicAuthEnabled' | 'basicAuthPassword' | 'basicAuthUsername' | 'debugLogsEnabled' | 'downloadAsCbz' | 'downloadsPath' | 'electronPath' | 'excludeCompleted' | 'excludeEntryWithUnreadChapters' | 'excludeNotStarted' | 'excludeUnreadChapters' | 'extensionRepos' | 'flareSolverrEnabled' | 'flareSolverrSessionName' | 'flareSolverrSessionTtl' | 'flareSolverrTimeout' | 'flareSolverrUrl' | 'globalUpdateInterval' | 'gqlDebugLogsEnabled' | 'initialOpenInBrowserEnabled' | 'ip' | 'localSourcePath' | 'maxSourcesInParallel' | 'port' | 'socksProxyEnabled' | 'socksProxyHost' | 'socksProxyPort' | 'systemTrayEnabled' | 'updateMangas' | 'webUIChannel' | 'webUIFlavor' | 'webUIInterface' | 'webUIUpdateCheckInterval' | SettingsTypeKeySpecifier)[]; +export type SettingsTypeKeySpecifier = ('autoDownloadAheadLimit' | 'autoDownloadNewChapters' | 'autoDownloadNewChaptersLimit' | 'backupInterval' | 'backupPath' | 'backupTTL' | 'backupTime' | 'basicAuthEnabled' | 'basicAuthPassword' | 'basicAuthUsername' | 'debugLogsEnabled' | 'downloadAsCbz' | 'downloadsPath' | 'electronPath' | 'excludeCompleted' | 'excludeEntryWithUnreadChapters' | 'excludeNotStarted' | 'excludeUnreadChapters' | 'extensionRepos' | 'flareSolverrEnabled' | 'flareSolverrSessionName' | 'flareSolverrSessionTtl' | 'flareSolverrTimeout' | 'flareSolverrUrl' | 'globalUpdateInterval' | 'gqlDebugLogsEnabled' | 'initialOpenInBrowserEnabled' | 'ip' | 'localSourcePath' | 'maxSourcesInParallel' | 'port' | 'socksProxyEnabled' | 'socksProxyHost' | 'socksProxyPassword' | 'socksProxyPort' | 'socksProxyUsername' | 'socksProxyVersion' | 'systemTrayEnabled' | 'updateMangas' | 'webUIChannel' | 'webUIFlavor' | 'webUIInterface' | 'webUIUpdateCheckInterval' | SettingsTypeKeySpecifier)[]; export type SettingsTypeFieldPolicy = { autoDownloadAheadLimit?: FieldPolicy | FieldReadFunction, autoDownloadNewChapters?: FieldPolicy | FieldReadFunction, @@ -724,7 +730,10 @@ export type SettingsTypeFieldPolicy = { port?: FieldPolicy | FieldReadFunction, socksProxyEnabled?: FieldPolicy | FieldReadFunction, socksProxyHost?: FieldPolicy | FieldReadFunction, + socksProxyPassword?: FieldPolicy | FieldReadFunction, socksProxyPort?: FieldPolicy | FieldReadFunction, + socksProxyUsername?: FieldPolicy | FieldReadFunction, + socksProxyVersion?: FieldPolicy | FieldReadFunction, systemTrayEnabled?: FieldPolicy | FieldReadFunction, updateMangas?: FieldPolicy | FieldReadFunction, webUIChannel?: FieldPolicy | FieldReadFunction, @@ -871,12 +880,13 @@ export type TrackerNodeListFieldPolicy = { pageInfo?: FieldPolicy | FieldReadFunction, totalCount?: FieldPolicy | FieldReadFunction }; -export type TrackerTypeKeySpecifier = ('authUrl' | 'icon' | 'id' | 'isLoggedIn' | 'name' | 'scores' | 'statuses' | 'trackRecords' | TrackerTypeKeySpecifier)[]; +export type TrackerTypeKeySpecifier = ('authUrl' | 'icon' | 'id' | 'isLoggedIn' | 'isTokenExpired' | 'name' | 'scores' | 'statuses' | 'trackRecords' | TrackerTypeKeySpecifier)[]; export type TrackerTypeFieldPolicy = { authUrl?: FieldPolicy | FieldReadFunction, icon?: FieldPolicy | FieldReadFunction, id?: FieldPolicy | FieldReadFunction, isLoggedIn?: FieldPolicy | FieldReadFunction, + isTokenExpired?: FieldPolicy | FieldReadFunction, name?: FieldPolicy | FieldReadFunction, scores?: FieldPolicy | FieldReadFunction, statuses?: FieldPolicy | FieldReadFunction, diff --git a/src/lib/graphql/generated/graphql.ts b/src/lib/graphql/generated/graphql.ts index c5398a48..efcfb65c 100644 --- a/src/lib/graphql/generated/graphql.ts +++ b/src/lib/graphql/generated/graphql.ts @@ -1395,7 +1395,10 @@ export type PartialSettingsType = Settings & { port?: Maybe; socksProxyEnabled?: Maybe; socksProxyHost?: Maybe; + socksProxyPassword?: Maybe; socksProxyPort?: Maybe; + socksProxyUsername?: Maybe; + socksProxyVersion?: Maybe; systemTrayEnabled?: Maybe; updateMangas?: Maybe; webUIChannel?: Maybe; @@ -1437,7 +1440,10 @@ export type PartialSettingsTypeInput = { port?: InputMaybe; socksProxyEnabled?: InputMaybe; socksProxyHost?: InputMaybe; + socksProxyPassword?: InputMaybe; socksProxyPort?: InputMaybe; + socksProxyUsername?: InputMaybe; + socksProxyVersion?: InputMaybe; systemTrayEnabled?: InputMaybe; updateMangas?: InputMaybe; webUIChannel?: InputMaybe; @@ -1795,7 +1801,10 @@ export type Settings = { port?: Maybe; socksProxyEnabled?: Maybe; socksProxyHost?: Maybe; + socksProxyPassword?: Maybe; socksProxyPort?: Maybe; + socksProxyUsername?: Maybe; + socksProxyVersion?: Maybe; systemTrayEnabled?: Maybe; updateMangas?: Maybe; webUIChannel?: Maybe; @@ -1840,7 +1849,10 @@ export type SettingsType = Settings & { port: Scalars['Int']['output']; socksProxyEnabled: Scalars['Boolean']['output']; socksProxyHost: Scalars['String']['output']; + socksProxyPassword: Scalars['String']['output']; socksProxyPort: Scalars['String']['output']; + socksProxyUsername: Scalars['String']['output']; + socksProxyVersion: Scalars['Int']['output']; systemTrayEnabled: Scalars['Boolean']['output']; updateMangas: Scalars['Boolean']['output']; webUIChannel: WebUiChannel; @@ -2171,6 +2183,7 @@ export type TrackerType = { icon: Scalars['String']['output']; id: Scalars['Int']['output']; isLoggedIn: Scalars['Boolean']['output']; + isTokenExpired: Scalars['Boolean']['output']; name: Scalars['String']['output']; scores: Array; statuses: Array; @@ -2544,7 +2557,7 @@ export type WebuiUpdateInfoFragment = { __typename?: 'WebUIUpdateInfo', channel: export type WebuiUpdateStatusFragment = { __typename?: 'WebUIUpdateStatus', progress: number, state: UpdateState, info: { __typename?: 'WebUIUpdateInfo', channel: string, tag: string } }; -export type ServerSettingsFragment = { __typename?: 'SettingsType', ip: string, port: number, socksProxyEnabled: boolean, socksProxyHost: string, socksProxyPort: string, webUIFlavor: WebUiFlavor, initialOpenInBrowserEnabled: boolean, webUIInterface: WebUiInterface, electronPath: string, webUIChannel: WebUiChannel, webUIUpdateCheckInterval: number, downloadAsCbz: boolean, downloadsPath: string, autoDownloadNewChapters: boolean, excludeEntryWithUnreadChapters: boolean, autoDownloadNewChaptersLimit: number, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, basicAuthEnabled: boolean, basicAuthUsername: string, basicAuthPassword: string, debugLogsEnabled: boolean, gqlDebugLogsEnabled: boolean, systemTrayEnabled: boolean, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number }; +export type ServerSettingsFragment = { __typename?: 'SettingsType', ip: string, port: number, socksProxyEnabled: boolean, socksProxyVersion: number, socksProxyHost: string, socksProxyPort: string, socksProxyUsername: string, socksProxyPassword: string, webUIFlavor: WebUiFlavor, initialOpenInBrowserEnabled: boolean, webUIInterface: WebUiInterface, electronPath: string, webUIChannel: WebUiChannel, webUIUpdateCheckInterval: number, downloadAsCbz: boolean, downloadsPath: string, autoDownloadNewChapters: boolean, excludeEntryWithUnreadChapters: boolean, autoDownloadNewChaptersLimit: number, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, basicAuthEnabled: boolean, basicAuthUsername: string, basicAuthPassword: string, debugLogsEnabled: boolean, gqlDebugLogsEnabled: boolean, systemTrayEnabled: boolean, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number }; export type CreateBackupMutationVariables = Exact<{ input: CreateBackupInput; @@ -2863,14 +2876,14 @@ export type ResetServerSettingsMutationVariables = Exact<{ }>; -export type ResetServerSettingsMutation = { __typename?: 'Mutation', resetSettings: { __typename?: 'ResetSettingsPayload', clientMutationId?: string | null, settings: { __typename?: 'SettingsType', ip: string, port: number, socksProxyEnabled: boolean, socksProxyHost: string, socksProxyPort: string, webUIFlavor: WebUiFlavor, initialOpenInBrowserEnabled: boolean, webUIInterface: WebUiInterface, electronPath: string, webUIChannel: WebUiChannel, webUIUpdateCheckInterval: number, downloadAsCbz: boolean, downloadsPath: string, autoDownloadNewChapters: boolean, excludeEntryWithUnreadChapters: boolean, autoDownloadNewChaptersLimit: number, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, basicAuthEnabled: boolean, basicAuthUsername: string, basicAuthPassword: string, debugLogsEnabled: boolean, gqlDebugLogsEnabled: boolean, systemTrayEnabled: boolean, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number } } }; +export type ResetServerSettingsMutation = { __typename?: 'Mutation', resetSettings: { __typename?: 'ResetSettingsPayload', clientMutationId?: string | null, settings: { __typename?: 'SettingsType', ip: string, port: number, socksProxyEnabled: boolean, socksProxyVersion: number, socksProxyHost: string, socksProxyPort: string, socksProxyUsername: string, socksProxyPassword: string, webUIFlavor: WebUiFlavor, initialOpenInBrowserEnabled: boolean, webUIInterface: WebUiInterface, electronPath: string, webUIChannel: WebUiChannel, webUIUpdateCheckInterval: number, downloadAsCbz: boolean, downloadsPath: string, autoDownloadNewChapters: boolean, excludeEntryWithUnreadChapters: boolean, autoDownloadNewChaptersLimit: number, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, basicAuthEnabled: boolean, basicAuthUsername: string, basicAuthPassword: string, debugLogsEnabled: boolean, gqlDebugLogsEnabled: boolean, systemTrayEnabled: boolean, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number } } }; export type UpdateServerSettingsMutationVariables = Exact<{ input: SetSettingsInput; }>; -export type UpdateServerSettingsMutation = { __typename?: 'Mutation', setSettings: { __typename?: 'SetSettingsPayload', clientMutationId?: string | null, settings: { __typename?: 'SettingsType', ip: string, port: number, socksProxyEnabled: boolean, socksProxyHost: string, socksProxyPort: string, webUIFlavor: WebUiFlavor, initialOpenInBrowserEnabled: boolean, webUIInterface: WebUiInterface, electronPath: string, webUIChannel: WebUiChannel, webUIUpdateCheckInterval: number, downloadAsCbz: boolean, downloadsPath: string, autoDownloadNewChapters: boolean, excludeEntryWithUnreadChapters: boolean, autoDownloadNewChaptersLimit: number, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, basicAuthEnabled: boolean, basicAuthUsername: string, basicAuthPassword: string, debugLogsEnabled: boolean, gqlDebugLogsEnabled: boolean, systemTrayEnabled: boolean, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number } } }; +export type UpdateServerSettingsMutation = { __typename?: 'Mutation', setSettings: { __typename?: 'SetSettingsPayload', clientMutationId?: string | null, settings: { __typename?: 'SettingsType', ip: string, port: number, socksProxyEnabled: boolean, socksProxyVersion: number, socksProxyHost: string, socksProxyPort: string, socksProxyUsername: string, socksProxyPassword: string, webUIFlavor: WebUiFlavor, initialOpenInBrowserEnabled: boolean, webUIInterface: WebUiInterface, electronPath: string, webUIChannel: WebUiChannel, webUIUpdateCheckInterval: number, downloadAsCbz: boolean, downloadsPath: string, autoDownloadNewChapters: boolean, excludeEntryWithUnreadChapters: boolean, autoDownloadNewChaptersLimit: number, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, basicAuthEnabled: boolean, basicAuthUsername: string, basicAuthPassword: string, debugLogsEnabled: boolean, gqlDebugLogsEnabled: boolean, systemTrayEnabled: boolean, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number } } }; export type GetSourceMangasFetchMutationVariables = Exact<{ input: FetchSourceMangaInput; @@ -3092,7 +3105,7 @@ export type GetWebuiUpdateStatusQuery = { __typename?: 'Query', getWebUIUpdateSt export type GetServerSettingsQueryVariables = Exact<{ [key: string]: never; }>; -export type GetServerSettingsQuery = { __typename?: 'Query', settings: { __typename?: 'SettingsType', ip: string, port: number, socksProxyEnabled: boolean, socksProxyHost: string, socksProxyPort: string, webUIFlavor: WebUiFlavor, initialOpenInBrowserEnabled: boolean, webUIInterface: WebUiInterface, electronPath: string, webUIChannel: WebUiChannel, webUIUpdateCheckInterval: number, downloadAsCbz: boolean, downloadsPath: string, autoDownloadNewChapters: boolean, excludeEntryWithUnreadChapters: boolean, autoDownloadNewChaptersLimit: number, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, basicAuthEnabled: boolean, basicAuthUsername: string, basicAuthPassword: string, debugLogsEnabled: boolean, gqlDebugLogsEnabled: boolean, systemTrayEnabled: boolean, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number } }; +export type GetServerSettingsQuery = { __typename?: 'Query', settings: { __typename?: 'SettingsType', ip: string, port: number, socksProxyEnabled: boolean, socksProxyVersion: number, socksProxyHost: string, socksProxyPort: string, socksProxyUsername: string, socksProxyPassword: string, webUIFlavor: WebUiFlavor, initialOpenInBrowserEnabled: boolean, webUIInterface: WebUiInterface, electronPath: string, webUIChannel: WebUiChannel, webUIUpdateCheckInterval: number, downloadAsCbz: boolean, downloadsPath: string, autoDownloadNewChapters: boolean, excludeEntryWithUnreadChapters: boolean, autoDownloadNewChaptersLimit: number, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, basicAuthEnabled: boolean, basicAuthUsername: string, basicAuthPassword: string, debugLogsEnabled: boolean, gqlDebugLogsEnabled: boolean, systemTrayEnabled: boolean, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number } }; export type GetSourceQueryVariables = Exact<{ id: Scalars['LongString']['input']; diff --git a/src/screens/settings/ServerSettings.tsx b/src/screens/settings/ServerSettings.tsx index 09327ea5..0b9cddff 100644 --- a/src/screens/settings/ServerSettings.tsx +++ b/src/screens/settings/ServerSettings.tsx @@ -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)} /> + + 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} + /> { handleChange={(proxyPort) => updateSetting('socksProxyPort', proxyPort)} disabled={!serverSettings?.socksProxyEnabled} /> + updateSetting('socksProxyUsername', proxyUsername)} + disabled={!serverSettings?.socksProxyEnabled} + /> + updateSetting('socksProxyPassword', proxyPassword)} + disabled={!serverSettings?.socksProxyEnabled} + isPassword + />