diff --git a/src/features/backup/screens/Backup.tsx b/src/features/backup/screens/Backup.tsx index 43d45c02..1c51ce5f 100644 --- a/src/features/backup/screens/Backup.tsx +++ b/src/features/backup/screens/Backup.tsx @@ -42,13 +42,6 @@ import { BrowseTab } from '@/features/browse/Browse.types.ts'; type BackupSettingsType = Pick; -const extractBackupSettings = (settings: ServerSettings): BackupSettingsType => ({ - backupPath: settings.backupPath, - backupTime: settings.backupTime, - backupInterval: settings.backupInterval, - backupTTL: settings.backupTTL, -}); - const getBackupCleanupDisplayValue = (ttl: number): string => { if (ttl === 0) { return translate('global.label.never'); @@ -224,7 +217,7 @@ export function Backup() { ); } - const backupSettings = extractBackupSettings(settingsData!.settings); + const backupSettings = settingsData!.settings; return ( <> diff --git a/src/features/browse/screens/BrowseSettings.tsx b/src/features/browse/screens/BrowseSettings.tsx index c2467a7d..0b4fcfa3 100644 --- a/src/features/browse/screens/BrowseSettings.tsx +++ b/src/features/browse/screens/BrowseSettings.tsx @@ -30,12 +30,6 @@ import { useAppTitle } from '@/features/navigation-bar/hooks/useAppTitle.ts'; type ExtensionsSettings = Pick; -const extractBrowseSettings = (settings: GqlServerSettings): ExtensionsSettings => ({ - maxSourcesInParallel: settings.maxSourcesInParallel, - localSourcePath: settings.localSourcePath, - extensionRepos: settings.extensionRepos, -}); - export const BrowseSettings = () => { const { t } = useTranslation(); @@ -76,7 +70,7 @@ export const BrowseSettings = () => { ); } - const serverSettings = extractBrowseSettings(data!.settings); + const serverSettings = data!.settings; return ( diff --git a/src/features/downloads/screens/DownloadSettings.tsx b/src/features/downloads/screens/DownloadSettings.tsx index 4d10ddcb..4d639820 100644 --- a/src/features/downloads/screens/DownloadSettings.tsx +++ b/src/features/downloads/screens/DownloadSettings.tsx @@ -45,16 +45,6 @@ type DownloadSettingsType = Pick< | 'downloadConversions' >; -const extractDownloadSettings = (settings: ServerSettings): DownloadSettingsType => ({ - downloadAsCbz: settings.downloadAsCbz, - downloadsPath: settings.downloadsPath, - autoDownloadNewChapters: settings.autoDownloadNewChapters, - autoDownloadNewChaptersLimit: settings.autoDownloadNewChaptersLimit, - excludeEntryWithUnreadChapters: settings.excludeEntryWithUnreadChapters, - autoDownloadIgnoreReUploads: settings.autoDownloadIgnoreReUploads, - downloadConversions: settings.downloadConversions, -}); - export const DownloadSettings = () => { const { t } = useTranslation(); @@ -103,7 +93,7 @@ export const DownloadSettings = () => { ); } - const downloadSettings = extractDownloadSettings(serverSettings.data!.settings); + const downloadSettings = serverSettings.data!.settings; const updateSetting = ( setting: Setting, diff --git a/src/features/settings/Settings.types.ts b/src/features/settings/Settings.types.ts index 115c90bf..54f252ae 100644 --- a/src/features/settings/Settings.types.ts +++ b/src/features/settings/Settings.types.ts @@ -16,7 +16,6 @@ import { MetadataUpdateSettings } from '@/features/app-updates/AppUpdateChecker. import { MetadataThemeSettings } from '@/features/theme/AppTheme.types.ts'; import { GetServerSettingsQuery } from '@/lib/graphql/generated/graphql.ts'; import { MetadataHistorySettings } from '@/features/history/History.types.ts'; -import { ServerSettings as GqlServerSettings } from '@/features/settings/Settings.types.ts'; export type MetadataServerSettingKeys = keyof MetadataServerSettings; @@ -37,52 +36,6 @@ export interface ISearchSettings { } export type ServerSettings = Omit; -export type ServerSettingsType = Pick< - GqlServerSettings, - | 'ip' - | 'port' - | 'socksProxyEnabled' - | 'socksProxyVersion' - | 'socksProxyHost' - | 'socksProxyPort' - | 'socksProxyUsername' - | 'socksProxyPassword' - | 'debugLogsEnabled' - | 'systemTrayEnabled' - | 'maxLogFiles' - | 'maxLogFileSize' - | 'maxLogFolderSize' - | 'authMode' - | 'authUsername' - | 'authPassword' - | 'jwtAudience' - | 'jwtTokenExpiry' - | 'jwtRefreshExpiry' - | 'flareSolverrEnabled' - | 'flareSolverrTimeout' - | 'flareSolverrUrl' - | 'flareSolverrSessionName' - | 'flareSolverrSessionTtl' - | 'flareSolverrAsResponseFallback' - | 'opdsUseBinaryFileSizes' - | 'opdsItemsPerPage' - | 'opdsEnablePageReadProgress' - | 'opdsMarkAsReadOnDownload' - | 'opdsShowOnlyUnreadChapters' - | 'opdsShowOnlyDownloadedChapters' - | 'opdsChapterSortOrder' - | 'koreaderSyncServerUrl' - | 'koreaderSyncUsername' - | 'koreaderSyncUserkey' - | 'koreaderSyncDeviceId' - | 'koreaderSyncChecksumMethod' - | 'koreaderSyncStrategy' - | 'koreaderSyncPercentageTolerance' - | 'databaseType' - | 'databaseUrl' - | 'databaseUsername' - | 'databasePassword' ->; export type WebUISettingsType = Pick< ServerSettings, diff --git a/src/features/settings/components/globalUpdate/GlobalUpdateSettingsEntries.tsx b/src/features/settings/components/globalUpdate/GlobalUpdateSettingsEntries.tsx index 1e8ad7fb..b823ce7e 100644 --- a/src/features/settings/components/globalUpdate/GlobalUpdateSettingsEntries.tsx +++ b/src/features/settings/components/globalUpdate/GlobalUpdateSettingsEntries.tsx @@ -47,16 +47,10 @@ const getSkipMangasText = (settings: GlobalUpdateSkipEntriesSettings) => { return skipSettings.join(', '); }; -const extractSkipEntriesSettings = (serverSettings: ServerSettings): GlobalUpdateSkipEntriesSettings => ({ - excludeCompleted: serverSettings.excludeCompleted, - excludeNotStarted: serverSettings.excludeNotStarted, - excludeUnreadChapters: serverSettings.excludeUnreadChapters, -}); - export const GlobalUpdateSettingsEntries = ({ serverSettings }: { serverSettings: ServerSettings }) => { const { t } = useTranslation(); - const globalUpdateSettings = extractSkipEntriesSettings(serverSettings); + const globalUpdateSettings = serverSettings; const [mutateSettings] = requestManager.useUpdateServerSettings(); const [dialogSettings, setDialogSettings] = useState( diff --git a/src/features/settings/screens/ServerSettings.tsx b/src/features/settings/screens/ServerSettings.tsx index f9a01dd9..6e82ac03 100644 --- a/src/features/settings/screens/ServerSettings.tsx +++ b/src/features/settings/screens/ServerSettings.tsx @@ -29,7 +29,6 @@ import { } from '@/features/settings/services/ServerSettingsMetadata.ts'; import { makeToast } from '@/base/utils/Toast.ts'; import { MetadataUpdateSettings } from '@/features/app-updates/AppUpdateChecker.types.ts'; -import { ServerSettings as GqlServerSettings, ServerSettingsType } from '@/features/settings/Settings.types.ts'; import { getErrorMessage } from '@/lib/HelperFunctions.ts'; import { useAppTitle } from '@/features/navigation-bar/hooks/useAppTitle.ts'; import { @@ -47,52 +46,7 @@ import { } from '@/features/settings/Settings.constants.ts'; import { ServerAddressSetting } from '@/features/settings/components/ServerAddressSetting.tsx'; import { AuthManager } from '@/features/authentication/AuthManager.ts'; - -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, - systemTrayEnabled: settings.systemTrayEnabled, - maxLogFiles: settings.maxLogFiles, - maxLogFileSize: settings.maxLogFileSize, - maxLogFolderSize: settings.maxLogFolderSize, - authMode: settings.authMode, - authUsername: settings.authUsername, - authPassword: settings.authPassword, - jwtAudience: settings.jwtAudience, - jwtTokenExpiry: settings.jwtTokenExpiry, - jwtRefreshExpiry: settings.jwtRefreshExpiry, - flareSolverrEnabled: settings.flareSolverrEnabled, - flareSolverrTimeout: settings.flareSolverrTimeout, - flareSolverrUrl: settings.flareSolverrUrl, - flareSolverrSessionName: settings.flareSolverrSessionName, - flareSolverrSessionTtl: settings.flareSolverrSessionTtl, - flareSolverrAsResponseFallback: settings.flareSolverrAsResponseFallback, - opdsUseBinaryFileSizes: settings.opdsUseBinaryFileSizes, - opdsItemsPerPage: settings.opdsItemsPerPage, - opdsEnablePageReadProgress: settings.opdsEnablePageReadProgress, - opdsMarkAsReadOnDownload: settings.opdsMarkAsReadOnDownload, - opdsShowOnlyUnreadChapters: settings.opdsShowOnlyUnreadChapters, - opdsShowOnlyDownloadedChapters: settings.opdsShowOnlyDownloadedChapters, - opdsChapterSortOrder: settings.opdsChapterSortOrder, - koreaderSyncServerUrl: settings.koreaderSyncServerUrl, - koreaderSyncUsername: settings.koreaderSyncUsername, - koreaderSyncUserkey: settings.koreaderSyncUserkey, - koreaderSyncDeviceId: settings.koreaderSyncDeviceId, - koreaderSyncChecksumMethod: settings.koreaderSyncChecksumMethod, - koreaderSyncStrategy: settings.koreaderSyncStrategy, - koreaderSyncPercentageTolerance: settings.koreaderSyncPercentageTolerance, - databaseType: settings.databaseType, - databaseUrl: settings.databaseUrl, - databaseUsername: settings.databaseUsername, - databasePassword: settings.databasePassword, -}); +import { ServerSettings as ServerSettingsType } from '@/features/settings/Settings.types.ts'; const getLogFilesCleanupDisplayValue = (ttl: number): string => { if (ttl === 0) { @@ -202,7 +156,7 @@ export const ServerSettings = () => { ); } - const serverSettings = extractServerSettings(data!.settings); + const serverSettings = data!.settings; const authModeDisabled = !serverSettings.authUsername?.trim() || !serverSettings.authPassword?.trim(); const isH2Database = serverSettings.databaseType === DatabaseType.H2; diff --git a/src/features/settings/screens/WebUISettings.tsx b/src/features/settings/screens/WebUISettings.tsx index 967c8fde..6a07e7b5 100644 --- a/src/features/settings/screens/WebUISettings.tsx +++ b/src/features/settings/screens/WebUISettings.tsx @@ -25,7 +25,7 @@ import { } from '@/features/settings/services/ServerSettingsMetadata.ts'; import { makeToast } from '@/base/utils/Toast.ts'; import { MetadataUpdateSettings } from '@/features/app-updates/AppUpdateChecker.types.ts'; -import { ServerSettings, WebUISettingsType } from '@/features/settings/Settings.types.ts'; +import { WebUISettingsType } from '@/features/settings/Settings.types.ts'; import { getErrorMessage } from '@/lib/HelperFunctions.ts'; import { useAppTitle } from '@/features/navigation-bar/hooks/useAppTitle.ts'; import { @@ -34,15 +34,6 @@ import { WEB_UI_INTERFACE_SELECT_VALUES, } from '@/features/settings/Settings.constants.ts'; -const extractWebUISettings = (settings: ServerSettings): WebUISettingsType => ({ - webUIFlavor: settings.webUIFlavor, - initialOpenInBrowserEnabled: settings.initialOpenInBrowserEnabled, - webUIInterface: settings.webUIInterface, - electronPath: settings.electronPath, - webUIChannel: settings.webUIChannel, - webUIUpdateCheckInterval: settings.webUIUpdateCheckInterval, -}); - export const WebUISettings = () => { const { t } = useTranslation(); @@ -108,7 +99,7 @@ export const WebUISettings = () => { ); } - const webUISettings = extractWebUISettings(data!.settings); + const webUISettings = data!.settings; const isCustomWebUI = webUISettings.webUIFlavor === WebUiFlavor.Custom; return (