diff --git a/src/base/components/modals/ConfirmDialog.tsx b/src/base/components/modals/ConfirmDialog.tsx index 403b107a..928d73c0 100644 --- a/src/base/components/modals/ConfirmDialog.tsx +++ b/src/base/components/modals/ConfirmDialog.tsx @@ -15,10 +15,11 @@ import Stack from '@mui/material/Stack'; import type { AwaitableComponentProps } from 'awaitable-component'; import { Link as RouterLink } from 'react-router-dom'; import { useLingui } from '@lingui/react/macro'; +import type { ReactNode } from 'react'; type Action = { show?: boolean; - title?: string; + title?: ReactNode; contain?: boolean; }; @@ -38,8 +39,8 @@ export const ConfirmDialog = ({ isVisible, onExitComplete, }: AwaitableComponentProps & { - title: string; - message: string; + title: ReactNode; + message: ReactNode; actions?: Actions; onExtra?: () => void; }) => { diff --git a/src/features/settings/screens/ServerSettings.tsx b/src/features/settings/screens/ServerSettings.tsx index 36072606..3433ae03 100644 --- a/src/features/settings/screens/ServerSettings.tsx +++ b/src/features/settings/screens/ServerSettings.tsx @@ -41,6 +41,7 @@ import { ServerAddressSetting } from '@/features/settings/components/ServerAddre import { AuthManager } from '@/features/authentication/AuthManager.ts'; import type { ServerSettings as ServerSettingsType } from '@/features/settings/Settings.types.ts'; import { KoreaderSyncSettings } from '@/features/settings/components/koreaderSync/KoreaderSyncSettings.tsx'; +import { Confirmation } from '@/base/AppAwaitableComponent.ts'; const getLogFilesCleanupDisplayValue = (ttl: number): string => { if (ttl === 0) { @@ -346,7 +347,70 @@ export const ServerSettings = () => { updateSetting('flareSolverrEnabled', e.target.checked)} + onChange={async (e) => { + const enabled = e.target.checked; + + if (!enabled) { + updateSetting('flareSolverrEnabled', enabled); + return; + } + + try { + await Confirmation.show({ + title: t`Flaresolverr setup confirmation`, + message: ( + + Flaresolverr is a{' '} + + separate + + , Suwayomi{' '} + + unrelated + {' '} + program that needs to be manually{' '} + + installed + {' '} + and{' '} + + run + + .
+ See{' '} + + FlareSolverr + {' '} + for information on how to set it up +
+
+ If it is{' '} + + not + {' '} + properly set up and running, enabling this setting{' '} + + won't + {' '} + do anything +
+ ), + actions: { + confirm: { + title: t`I understand`, + }, + }, + }); + + updateSetting('flareSolverrEnabled', enabled); + } catch (_) { + // Ignore + } + }} /> <1>separate, Suwayomi <2><3>unrelated program that needs to be manually <4><5>installed and <6><7>run.<8/>See <9>FlareSolverr for information on how to set it up<10/><11/>If it is <12><13>not properly set up and running, enabling this setting <14><15>won't do anything" +msgstr "Flaresolverr is a <0><1>separate, Suwayomi <2><3>unrelated program that needs to be manually <4><5>installed and <6><7>run.<8/>See <9>FlareSolverr for information on how to set it up<10/><11/>If it is <12><13>not properly set up and running, enabling this setting <14><15>won't do anything" + #: src/features/settings/screens/ServerSettings.tsx msgid "FlareSolverr request timeout" msgstr "FlareSolverr request timeout" @@ -1603,6 +1607,10 @@ msgstr "FlareSolverr session name" msgid "FlareSolverr session TTL" msgstr "FlareSolverr session TTL" +#: src/features/settings/screens/ServerSettings.tsx +msgid "Flaresolverr setup confirmation" +msgstr "Flaresolverr setup confirmation" + #: src/features/settings/screens/ServerSettings.tsx msgid "FlareSolverr will automatically rotate expired sessions based on the TTL provided in minutes" msgstr "FlareSolverr will automatically rotate expired sessions based on the TTL provided in minutes" @@ -1733,6 +1741,10 @@ msgstr "How many chapters should get downloaded while reading." msgid "How much time FlareSolverr has to handle the request" msgstr "How much time FlareSolverr has to handle the request" +#: src/features/settings/screens/ServerSettings.tsx +msgid "I understand" +msgstr "I understand" + #: src/features/app-updates/components/VersionUpdateInfoDialog.tsx msgid "Ignore" msgstr "Ignore"