From 84cfa6bea52a4d22834d6d336e393159856c24c5 Mon Sep 17 00:00:00 2001 From: Zeedif Date: Sat, 6 Dec 2025 12:59:39 -0600 Subject: [PATCH] Update KOReader Sync settings (#1030) * feat(settings): refactor and implement KOReader Sync settings page Refactors the KOReader Sync settings section into its own dedicated page and implements the full connection and configuration flow. The previous implementation in the main server settings was outdated and incomplete. This change aligns the frontend with the latest backend logic and provides a complete user experience. Key changes include: - Separated the UI into two states: a login form for initial connection and a configuration panel for existing connections. - Implemented `connectKoSyncAccount` and `logoutKoSyncAccount` mutations to handle authentication with the KOReader Sync server. - Updated the `SERVER_SETTINGS` GraphQL fragment to use the new `koreaderSyncStrategyForward` and `koreaderSyncStrategyBackward` fields, removing the deprecated `koreaderSyncStrategy`. - Moved all KOReader Sync settings from the generic Server Settings page to a dedicated route at `/settings/koreader-sync`. - Restructured and improved i18n keys for better clarity and consistency. Ran `yarn gql:codegen` to regenerate GraphQL types and helpers. * Extract credentials login into component * Update to server changes and cleanup --------- Co-authored-by: schroda <50052685+schroda@users.noreply.github.com> --- public/locales/en.json | 44 ++-- src/base/components/modals/LoginDialog.tsx | 111 ++++++++++ src/features/settings/Settings.constants.ts | 51 ++++- .../koreaderSync/KoreaderSyncSettings.tsx | 203 ++++++++++++++++++ .../settings/screens/ServerSettings.tsx | 111 ++-------- .../components/cards/SettingsTrackerCard.tsx | 195 ++++++++--------- .../tracker/screens/TrackerOAuthLogin.tsx | 17 +- .../fragments/KoreaderSyncFragments.ts | 17 ++ .../graphql/fragments/SettingsFragments.ts | 7 +- src/lib/graphql/generated/apollo-helpers.ts | 78 +++++-- src/lib/graphql/generated/graphql.ts | 145 ++++++++++--- .../graphql/mutations/KoreaderSyncMutation.ts | 35 +++ src/lib/graphql/queries/KoreaderSyncQuery.ts | 20 ++ src/lib/requests/RequestManager.ts | 73 +++++-- src/lib/requests/client/GraphQLClient.ts | 1 + versionToServerVersionMapping.json | 5 + 16 files changed, 829 insertions(+), 284 deletions(-) create mode 100644 src/base/components/modals/LoginDialog.tsx create mode 100644 src/features/settings/components/koreaderSync/KoreaderSyncSettings.tsx create mode 100644 src/lib/graphql/fragments/KoreaderSyncFragments.ts create mode 100644 src/lib/graphql/mutations/KoreaderSyncMutation.ts create mode 100644 src/lib/graphql/queries/KoreaderSyncQuery.ts diff --git a/public/locales/en.json b/public/locales/en.json index 21045a40..9ec74c71 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -471,6 +471,7 @@ "load_in_progress": "Still loading required data…", "loading": "Loading…", "logged_in": "Logged in", + "logged_out": "Logged out", "medium": "Medium", "menu": "Menu", "mobile": "Mobile", @@ -1424,25 +1425,40 @@ "check_sum_method": { "binary": "Binary", "filename": "Filename", - "title": "Check sum method" + "title": "Document matching method" }, + "connection": { + "connect": "Connect to KOReader Sync server", + "connected": "Connected as {{username}} to {{serverAddress}}", + "disconnect": "Disconnect from KOReader Sync server", + "disconnected": "Disconnected", + "message": { + "connect_error": "Failed to connect to KOReader Sync server.", + "connect_success": "Successfully connected to KOReader Sync server.", + "disconnect_error": "Failed to disconnect from KOReader Sync server.", + "disconnect_success": "Successfully disconnected from KOReader Sync server." + }, + "status": "Sync status" + }, + "description": "Synchronize reading progress with KOReader devices.", "device_id": "Device ID", - "server_address": "Server url", + "device_name": "Device Name", + "server_address": "Server address", "strategy": { - "disabled": "Disabled", - "prompt": "Prompt", - "receive": "Receive", - "send": "Send", - "silent": "Silent", - "title": "Sync strategy" + "backward_title": "Sync to an older state", + "forward_title": "Sync to a newer state", + "option": { + "disabled": "Disabled", + "keep_local": "Keep local", + "keep_remote": "Keep remote", + "prompt": "Prompt" + } }, - "title": "KOReader sync", + "title": "KOReader Sync", "tolerance": { - "description": "Absolute tolerance for progress comparison", - "title": "Tolerance" - }, - "user_key": "User key", - "username": "$t(global.label.username)" + "description": "Sync will not be triggered if the progress difference is within this tolerance.", + "title": "Percentage Tolerance" + } } }, "local_source": { diff --git a/src/base/components/modals/LoginDialog.tsx b/src/base/components/modals/LoginDialog.tsx new file mode 100644 index 00000000..44536669 --- /dev/null +++ b/src/base/components/modals/LoginDialog.tsx @@ -0,0 +1,111 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import Dialog from '@mui/material/Dialog'; +import { AwaitableComponent, AwaitableComponentProps } from 'awaitable-component'; +import DialogTitle from '@mui/material/DialogTitle'; +import { useTranslation } from 'react-i18next'; +import DialogContent from '@mui/material/DialogContent'; +import TextField from '@mui/material/TextField'; +import { useState } from 'react'; +import DialogActions from '@mui/material/DialogActions'; +import Button from '@mui/material/Button'; +import Typography from '@mui/material/Typography'; +import { PasswordTextField } from '@/base/components/inputs/PasswordTextField.tsx'; + +export const LoginDialog = ({ + isVisible, + onExitComplete, + onSubmit, + title, + description, + isLoggedIn, + isLoading, + loginLogout, + username: initialUsername = '', + password: initialPassword = '', + serverAddress: initialServerAddress = '', + withServerAddress = false, +}: AwaitableComponentProps & { + title: string; + description?: string; + isLoggedIn: boolean; + isLoading: boolean; + loginLogout: (username: string, password: string, serverAddress?: string) => void; + username?: string; + password?: string; + serverAddress?: string; + withServerAddress?: boolean; +}) => { + const { t } = useTranslation(); + + const [serverAddress, setServerAddress] = useState(initialServerAddress); + const [username, setUsername] = useState(initialUsername); + const [password, setPassword] = useState(initialPassword); + + return ( + onSubmit()} disableRestoreFocus> + {title} + + + + + + + ); +}; + +export const CredentialsLogin = AwaitableComponent.create(LoginDialog); diff --git a/src/features/settings/Settings.constants.ts b/src/features/settings/Settings.constants.ts index 00ffc182..5d5bdf3e 100644 --- a/src/features/settings/Settings.constants.ts +++ b/src/features/settings/Settings.constants.ts @@ -13,7 +13,14 @@ import { GlobalUpdateSkipEntriesSettings, MetadataServerSettings } from '@/featu import { GridLayout, TranslationKey } from '@/base/Base.types.ts'; import { getDefaultLanguages } from '@/base/utils/Languages.ts'; import { SelectSettingValue, SelectSettingValueDisplayInfo } from '@/base/components/settings/SelectSetting.tsx'; -import { AuthMode, WebUiChannel, WebUiFlavor, WebUiInterface } from '@/lib/graphql/generated/graphql.ts'; +import { + AuthMode, + KoreaderSyncChecksumMethod, + KoreaderSyncConflictStrategy, + WebUiChannel, + WebUiFlavor, + WebUiInterface, +} from '@/lib/graphql/generated/graphql.ts'; import { ThemeMode } from '@/features/theme/AppTheme.types.ts'; export const MANGA_GRID_WIDTH = { @@ -207,3 +214,45 @@ export const KOREADER_SYNC_PERCENTAGE_TOLERANCE = { max: 1, step: 0.05, }; + +export const KOREADER_SYNC_CONFLICT_STRATEGIES = Object.values(KoreaderSyncConflictStrategy); +export const KOREADER_SYNC_CONFLICT_STRATEGY_TO_TRANSLATION_KEYS: Record< + KoreaderSyncConflictStrategy, + SelectSettingValueDisplayInfo +> = { + [KoreaderSyncConflictStrategy.Disabled]: { + text: 'settings.server.koreader.sync.strategy.option.disabled', + }, + [KoreaderSyncConflictStrategy.KeepLocal]: { + text: 'settings.server.koreader.sync.strategy.option.keep_local', + }, + [KoreaderSyncConflictStrategy.KeepRemote]: { + text: 'settings.server.koreader.sync.strategy.option.keep_remote', + }, + [KoreaderSyncConflictStrategy.Prompt]: { + text: 'settings.server.koreader.sync.strategy.option.prompt', + }, +}; +export const KOREADER_SYNC_CONFLICT_STRATEGY_SELECT_VALUES: SelectSettingValue[] = + KOREADER_SYNC_CONFLICT_STRATEGIES.map((strategy) => [ + strategy, + KOREADER_SYNC_CONFLICT_STRATEGY_TO_TRANSLATION_KEYS[strategy], + ]); + +export const KOREADER_SYNC_CHECKSUM_METHODES = Object.values(KoreaderSyncChecksumMethod); +export const KOREADER_SYNC_CHECKSUM_METHOD_TO_TRANSLATION_KEYS: Record< + KoreaderSyncChecksumMethod, + SelectSettingValueDisplayInfo +> = { + [KoreaderSyncChecksumMethod.Binary]: { + text: 'settings.server.koreader.sync.check_sum_method.binary', + }, + [KoreaderSyncChecksumMethod.Filename]: { + text: 'settings.server.koreader.sync.check_sum_method.filename', + }, +}; +export const KOREADER_SYNC_CHECKSUM_METHOD_SELECT_VALUES: SelectSettingValue[] = + KOREADER_SYNC_CHECKSUM_METHODES.map((method) => [ + method, + KOREADER_SYNC_CHECKSUM_METHOD_TO_TRANSLATION_KEYS[method], + ]); diff --git a/src/features/settings/components/koreaderSync/KoreaderSyncSettings.tsx b/src/features/settings/components/koreaderSync/KoreaderSyncSettings.tsx new file mode 100644 index 00000000..48762551 --- /dev/null +++ b/src/features/settings/components/koreaderSync/KoreaderSyncSettings.tsx @@ -0,0 +1,203 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import { useTranslation } from 'react-i18next'; +import List from '@mui/material/List'; +import ListSubheader from '@mui/material/ListSubheader'; +import ListItemText from '@mui/material/ListItemText'; + +import ListItemButton from '@mui/material/ListItemButton'; +import { requestManager } from '@/lib/requests/RequestManager.ts'; +import { SelectSetting } from '@/base/components/settings/SelectSetting.tsx'; +import { NumberSetting } from '@/base/components/settings/NumberSetting.tsx'; +import { makeToast } from '@/base/utils/Toast.ts'; +import { getErrorMessage, noOp } from '@/lib/HelperFunctions.ts'; +import { + KoreaderSyncChecksumMethod, + KoreaderSyncConflictStrategy, + KoSyncStatusPayload, +} from '@/lib/graphql/generated/graphql.ts'; +import { + KOREADER_SYNC_CHECKSUM_METHOD_SELECT_VALUES, + KOREADER_SYNC_CONFLICT_STRATEGY_SELECT_VALUES, + KOREADER_SYNC_PERCENTAGE_TOLERANCE, +} from '@/features/settings/Settings.constants.ts'; +import { CredentialsLogin } from '@/base/components/modals/LoginDialog.tsx'; +import { ServerSettings as ServerSettingsType, ServerSettings } from '@/features/settings/Settings.types.ts'; +import { assertIsDefined } from '@/base/Asserts.ts'; + +export const KoreaderSyncSettings = ({ + settings: { + koreaderSyncPercentageTolerance, + koreaderSyncStrategyBackward, + koreaderSyncStrategyForward, + koreaderSyncChecksumMethod, + }, + serverAddress: currentServerAddress, + username: currentUsername, + isLoggedIn, + updateSetting, +}: { + settings: ServerSettings; + + updateSetting: ( + setting: Setting, + value: ServerSettingsType[Setting], + onCompletion?: (success: boolean) => void, + ) => Promise; +} & Omit) => { + const { t } = useTranslation(); + + const handleLogout = async () => { + const { data } = await requestManager.koSyncLogout().response; + + if (data?.logoutKoSyncAccount.status.isLoggedIn) { + throw new Error( + t('tracking.action.logout.label.failure', { name: t('settings.server.koreader.sync.title') }), + ); + } + }; + + const handleLogin = async (serverAddress: string, username: string, password: string) => { + const { data } = await requestManager.koSyncLogin(serverAddress, username, password).response; + + if (!data?.connectKoSyncAccount.status.isLoggedIn) { + throw new Error(data?.connectKoSyncAccount.message ?? t('global.label.unknown')); + } + }; + + const handleLoginLogout = async ( + initialServerAddress: string = 'https://sync.koreader.rocks/', + initialUsername?: string, + initialPassword?: string, + ) => { + const controlled = CredentialsLogin.showControlled( + { + title: t( + isLoggedIn + ? 'settings.server.koreader.sync.connection.disconnect' + : 'settings.server.koreader.sync.connection.connect', + { + name: t('settings.server.koreader.sync.title'), + }, + ), + description: isLoggedIn + ? t('settings.server.koreader.sync.connection.connected', { + username: initialUsername, + serverAddress: initialServerAddress, + }) + : undefined, + isLoading: false, + isLoggedIn, + withServerAddress: true, + username: initialUsername, + password: initialPassword, + serverAddress: initialServerAddress, + loginLogout: async (username, password, serverAddress) => { + controlled.update({ isLoading: true, loginLogout: noOp }); + + if (isLoggedIn) { + try { + await handleLogout(); + + controlled.submit(); + } catch (e) { + makeToast( + t('settings.server.koreader.sync.connection.message.disconnect_error'), + 'error', + getErrorMessage(e), + ); + } + + return; + } + + try { + assertIsDefined(serverAddress); + await handleLogin(serverAddress, username, password); + + controlled.submit(); + } catch (e) { + makeToast( + t('settings.server.koreader.sync.connection.message.connect_error'), + 'error', + getErrorMessage(e), + ); + + const RETRY_KEY = '__retry__'; + const retry = await Promise.race([controlled.promise, Promise.resolve(RETRY_KEY)]); + if (retry === RETRY_KEY) { + handleLoginLogout(serverAddress, username, password); + } + } + }, + }, + { id: 'koreader-sync-login-logout' }, + ); + }; + + return ( + + {t('settings.server.koreader.sync.title')} + + } + > + handleLoginLogout(currentServerAddress ?? undefined, currentUsername ?? undefined)} + > + + + + + settingName={t('settings.server.koreader.sync.strategy.forward_title')} + value={koreaderSyncStrategyForward} + values={KOREADER_SYNC_CONFLICT_STRATEGY_SELECT_VALUES} + handleChange={(value) => updateSetting('koreaderSyncStrategyForward', value)} + /> + + + settingName={t('settings.server.koreader.sync.strategy.backward_title')} + value={koreaderSyncStrategyBackward} + values={KOREADER_SYNC_CONFLICT_STRATEGY_SELECT_VALUES} + handleChange={(value) => updateSetting('koreaderSyncStrategyBackward', value)} + /> + + + settingName={t('settings.server.koreader.sync.check_sum_method.title')} + value={koreaderSyncChecksumMethod} + values={KOREADER_SYNC_CHECKSUM_METHOD_SELECT_VALUES} + handleChange={(value) => updateSetting('koreaderSyncChecksumMethod', value)} + /> + + updateSetting('koreaderSyncPercentageTolerance', value)} + /> + + ); +}; diff --git a/src/features/settings/screens/ServerSettings.tsx b/src/features/settings/screens/ServerSettings.tsx index 3c42c98b..88e70baa 100644 --- a/src/features/settings/screens/ServerSettings.tsx +++ b/src/features/settings/screens/ServerSettings.tsx @@ -31,22 +31,16 @@ import { makeToast } from '@/base/utils/Toast.ts'; import { MetadataUpdateSettings } from '@/features/app-updates/AppUpdateChecker.types.ts'; import { getErrorMessage } from '@/lib/HelperFunctions.ts'; import { useAppTitle } from '@/features/navigation-bar/hooks/useAppTitle.ts'; -import { - AuthMode, - DatabaseType, - KoreaderSyncChecksumMethod, - KoreaderSyncLegacyStrategy, - SortOrder, -} from '@/lib/graphql/generated/graphql'; +import { AuthMode, DatabaseType, SortOrder } from '@/lib/graphql/generated/graphql'; import { AUTH_MODES_SELECT_VALUES, JWT_ACCESS_TOKEN_EXPIRY, JWT_REFRESH_TOKEN_EXPIRY, - KOREADER_SYNC_PERCENTAGE_TOLERANCE, } from '@/features/settings/Settings.constants.ts'; import { ServerAddressSetting } from '@/features/settings/components/ServerAddressSetting.tsx'; import { AuthManager } from '@/features/authentication/AuthManager.ts'; import { ServerSettings as ServerSettingsType } from '@/features/settings/Settings.types.ts'; +import { KoreaderSyncSettings } from '@/features/settings/components/koreaderSync/KoreaderSyncSettings.tsx'; const getLogFilesCleanupDisplayValue = (ttl: number): string => { if (ttl === 0) { @@ -80,6 +74,8 @@ export const ServerSettings = () => { }); const [mutateSettings] = requestManager.useUpdateServerSettings(); + const koSyncStatus = requestManager.useKoSyncStatus(); + const updateSetting = async ( setting: Setting, value: ServerSettingsType[Setting], @@ -120,7 +116,7 @@ export const ServerSettings = () => { [serverInformAvailableUpdate], ); - const loading = areMetadataServerSettingsLoading || areServerSettingsLoading; + const loading = areMetadataServerSettingsLoading || areServerSettingsLoading || koSyncStatus.loading; if (loading) { return ( <> @@ -130,7 +126,7 @@ export const ServerSettings = () => { ); } - const error = metadataServerSettingsError ?? serverSettingsError; + const error = metadataServerSettingsError ?? serverSettingsError ?? koSyncStatus.error; if (error) { return ( <> @@ -150,6 +146,12 @@ export const ServerSettings = () => { defaultPromiseErrorHandler('ServerSettings::refetchServerSettings'), ); } + + if (koSyncStatus.error) { + koSyncStatus + .refetch() + .catch(defaultPromiseErrorHandler('ServerSettings::koSyncStatus.refetch')); + } }} /> @@ -157,6 +159,7 @@ export const ServerSettings = () => { } const serverSettings = data!.settings; + const koreaderSyncStatus = koSyncStatus.data!.koSyncStatus; const authModeDisabled = !serverSettings.authUsername?.trim() || !serverSettings.authPassword?.trim(); const isH2Database = serverSettings.databaseType === DatabaseType.H2; @@ -467,87 +470,13 @@ export const ServerSettings = () => { handleChange={(value) => updateSetting('opdsChapterSortOrder', value)} /> - - {t('settings.server.koreader.sync.title')} - - } - > - updateSetting('koreaderSyncServerUrl', url)} - value={serverSettings.koreaderSyncServerUrl} - placeholder="http://localhost:17200" - /> - updateSetting('koreaderSyncUsername', username)} - /> - updateSetting('koreaderSyncUserkey', userkey)} - isPassword - /> - updateSetting('koreaderSyncDeviceId', deviceId)} - /> - - settingName={t('settings.server.koreader.sync.check_sum_method.title')} - value={serverSettings.koreaderSyncChecksumMethod} - values={[ - [ - KoreaderSyncChecksumMethod.Binary, - { text: t('settings.server.koreader.sync.check_sum_method.binary') }, - ], - [ - KoreaderSyncChecksumMethod.Filename, - { text: t('settings.server.koreader.sync.check_sum_method.filename') }, - ], - ]} - handleChange={(value) => updateSetting('koreaderSyncChecksumMethod', value)} - /> - - settingName={t('settings.server.koreader.sync.strategy.title')} - value={serverSettings.koreaderSyncStrategy} - values={[ - [ - KoreaderSyncLegacyStrategy.Disabled, - { text: t('settings.server.koreader.sync.strategy.disabled') }, - ], - [ - KoreaderSyncLegacyStrategy.Prompt, - { text: t('settings.server.koreader.sync.strategy.prompt') }, - ], - [ - KoreaderSyncLegacyStrategy.Silent, - { text: t('settings.server.koreader.sync.strategy.silent') }, - ], - [KoreaderSyncLegacyStrategy.Send, { text: t('settings.server.koreader.sync.strategy.send') }], - [ - KoreaderSyncLegacyStrategy.Receive, - { text: t('settings.server.koreader.sync.strategy.receive') }, - ], - ]} - handleChange={(value) => updateSetting('koreaderSyncStrategy', value)} - /> - updateSetting('koreaderSyncPercentageTolerance', tolerance)} - /> - + diff --git a/src/features/tracker/components/cards/SettingsTrackerCard.tsx b/src/features/tracker/components/cards/SettingsTrackerCard.tsx index 02973dc2..69a076e1 100644 --- a/src/features/tracker/components/cards/SettingsTrackerCard.tsx +++ b/src/features/tracker/components/cards/SettingsTrackerCard.tsx @@ -7,48 +7,33 @@ */ import { useTranslation } from 'react-i18next'; -import { useState } from 'react'; -import PopupState, { bindDialog, bindTrigger } from 'material-ui-popup-state'; import ListItemButton from '@mui/material/ListItemButton'; import Chip from '@mui/material/Chip'; import ListItemAvatar from '@mui/material/ListItemAvatar'; import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction'; import ListItemText from '@mui/material/ListItemText'; -import Dialog from '@mui/material/Dialog'; -import DialogTitle from '@mui/material/DialogTitle'; -import DialogContent from '@mui/material/DialogContent'; -import TextField from '@mui/material/TextField'; -import DialogActions from '@mui/material/DialogActions'; -import Button from '@mui/material/Button'; -import { PasswordTextField } from '@/base/components/inputs/PasswordTextField.tsx'; import { makeToast } from '@/base/utils/Toast.ts'; import { requestManager } from '@/lib/requests/RequestManager.ts'; import { Trackers } from '@/features/tracker/services/Trackers.ts'; -import { getErrorMessage } from '@/lib/HelperFunctions.ts'; +import { getErrorMessage, noOp } from '@/lib/HelperFunctions.ts'; import { TTrackerSearch } from '@/features/tracker/Tracker.types.ts'; import { AvatarSpinner } from '@/base/components/AvatarSpinner.tsx'; +import { CredentialsLogin } from '@/base/components/modals/LoginDialog.tsx'; export const SettingsTrackerCard = ({ tracker }: { tracker: TTrackerSearch }) => { const { t } = useTranslation(); - const [loginTrackerCredentials, { loading: isCredentialLoginInProgress }] = - requestManager.useLoginToTrackerCredentials(); - const [logoutFromTracker] = requestManager.useLogoutFromTracker(); - - const [username, setUsername] = useState(''); - const [password, setPassword] = useState(''); - const isOAuthLogin = !tracker.isLoggedIn && !!tracker.authUrl; const handleLogout = async () => { try { - await logoutFromTracker({ variables: { trackerId: tracker.id } }); + await requestManager.logoutFromTracker(tracker.id).response; } catch (e) { makeToast(t('tracking.action.logout.label.failure', { name: tracker.name }), 'error', getErrorMessage(e)); } }; - const handleLogin = async () => { + const handleLogin = async (username: string, password: string) => { if (isOAuthLogin) { const state = { redirectUrl: `${window.location.origin}/tracker/login/oauth`, @@ -62,99 +47,107 @@ export const SettingsTrackerCard = ({ tracker }: { tracker: TTrackerSearch }) => } try { - await loginTrackerCredentials({ variables: { input: { trackerId: tracker.id, username, password } } }); + await requestManager.loginTrackerCredentials(tracker.id, username, password).response; } catch (e) { makeToast(t('tracking.action.login.label.failure', { name: tracker.name }), 'error', getErrorMessage(e)); } }; - const onClick = (openPopup: () => void) => { - if (!isOAuthLogin) { - openPopup(); + const login = async (initialUsername?: string, initialPassword?: string) => { + if (isOAuthLogin) { + const state = { + redirectUrl: `${window.location.origin}/tracker/login/oauth`, + clientName: 'Suwayomi-WebUI', + trackerId: tracker.id, + trackerName: tracker.name, + }; + + window.open(`${tracker.authUrl}&state=${JSON.stringify(state)}`, '_self'); return; } - handleLogin(); + const controlled = CredentialsLogin.showControlled( + { + title: t( + Trackers.isLoggedIn(tracker) + ? 'tracking.settings.dialog.title.log_out' + : 'tracking.settings.dialog.title.log_in', + { name: tracker.name }, + ), + isLoading: false, + isLoggedIn: Trackers.isLoggedIn(tracker), + username: initialUsername, + password: initialPassword, + loginLogout: async (username, password) => { + controlled.update({ + isLoading: true, + loginLogout: noOp, + }); + + if (Trackers.isLoggedIn(tracker)) { + try { + await handleLogout(); + + controlled.submit(); + } catch (e) { + makeToast( + t('tracking.action.logout.label.failure', { name: tracker.name }), + 'error', + getErrorMessage(e), + ); + } + + return; + } + + try { + await handleLogin(username, password); + + controlled.submit(); + } catch (e) { + makeToast( + t('tracking.action.login.label.failure', { name: tracker.name }), + 'error', + getErrorMessage(e), + ); + + const RETRY_KEY = '__retry__'; + const retry = await Promise.race([controlled.promise, Promise.resolve(RETRY_KEY)]); + if (retry === RETRY_KEY) { + login(username, password); + } + } + }, + }, + { id: 'tracker-login-dialog' }, + ); + + await controlled.promise; }; return ( - - {(popupState) => ( - <> - onClick(popupState.open)}> - - - - - {Trackers.isLoggedIn(tracker) && ( - - - - )} - - - - {t( - Trackers.isLoggedIn(tracker) - ? 'tracking.settings.dialog.title.log_out' - : 'tracking.settings.dialog.title.log_in', - { name: tracker.name }, - )} - - {!isOAuthLogin && !tracker.isLoggedIn && ( - - setUsername(e.target.value)} - /> - setPassword(e.target.value)} - /> - - )} - - - - - - + login()}> + + + + + {Trackers.isLoggedIn(tracker) && ( + + + )} - + ); }; diff --git a/src/features/tracker/screens/TrackerOAuthLogin.tsx b/src/features/tracker/screens/TrackerOAuthLogin.tsx index 7816f83b..dc243e80 100644 --- a/src/features/tracker/screens/TrackerOAuthLogin.tsx +++ b/src/features/tracker/screens/TrackerOAuthLogin.tsx @@ -23,19 +23,10 @@ export const TrackerOAuthLogin = () => { url.searchParams.get('state') ?? '{}', ); - const [loginTrackerOAuth, { loading: isLoginInProgress }] = requestManager.useLoginToTrackerOauth(); - useEffect(() => { const login = async () => { try { - await loginTrackerOAuth({ - variables: { - input: { - callbackUrl: window.location.href, - trackerId, - }, - }, - }); + await requestManager.loginToTrackerOauth(trackerId, window.location.href).response; } catch (e) { makeToast(t('tracking.action.login.label.failure', { name: trackerName }), 'error', getErrorMessage(e)); } @@ -46,9 +37,5 @@ export const TrackerOAuthLogin = () => { login(); }, [trackerId]); - if (isLoginInProgress) { - return t('tracking.action.login.label.progress', { name: trackerName }); - } - - return null; + return t('tracking.action.login.label.progress', { name: trackerName }); }; diff --git a/src/lib/graphql/fragments/KoreaderSyncFragments.ts b/src/lib/graphql/fragments/KoreaderSyncFragments.ts new file mode 100644 index 00000000..fe6d621f --- /dev/null +++ b/src/lib/graphql/fragments/KoreaderSyncFragments.ts @@ -0,0 +1,17 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; + +export const KO_SYNC_STATUS = gql` + fragment KO_SYNC_STATUS on KoSyncStatusPayload { + isLoggedIn + serverAddress + username + } +`; diff --git a/src/lib/graphql/fragments/SettingsFragments.ts b/src/lib/graphql/fragments/SettingsFragments.ts index 56e24ad3..e0f06e76 100644 --- a/src/lib/graphql/fragments/SettingsFragments.ts +++ b/src/lib/graphql/fragments/SettingsFragments.ts @@ -98,12 +98,9 @@ export const SERVER_SETTINGS = gql` opdsChapterSortOrder # KOReader sync - koreaderSyncServerUrl - koreaderSyncUsername - koreaderSyncUserkey - koreaderSyncDeviceId koreaderSyncChecksumMethod - koreaderSyncStrategy + koreaderSyncStrategyBackward + koreaderSyncStrategyForward koreaderSyncPercentageTolerance # Database diff --git a/src/lib/graphql/generated/apollo-helpers.ts b/src/lib/graphql/generated/apollo-helpers.ts index bcc245d9..b4a4ac3e 100644 --- a/src/lib/graphql/generated/apollo-helpers.ts +++ b/src/lib/graphql/generated/apollo-helpers.ts @@ -356,17 +356,16 @@ export type InstallExternalExtensionPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, extension?: FieldPolicy | FieldReadFunction }; -export type KoSyncConnectPayloadKeySpecifier = ('clientMutationId' | 'message' | 'settings' | 'success' | 'username' | KoSyncConnectPayloadKeySpecifier)[]; +export type KoSyncConnectPayloadKeySpecifier = ('clientMutationId' | 'message' | 'status' | KoSyncConnectPayloadKeySpecifier)[]; export type KoSyncConnectPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, message?: FieldPolicy | FieldReadFunction, - settings?: FieldPolicy | FieldReadFunction, - success?: FieldPolicy | FieldReadFunction, - username?: FieldPolicy | FieldReadFunction + status?: FieldPolicy | FieldReadFunction }; -export type KoSyncStatusPayloadKeySpecifier = ('isLoggedIn' | 'username' | KoSyncStatusPayloadKeySpecifier)[]; +export type KoSyncStatusPayloadKeySpecifier = ('isLoggedIn' | 'serverAddress' | 'username' | KoSyncStatusPayloadKeySpecifier)[]; export type KoSyncStatusPayloadFieldPolicy = { isLoggedIn?: FieldPolicy | FieldReadFunction, + serverAddress?: FieldPolicy | FieldReadFunction, username?: FieldPolicy | FieldReadFunction }; export type LastUpdateTimestampPayloadKeySpecifier = ('timestamp' | LastUpdateTimestampPayloadKeySpecifier)[]; @@ -409,11 +408,10 @@ export type LoginTrackerOAuthPayloadFieldPolicy = { isLoggedIn?: FieldPolicy | FieldReadFunction, tracker?: FieldPolicy | FieldReadFunction }; -export type LogoutKoSyncAccountPayloadKeySpecifier = ('clientMutationId' | 'settings' | 'success' | LogoutKoSyncAccountPayloadKeySpecifier)[]; +export type LogoutKoSyncAccountPayloadKeySpecifier = ('clientMutationId' | 'status' | LogoutKoSyncAccountPayloadKeySpecifier)[]; export type LogoutKoSyncAccountPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, - settings?: FieldPolicy | FieldReadFunction, - success?: FieldPolicy | FieldReadFunction + status?: FieldPolicy | FieldReadFunction }; export type LogoutTrackerPayloadKeySpecifier = ('clientMutationId' | 'isLoggedIn' | 'tracker' | LogoutTrackerPayloadKeySpecifier)[]; export type LogoutTrackerPayloadFieldPolicy = { @@ -589,11 +587,18 @@ export type PageInfoFieldPolicy = { hasPreviousPage?: FieldPolicy | FieldReadFunction, startCursor?: FieldPolicy | FieldReadFunction }; -export type PartialSettingsTypeKeySpecifier = ('authMode' | 'authPassword' | 'authUsername' | 'autoDownloadAheadLimit' | 'autoDownloadIgnoreReUploads' | 'autoDownloadNewChapters' | 'autoDownloadNewChaptersLimit' | 'backupInterval' | 'backupPath' | 'backupTTL' | 'backupTime' | 'basicAuthEnabled' | 'basicAuthPassword' | 'basicAuthUsername' | 'databasePassword' | 'databaseType' | 'databaseUrl' | 'databaseUsername' | 'debugLogsEnabled' | 'downloadAsCbz' | 'downloadConversions' | 'downloadsPath' | 'electronPath' | 'excludeCompleted' | 'excludeEntryWithUnreadChapters' | 'excludeNotStarted' | 'excludeUnreadChapters' | 'extensionRepos' | 'flareSolverrAsResponseFallback' | 'flareSolverrEnabled' | 'flareSolverrSessionName' | 'flareSolverrSessionTtl' | 'flareSolverrTimeout' | 'flareSolverrUrl' | 'globalUpdateInterval' | 'gqlDebugLogsEnabled' | 'initialOpenInBrowserEnabled' | 'ip' | 'jwtAudience' | 'jwtRefreshExpiry' | 'jwtTokenExpiry' | 'koreaderSyncChecksumMethod' | 'koreaderSyncDeviceId' | 'koreaderSyncPercentageTolerance' | 'koreaderSyncServerUrl' | 'koreaderSyncStrategy' | 'koreaderSyncStrategyBackward' | 'koreaderSyncStrategyForward' | 'koreaderSyncUserkey' | 'koreaderSyncUsername' | 'localSourcePath' | 'maxLogFileSize' | 'maxLogFiles' | 'maxLogFolderSize' | 'maxSourcesInParallel' | 'opdsChapterSortOrder' | 'opdsEnablePageReadProgress' | 'opdsItemsPerPage' | 'opdsMarkAsReadOnDownload' | 'opdsShowOnlyDownloadedChapters' | 'opdsShowOnlyUnreadChapters' | 'opdsUseBinaryFileSizes' | 'port' | 'socksProxyEnabled' | 'socksProxyHost' | 'socksProxyPassword' | 'socksProxyPort' | 'socksProxyUsername' | 'socksProxyVersion' | 'systemTrayEnabled' | 'updateMangas' | 'webUIChannel' | 'webUIFlavor' | 'webUIInterface' | 'webUIUpdateCheckInterval' | PartialSettingsTypeKeySpecifier)[]; +export type PartialSettingsTypeKeySpecifier = ('authMode' | 'authPassword' | 'authUsername' | 'autoBackupIncludeCategories' | 'autoBackupIncludeChapters' | 'autoBackupIncludeClientData' | 'autoBackupIncludeHistory' | 'autoBackupIncludeManga' | 'autoBackupIncludeServerSettings' | 'autoBackupIncludeTracking' | 'autoDownloadAheadLimit' | 'autoDownloadIgnoreReUploads' | 'autoDownloadNewChapters' | 'autoDownloadNewChaptersLimit' | 'backupInterval' | 'backupPath' | 'backupTTL' | 'backupTime' | 'basicAuthEnabled' | 'basicAuthPassword' | 'basicAuthUsername' | 'databasePassword' | 'databaseType' | 'databaseUrl' | 'databaseUsername' | 'debugLogsEnabled' | 'downloadAsCbz' | 'downloadConversions' | 'downloadsPath' | 'electronPath' | 'excludeCompleted' | 'excludeEntryWithUnreadChapters' | 'excludeNotStarted' | 'excludeUnreadChapters' | 'extensionRepos' | 'flareSolverrAsResponseFallback' | 'flareSolverrEnabled' | 'flareSolverrSessionName' | 'flareSolverrSessionTtl' | 'flareSolverrTimeout' | 'flareSolverrUrl' | 'globalUpdateInterval' | 'gqlDebugLogsEnabled' | 'initialOpenInBrowserEnabled' | 'ip' | 'jwtAudience' | 'jwtRefreshExpiry' | 'jwtTokenExpiry' | 'koreaderSyncChecksumMethod' | 'koreaderSyncDeviceId' | 'koreaderSyncPercentageTolerance' | 'koreaderSyncServerUrl' | 'koreaderSyncStrategy' | 'koreaderSyncStrategyBackward' | 'koreaderSyncStrategyForward' | 'koreaderSyncUserkey' | 'koreaderSyncUsername' | 'localSourcePath' | 'maxLogFileSize' | 'maxLogFiles' | 'maxLogFolderSize' | 'maxSourcesInParallel' | 'opdsCbzMimetype' | 'opdsChapterSortOrder' | 'opdsEnablePageReadProgress' | 'opdsItemsPerPage' | 'opdsMarkAsReadOnDownload' | 'opdsShowOnlyDownloadedChapters' | 'opdsShowOnlyUnreadChapters' | 'opdsUseBinaryFileSizes' | 'port' | 'serveConversions' | 'socksProxyEnabled' | 'socksProxyHost' | 'socksProxyPassword' | 'socksProxyPort' | 'socksProxyUsername' | 'socksProxyVersion' | 'systemTrayEnabled' | 'updateMangas' | 'useHikariConnectionPool' | 'webUIChannel' | 'webUIFlavor' | 'webUIInterface' | 'webUIUpdateCheckInterval' | PartialSettingsTypeKeySpecifier)[]; export type PartialSettingsTypeFieldPolicy = { authMode?: FieldPolicy | FieldReadFunction, authPassword?: FieldPolicy | FieldReadFunction, authUsername?: FieldPolicy | FieldReadFunction, + autoBackupIncludeCategories?: FieldPolicy | FieldReadFunction, + autoBackupIncludeChapters?: FieldPolicy | FieldReadFunction, + autoBackupIncludeClientData?: FieldPolicy | FieldReadFunction, + autoBackupIncludeHistory?: FieldPolicy | FieldReadFunction, + autoBackupIncludeManga?: FieldPolicy | FieldReadFunction, + autoBackupIncludeServerSettings?: FieldPolicy | FieldReadFunction, + autoBackupIncludeTracking?: FieldPolicy | FieldReadFunction, autoDownloadAheadLimit?: FieldPolicy | FieldReadFunction, autoDownloadIgnoreReUploads?: FieldPolicy | FieldReadFunction, autoDownloadNewChapters?: FieldPolicy | FieldReadFunction, @@ -646,6 +651,7 @@ export type PartialSettingsTypeFieldPolicy = { maxLogFiles?: FieldPolicy | FieldReadFunction, maxLogFolderSize?: FieldPolicy | FieldReadFunction, maxSourcesInParallel?: FieldPolicy | FieldReadFunction, + opdsCbzMimetype?: FieldPolicy | FieldReadFunction, opdsChapterSortOrder?: FieldPolicy | FieldReadFunction, opdsEnablePageReadProgress?: FieldPolicy | FieldReadFunction, opdsItemsPerPage?: FieldPolicy | FieldReadFunction, @@ -654,6 +660,7 @@ export type PartialSettingsTypeFieldPolicy = { opdsShowOnlyUnreadChapters?: FieldPolicy | FieldReadFunction, opdsUseBinaryFileSizes?: FieldPolicy | FieldReadFunction, port?: FieldPolicy | FieldReadFunction, + serveConversions?: FieldPolicy | FieldReadFunction, socksProxyEnabled?: FieldPolicy | FieldReadFunction, socksProxyHost?: FieldPolicy | FieldReadFunction, socksProxyPassword?: FieldPolicy | FieldReadFunction, @@ -662,6 +669,7 @@ export type PartialSettingsTypeFieldPolicy = { socksProxyVersion?: FieldPolicy | FieldReadFunction, systemTrayEnabled?: FieldPolicy | FieldReadFunction, updateMangas?: FieldPolicy | FieldReadFunction, + useHikariConnectionPool?: FieldPolicy | FieldReadFunction, webUIChannel?: FieldPolicy | FieldReadFunction, webUIFlavor?: FieldPolicy | FieldReadFunction, webUIInterface?: FieldPolicy | FieldReadFunction, @@ -777,11 +785,18 @@ export type SetSourceMetaPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, meta?: FieldPolicy | FieldReadFunction }; -export type SettingsKeySpecifier = ('authMode' | 'authPassword' | 'authUsername' | 'autoDownloadAheadLimit' | 'autoDownloadIgnoreReUploads' | 'autoDownloadNewChapters' | 'autoDownloadNewChaptersLimit' | 'backupInterval' | 'backupPath' | 'backupTTL' | 'backupTime' | 'basicAuthEnabled' | 'basicAuthPassword' | 'basicAuthUsername' | 'databasePassword' | 'databaseType' | 'databaseUrl' | 'databaseUsername' | 'debugLogsEnabled' | 'downloadAsCbz' | 'downloadConversions' | 'downloadsPath' | 'electronPath' | 'excludeCompleted' | 'excludeEntryWithUnreadChapters' | 'excludeNotStarted' | 'excludeUnreadChapters' | 'extensionRepos' | 'flareSolverrAsResponseFallback' | 'flareSolverrEnabled' | 'flareSolverrSessionName' | 'flareSolverrSessionTtl' | 'flareSolverrTimeout' | 'flareSolverrUrl' | 'globalUpdateInterval' | 'gqlDebugLogsEnabled' | 'initialOpenInBrowserEnabled' | 'ip' | 'jwtAudience' | 'jwtRefreshExpiry' | 'jwtTokenExpiry' | 'koreaderSyncChecksumMethod' | 'koreaderSyncDeviceId' | 'koreaderSyncPercentageTolerance' | 'koreaderSyncServerUrl' | 'koreaderSyncStrategy' | 'koreaderSyncStrategyBackward' | 'koreaderSyncStrategyForward' | 'koreaderSyncUserkey' | 'koreaderSyncUsername' | 'localSourcePath' | 'maxLogFileSize' | 'maxLogFiles' | 'maxLogFolderSize' | 'maxSourcesInParallel' | 'opdsChapterSortOrder' | 'opdsEnablePageReadProgress' | 'opdsItemsPerPage' | 'opdsMarkAsReadOnDownload' | 'opdsShowOnlyDownloadedChapters' | 'opdsShowOnlyUnreadChapters' | 'opdsUseBinaryFileSizes' | 'port' | 'socksProxyEnabled' | 'socksProxyHost' | 'socksProxyPassword' | 'socksProxyPort' | 'socksProxyUsername' | 'socksProxyVersion' | 'systemTrayEnabled' | 'updateMangas' | 'webUIChannel' | 'webUIFlavor' | 'webUIInterface' | 'webUIUpdateCheckInterval' | SettingsKeySpecifier)[]; +export type SettingsKeySpecifier = ('authMode' | 'authPassword' | 'authUsername' | 'autoBackupIncludeCategories' | 'autoBackupIncludeChapters' | 'autoBackupIncludeClientData' | 'autoBackupIncludeHistory' | 'autoBackupIncludeManga' | 'autoBackupIncludeServerSettings' | 'autoBackupIncludeTracking' | 'autoDownloadAheadLimit' | 'autoDownloadIgnoreReUploads' | 'autoDownloadNewChapters' | 'autoDownloadNewChaptersLimit' | 'backupInterval' | 'backupPath' | 'backupTTL' | 'backupTime' | 'basicAuthEnabled' | 'basicAuthPassword' | 'basicAuthUsername' | 'databasePassword' | 'databaseType' | 'databaseUrl' | 'databaseUsername' | 'debugLogsEnabled' | 'downloadAsCbz' | 'downloadConversions' | 'downloadsPath' | 'electronPath' | 'excludeCompleted' | 'excludeEntryWithUnreadChapters' | 'excludeNotStarted' | 'excludeUnreadChapters' | 'extensionRepos' | 'flareSolverrAsResponseFallback' | 'flareSolverrEnabled' | 'flareSolverrSessionName' | 'flareSolverrSessionTtl' | 'flareSolverrTimeout' | 'flareSolverrUrl' | 'globalUpdateInterval' | 'gqlDebugLogsEnabled' | 'initialOpenInBrowserEnabled' | 'ip' | 'jwtAudience' | 'jwtRefreshExpiry' | 'jwtTokenExpiry' | 'koreaderSyncChecksumMethod' | 'koreaderSyncDeviceId' | 'koreaderSyncPercentageTolerance' | 'koreaderSyncServerUrl' | 'koreaderSyncStrategy' | 'koreaderSyncStrategyBackward' | 'koreaderSyncStrategyForward' | 'koreaderSyncUserkey' | 'koreaderSyncUsername' | 'localSourcePath' | 'maxLogFileSize' | 'maxLogFiles' | 'maxLogFolderSize' | 'maxSourcesInParallel' | 'opdsCbzMimetype' | 'opdsChapterSortOrder' | 'opdsEnablePageReadProgress' | 'opdsItemsPerPage' | 'opdsMarkAsReadOnDownload' | 'opdsShowOnlyDownloadedChapters' | 'opdsShowOnlyUnreadChapters' | 'opdsUseBinaryFileSizes' | 'port' | 'serveConversions' | 'socksProxyEnabled' | 'socksProxyHost' | 'socksProxyPassword' | 'socksProxyPort' | 'socksProxyUsername' | 'socksProxyVersion' | 'systemTrayEnabled' | 'updateMangas' | 'useHikariConnectionPool' | 'webUIChannel' | 'webUIFlavor' | 'webUIInterface' | 'webUIUpdateCheckInterval' | SettingsKeySpecifier)[]; export type SettingsFieldPolicy = { authMode?: FieldPolicy | FieldReadFunction, authPassword?: FieldPolicy | FieldReadFunction, authUsername?: FieldPolicy | FieldReadFunction, + autoBackupIncludeCategories?: FieldPolicy | FieldReadFunction, + autoBackupIncludeChapters?: FieldPolicy | FieldReadFunction, + autoBackupIncludeClientData?: FieldPolicy | FieldReadFunction, + autoBackupIncludeHistory?: FieldPolicy | FieldReadFunction, + autoBackupIncludeManga?: FieldPolicy | FieldReadFunction, + autoBackupIncludeServerSettings?: FieldPolicy | FieldReadFunction, + autoBackupIncludeTracking?: FieldPolicy | FieldReadFunction, autoDownloadAheadLimit?: FieldPolicy | FieldReadFunction, autoDownloadIgnoreReUploads?: FieldPolicy | FieldReadFunction, autoDownloadNewChapters?: FieldPolicy | FieldReadFunction, @@ -834,6 +849,7 @@ export type SettingsFieldPolicy = { maxLogFiles?: FieldPolicy | FieldReadFunction, maxLogFolderSize?: FieldPolicy | FieldReadFunction, maxSourcesInParallel?: FieldPolicy | FieldReadFunction, + opdsCbzMimetype?: FieldPolicy | FieldReadFunction, opdsChapterSortOrder?: FieldPolicy | FieldReadFunction, opdsEnablePageReadProgress?: FieldPolicy | FieldReadFunction, opdsItemsPerPage?: FieldPolicy | FieldReadFunction, @@ -842,6 +858,7 @@ export type SettingsFieldPolicy = { opdsShowOnlyUnreadChapters?: FieldPolicy | FieldReadFunction, opdsUseBinaryFileSizes?: FieldPolicy | FieldReadFunction, port?: FieldPolicy | FieldReadFunction, + serveConversions?: FieldPolicy | FieldReadFunction, socksProxyEnabled?: FieldPolicy | FieldReadFunction, socksProxyHost?: FieldPolicy | FieldReadFunction, socksProxyPassword?: FieldPolicy | FieldReadFunction, @@ -850,28 +867,52 @@ export type SettingsFieldPolicy = { socksProxyVersion?: FieldPolicy | FieldReadFunction, systemTrayEnabled?: FieldPolicy | FieldReadFunction, updateMangas?: FieldPolicy | FieldReadFunction, + useHikariConnectionPool?: FieldPolicy | FieldReadFunction, webUIChannel?: FieldPolicy | FieldReadFunction, webUIFlavor?: FieldPolicy | FieldReadFunction, webUIInterface?: FieldPolicy | FieldReadFunction, webUIUpdateCheckInterval?: FieldPolicy | FieldReadFunction }; -export type SettingsDownloadConversionKeySpecifier = ('compressionLevel' | 'mimeType' | 'target' | SettingsDownloadConversionKeySpecifier)[]; +export type SettingsDownloadConversionKeySpecifier = ('callTimeout' | 'compressionLevel' | 'connectTimeout' | 'headers' | 'mimeType' | 'target' | SettingsDownloadConversionKeySpecifier)[]; export type SettingsDownloadConversionFieldPolicy = { + callTimeout?: FieldPolicy | FieldReadFunction, compressionLevel?: FieldPolicy | FieldReadFunction, + connectTimeout?: FieldPolicy | FieldReadFunction, + headers?: FieldPolicy | FieldReadFunction, mimeType?: FieldPolicy | FieldReadFunction, target?: FieldPolicy | FieldReadFunction }; -export type SettingsDownloadConversionTypeKeySpecifier = ('compressionLevel' | 'mimeType' | 'target' | SettingsDownloadConversionTypeKeySpecifier)[]; +export type SettingsDownloadConversionHeaderKeySpecifier = ('name' | 'value' | SettingsDownloadConversionHeaderKeySpecifier)[]; +export type SettingsDownloadConversionHeaderFieldPolicy = { + name?: FieldPolicy | FieldReadFunction, + value?: FieldPolicy | FieldReadFunction +}; +export type SettingsDownloadConversionHeaderTypeKeySpecifier = ('name' | 'value' | SettingsDownloadConversionHeaderTypeKeySpecifier)[]; +export type SettingsDownloadConversionHeaderTypeFieldPolicy = { + name?: FieldPolicy | FieldReadFunction, + value?: FieldPolicy | FieldReadFunction +}; +export type SettingsDownloadConversionTypeKeySpecifier = ('callTimeout' | 'compressionLevel' | 'connectTimeout' | 'headers' | 'mimeType' | 'target' | SettingsDownloadConversionTypeKeySpecifier)[]; export type SettingsDownloadConversionTypeFieldPolicy = { + callTimeout?: FieldPolicy | FieldReadFunction, compressionLevel?: FieldPolicy | FieldReadFunction, + connectTimeout?: FieldPolicy | FieldReadFunction, + headers?: FieldPolicy | FieldReadFunction, mimeType?: FieldPolicy | FieldReadFunction, target?: FieldPolicy | FieldReadFunction }; -export type SettingsTypeKeySpecifier = ('authMode' | 'authPassword' | 'authUsername' | 'autoDownloadAheadLimit' | 'autoDownloadIgnoreReUploads' | 'autoDownloadNewChapters' | 'autoDownloadNewChaptersLimit' | 'backupInterval' | 'backupPath' | 'backupTTL' | 'backupTime' | 'basicAuthEnabled' | 'basicAuthPassword' | 'basicAuthUsername' | 'databasePassword' | 'databaseType' | 'databaseUrl' | 'databaseUsername' | 'debugLogsEnabled' | 'downloadAsCbz' | 'downloadConversions' | 'downloadsPath' | 'electronPath' | 'excludeCompleted' | 'excludeEntryWithUnreadChapters' | 'excludeNotStarted' | 'excludeUnreadChapters' | 'extensionRepos' | 'flareSolverrAsResponseFallback' | 'flareSolverrEnabled' | 'flareSolverrSessionName' | 'flareSolverrSessionTtl' | 'flareSolverrTimeout' | 'flareSolverrUrl' | 'globalUpdateInterval' | 'gqlDebugLogsEnabled' | 'initialOpenInBrowserEnabled' | 'ip' | 'jwtAudience' | 'jwtRefreshExpiry' | 'jwtTokenExpiry' | 'koreaderSyncChecksumMethod' | 'koreaderSyncDeviceId' | 'koreaderSyncPercentageTolerance' | 'koreaderSyncServerUrl' | 'koreaderSyncStrategy' | 'koreaderSyncStrategyBackward' | 'koreaderSyncStrategyForward' | 'koreaderSyncUserkey' | 'koreaderSyncUsername' | 'localSourcePath' | 'maxLogFileSize' | 'maxLogFiles' | 'maxLogFolderSize' | 'maxSourcesInParallel' | 'opdsChapterSortOrder' | 'opdsEnablePageReadProgress' | 'opdsItemsPerPage' | 'opdsMarkAsReadOnDownload' | 'opdsShowOnlyDownloadedChapters' | 'opdsShowOnlyUnreadChapters' | 'opdsUseBinaryFileSizes' | 'port' | 'socksProxyEnabled' | 'socksProxyHost' | 'socksProxyPassword' | 'socksProxyPort' | 'socksProxyUsername' | 'socksProxyVersion' | 'systemTrayEnabled' | 'updateMangas' | 'webUIChannel' | 'webUIFlavor' | 'webUIInterface' | 'webUIUpdateCheckInterval' | SettingsTypeKeySpecifier)[]; +export type SettingsTypeKeySpecifier = ('authMode' | 'authPassword' | 'authUsername' | 'autoBackupIncludeCategories' | 'autoBackupIncludeChapters' | 'autoBackupIncludeClientData' | 'autoBackupIncludeHistory' | 'autoBackupIncludeManga' | 'autoBackupIncludeServerSettings' | 'autoBackupIncludeTracking' | 'autoDownloadAheadLimit' | 'autoDownloadIgnoreReUploads' | 'autoDownloadNewChapters' | 'autoDownloadNewChaptersLimit' | 'backupInterval' | 'backupPath' | 'backupTTL' | 'backupTime' | 'basicAuthEnabled' | 'basicAuthPassword' | 'basicAuthUsername' | 'databasePassword' | 'databaseType' | 'databaseUrl' | 'databaseUsername' | 'debugLogsEnabled' | 'downloadAsCbz' | 'downloadConversions' | 'downloadsPath' | 'electronPath' | 'excludeCompleted' | 'excludeEntryWithUnreadChapters' | 'excludeNotStarted' | 'excludeUnreadChapters' | 'extensionRepos' | 'flareSolverrAsResponseFallback' | 'flareSolverrEnabled' | 'flareSolverrSessionName' | 'flareSolverrSessionTtl' | 'flareSolverrTimeout' | 'flareSolverrUrl' | 'globalUpdateInterval' | 'gqlDebugLogsEnabled' | 'initialOpenInBrowserEnabled' | 'ip' | 'jwtAudience' | 'jwtRefreshExpiry' | 'jwtTokenExpiry' | 'koreaderSyncChecksumMethod' | 'koreaderSyncDeviceId' | 'koreaderSyncPercentageTolerance' | 'koreaderSyncServerUrl' | 'koreaderSyncStrategy' | 'koreaderSyncStrategyBackward' | 'koreaderSyncStrategyForward' | 'koreaderSyncUserkey' | 'koreaderSyncUsername' | 'localSourcePath' | 'maxLogFileSize' | 'maxLogFiles' | 'maxLogFolderSize' | 'maxSourcesInParallel' | 'opdsCbzMimetype' | 'opdsChapterSortOrder' | 'opdsEnablePageReadProgress' | 'opdsItemsPerPage' | 'opdsMarkAsReadOnDownload' | 'opdsShowOnlyDownloadedChapters' | 'opdsShowOnlyUnreadChapters' | 'opdsUseBinaryFileSizes' | 'port' | 'serveConversions' | 'socksProxyEnabled' | 'socksProxyHost' | 'socksProxyPassword' | 'socksProxyPort' | 'socksProxyUsername' | 'socksProxyVersion' | 'systemTrayEnabled' | 'updateMangas' | 'useHikariConnectionPool' | 'webUIChannel' | 'webUIFlavor' | 'webUIInterface' | 'webUIUpdateCheckInterval' | SettingsTypeKeySpecifier)[]; export type SettingsTypeFieldPolicy = { authMode?: FieldPolicy | FieldReadFunction, authPassword?: FieldPolicy | FieldReadFunction, authUsername?: FieldPolicy | FieldReadFunction, + autoBackupIncludeCategories?: FieldPolicy | FieldReadFunction, + autoBackupIncludeChapters?: FieldPolicy | FieldReadFunction, + autoBackupIncludeClientData?: FieldPolicy | FieldReadFunction, + autoBackupIncludeHistory?: FieldPolicy | FieldReadFunction, + autoBackupIncludeManga?: FieldPolicy | FieldReadFunction, + autoBackupIncludeServerSettings?: FieldPolicy | FieldReadFunction, + autoBackupIncludeTracking?: FieldPolicy | FieldReadFunction, autoDownloadAheadLimit?: FieldPolicy | FieldReadFunction, autoDownloadIgnoreReUploads?: FieldPolicy | FieldReadFunction, autoDownloadNewChapters?: FieldPolicy | FieldReadFunction, @@ -924,6 +965,7 @@ export type SettingsTypeFieldPolicy = { maxLogFiles?: FieldPolicy | FieldReadFunction, maxLogFolderSize?: FieldPolicy | FieldReadFunction, maxSourcesInParallel?: FieldPolicy | FieldReadFunction, + opdsCbzMimetype?: FieldPolicy | FieldReadFunction, opdsChapterSortOrder?: FieldPolicy | FieldReadFunction, opdsEnablePageReadProgress?: FieldPolicy | FieldReadFunction, opdsItemsPerPage?: FieldPolicy | FieldReadFunction, @@ -932,6 +974,7 @@ export type SettingsTypeFieldPolicy = { opdsShowOnlyUnreadChapters?: FieldPolicy | FieldReadFunction, opdsUseBinaryFileSizes?: FieldPolicy | FieldReadFunction, port?: FieldPolicy | FieldReadFunction, + serveConversions?: FieldPolicy | FieldReadFunction, socksProxyEnabled?: FieldPolicy | FieldReadFunction, socksProxyHost?: FieldPolicy | FieldReadFunction, socksProxyPassword?: FieldPolicy | FieldReadFunction, @@ -940,6 +983,7 @@ export type SettingsTypeFieldPolicy = { socksProxyVersion?: FieldPolicy | FieldReadFunction, systemTrayEnabled?: FieldPolicy | FieldReadFunction, updateMangas?: FieldPolicy | FieldReadFunction, + useHikariConnectionPool?: FieldPolicy | FieldReadFunction, webUIChannel?: FieldPolicy | FieldReadFunction, webUIFlavor?: FieldPolicy | FieldReadFunction, webUIInterface?: FieldPolicy | FieldReadFunction, @@ -1665,6 +1709,14 @@ export type StrictTypedTypePolicies = { keyFields?: false | SettingsDownloadConversionKeySpecifier | (() => undefined | SettingsDownloadConversionKeySpecifier), fields?: SettingsDownloadConversionFieldPolicy, }, + SettingsDownloadConversionHeader?: Omit & { + keyFields?: false | SettingsDownloadConversionHeaderKeySpecifier | (() => undefined | SettingsDownloadConversionHeaderKeySpecifier), + fields?: SettingsDownloadConversionHeaderFieldPolicy, + }, + SettingsDownloadConversionHeaderType?: Omit & { + keyFields?: false | SettingsDownloadConversionHeaderTypeKeySpecifier | (() => undefined | SettingsDownloadConversionHeaderTypeKeySpecifier), + fields?: SettingsDownloadConversionHeaderTypeFieldPolicy, + }, SettingsDownloadConversionType?: Omit & { keyFields?: false | SettingsDownloadConversionTypeKeySpecifier | (() => undefined | SettingsDownloadConversionTypeKeySpecifier), fields?: SettingsDownloadConversionTypeFieldPolicy, diff --git a/src/lib/graphql/generated/graphql.ts b/src/lib/graphql/generated/graphql.ts index d13747ae..001f6078 100644 --- a/src/lib/graphql/generated/graphql.ts +++ b/src/lib/graphql/generated/graphql.ts @@ -172,6 +172,12 @@ export type CategoryUpdateType = { status: CategoryJobStatus; }; +export enum CbzMediaType { + Compatible = 'COMPATIBLE', + Legacy = 'LEGACY', + Modern = 'MODERN' +} + export type ChapterConditionInput = { chapterNumber?: InputMaybe; fetchedAt?: InputMaybe; @@ -199,7 +205,7 @@ export type ChapterEdge = Edge & { export type ChapterFilterInput = { and?: InputMaybe>; - chapterNumber?: InputMaybe; + chapterNumber?: InputMaybe; fetchedAt?: InputMaybe; id?: InputMaybe; inLibrary?: InputMaybe; @@ -331,6 +337,7 @@ export type ClearDownloaderPayload = { export type ConnectKoSyncAccountInput = { clientMutationId?: InputMaybe; password: Scalars['String']['input']; + serverAddress: Scalars['String']['input']; username: Scalars['String']['input']; }; @@ -785,24 +792,6 @@ export type FilterChangeInput = { triState?: InputMaybe; }; -export type FloatFilterInput = { - distinctFrom?: InputMaybe; - distinctFromAll?: InputMaybe>; - distinctFromAny?: InputMaybe>; - equalTo?: InputMaybe; - greaterThan?: InputMaybe; - greaterThanOrEqualTo?: InputMaybe; - in?: InputMaybe>; - isNull?: InputMaybe; - lessThan?: InputMaybe; - lessThanOrEqualTo?: InputMaybe; - notDistinctFrom?: InputMaybe; - notEqualTo?: InputMaybe; - notEqualToAll?: InputMaybe>; - notEqualToAny?: InputMaybe>; - notIn?: InputMaybe>; -}; - export type GlobalMetaNodeList = NodeList & { __typename?: 'GlobalMetaNodeList'; edges: Array; @@ -872,14 +861,13 @@ export type KoSyncConnectPayload = { __typename?: 'KoSyncConnectPayload'; clientMutationId?: Maybe; message?: Maybe; - settings: SettingsType; - success: Scalars['Boolean']['output']; - username?: Maybe; + status: KoSyncStatusPayload; }; export type KoSyncStatusPayload = { __typename?: 'KoSyncStatusPayload'; isLoggedIn: Scalars['Boolean']['output']; + serverAddress?: Maybe; username?: Maybe; }; @@ -980,8 +968,7 @@ export type LogoutKoSyncAccountInput = { export type LogoutKoSyncAccountPayload = { __typename?: 'LogoutKoSyncAccountPayload'; clientMutationId?: Maybe; - settings: SettingsType; - success: Scalars['Boolean']['output']; + status: KoSyncStatusPayload; }; export type LogoutTrackerInput = { @@ -1656,6 +1643,13 @@ export type PartialSettingsType = Settings & { authMode?: Maybe; authPassword?: Maybe; authUsername?: Maybe; + autoBackupIncludeCategories?: Maybe; + autoBackupIncludeChapters?: Maybe; + autoBackupIncludeClientData?: Maybe; + autoBackupIncludeHistory?: Maybe; + autoBackupIncludeManga?: Maybe; + autoBackupIncludeServerSettings?: Maybe; + autoBackupIncludeTracking?: Maybe; /** @deprecated Replaced with autoDownloadNewChaptersLimit, replace with autoDownloadNewChaptersLimit */ autoDownloadAheadLimit?: Maybe; autoDownloadIgnoreReUploads?: Maybe; @@ -1700,20 +1694,25 @@ export type PartialSettingsType = Settings & { jwtRefreshExpiry?: Maybe; jwtTokenExpiry?: Maybe; koreaderSyncChecksumMethod?: Maybe; + /** @deprecated Moved to preference store. Is supposed to be random and gets auto generated, replace with MOVE TO PREFERENCES */ koreaderSyncDeviceId?: Maybe; koreaderSyncPercentageTolerance?: Maybe; + /** @deprecated Moved to preference store. User is supposed to use a login/logout mutation, replace with MOVE TO PREFERENCES */ koreaderSyncServerUrl?: Maybe; /** @deprecated Replaced with koreaderSyncStrategyForward and koreaderSyncStrategyBackward, replace with koreaderSyncStrategyForward, koreaderSyncStrategyBackward */ koreaderSyncStrategy?: Maybe; koreaderSyncStrategyBackward?: Maybe; koreaderSyncStrategyForward?: Maybe; + /** @deprecated Moved to preference store. User is supposed to use a login/logout mutation, replace with MOVE TO PREFERENCES */ koreaderSyncUserkey?: Maybe; + /** @deprecated Moved to preference store. User is supposed to use a login/logout mutation, replace with MOVE TO PREFERENCES */ koreaderSyncUsername?: Maybe; localSourcePath?: Maybe; maxLogFileSize?: Maybe; maxLogFiles?: Maybe; maxLogFolderSize?: Maybe; maxSourcesInParallel?: Maybe; + opdsCbzMimetype?: Maybe; opdsChapterSortOrder?: Maybe; opdsEnablePageReadProgress?: Maybe; opdsItemsPerPage?: Maybe; @@ -1722,6 +1721,7 @@ export type PartialSettingsType = Settings & { opdsShowOnlyUnreadChapters?: Maybe; opdsUseBinaryFileSizes?: Maybe; port?: Maybe; + serveConversions?: Maybe>; socksProxyEnabled?: Maybe; socksProxyHost?: Maybe; socksProxyPassword?: Maybe; @@ -1730,6 +1730,7 @@ export type PartialSettingsType = Settings & { socksProxyVersion?: Maybe; systemTrayEnabled?: Maybe; updateMangas?: Maybe; + useHikariConnectionPool?: Maybe; webUIChannel?: Maybe; webUIFlavor?: Maybe; webUIInterface?: Maybe; @@ -1740,6 +1741,13 @@ export type PartialSettingsTypeInput = { authMode?: InputMaybe; authPassword?: InputMaybe; authUsername?: InputMaybe; + autoBackupIncludeCategories?: InputMaybe; + autoBackupIncludeChapters?: InputMaybe; + autoBackupIncludeClientData?: InputMaybe; + autoBackupIncludeHistory?: InputMaybe; + autoBackupIncludeManga?: InputMaybe; + autoBackupIncludeServerSettings?: InputMaybe; + autoBackupIncludeTracking?: InputMaybe; autoDownloadIgnoreReUploads?: InputMaybe; autoDownloadNewChapters?: InputMaybe; autoDownloadNewChaptersLimit?: InputMaybe; @@ -1774,18 +1782,15 @@ export type PartialSettingsTypeInput = { jwtRefreshExpiry?: InputMaybe; jwtTokenExpiry?: InputMaybe; koreaderSyncChecksumMethod?: InputMaybe; - koreaderSyncDeviceId?: InputMaybe; koreaderSyncPercentageTolerance?: InputMaybe; - koreaderSyncServerUrl?: InputMaybe; koreaderSyncStrategyBackward?: InputMaybe; koreaderSyncStrategyForward?: InputMaybe; - koreaderSyncUserkey?: InputMaybe; - koreaderSyncUsername?: InputMaybe; localSourcePath?: InputMaybe; maxLogFileSize?: InputMaybe; maxLogFiles?: InputMaybe; maxLogFolderSize?: InputMaybe; maxSourcesInParallel?: InputMaybe; + opdsCbzMimetype?: InputMaybe; opdsChapterSortOrder?: InputMaybe; opdsEnablePageReadProgress?: InputMaybe; opdsItemsPerPage?: InputMaybe; @@ -1794,6 +1799,7 @@ export type PartialSettingsTypeInput = { opdsShowOnlyUnreadChapters?: InputMaybe; opdsUseBinaryFileSizes?: InputMaybe; port?: InputMaybe; + serveConversions?: InputMaybe>; socksProxyEnabled?: InputMaybe; socksProxyHost?: InputMaybe; socksProxyPassword?: InputMaybe; @@ -1802,6 +1808,7 @@ export type PartialSettingsTypeInput = { socksProxyVersion?: InputMaybe; systemTrayEnabled?: InputMaybe; updateMangas?: InputMaybe; + useHikariConnectionPool?: InputMaybe; webUIChannel?: InputMaybe; webUIFlavor?: InputMaybe; webUIInterface?: InputMaybe; @@ -2173,6 +2180,13 @@ export type Settings = { authMode?: Maybe; authPassword?: Maybe; authUsername?: Maybe; + autoBackupIncludeCategories?: Maybe; + autoBackupIncludeChapters?: Maybe; + autoBackupIncludeClientData?: Maybe; + autoBackupIncludeHistory?: Maybe; + autoBackupIncludeManga?: Maybe; + autoBackupIncludeServerSettings?: Maybe; + autoBackupIncludeTracking?: Maybe; /** @deprecated Replaced with autoDownloadNewChaptersLimit, replace with autoDownloadNewChaptersLimit */ autoDownloadAheadLimit?: Maybe; autoDownloadIgnoreReUploads?: Maybe; @@ -2217,20 +2231,25 @@ export type Settings = { jwtRefreshExpiry?: Maybe; jwtTokenExpiry?: Maybe; koreaderSyncChecksumMethod?: Maybe; + /** @deprecated Moved to preference store. Is supposed to be random and gets auto generated, replace with MOVE TO PREFERENCES */ koreaderSyncDeviceId?: Maybe; koreaderSyncPercentageTolerance?: Maybe; + /** @deprecated Moved to preference store. User is supposed to use a login/logout mutation, replace with MOVE TO PREFERENCES */ koreaderSyncServerUrl?: Maybe; /** @deprecated Replaced with koreaderSyncStrategyForward and koreaderSyncStrategyBackward, replace with koreaderSyncStrategyForward, koreaderSyncStrategyBackward */ koreaderSyncStrategy?: Maybe; koreaderSyncStrategyBackward?: Maybe; koreaderSyncStrategyForward?: Maybe; + /** @deprecated Moved to preference store. User is supposed to use a login/logout mutation, replace with MOVE TO PREFERENCES */ koreaderSyncUserkey?: Maybe; + /** @deprecated Moved to preference store. User is supposed to use a login/logout mutation, replace with MOVE TO PREFERENCES */ koreaderSyncUsername?: Maybe; localSourcePath?: Maybe; maxLogFileSize?: Maybe; maxLogFiles?: Maybe; maxLogFolderSize?: Maybe; maxSourcesInParallel?: Maybe; + opdsCbzMimetype?: Maybe; opdsChapterSortOrder?: Maybe; opdsEnablePageReadProgress?: Maybe; opdsItemsPerPage?: Maybe; @@ -2239,6 +2258,7 @@ export type Settings = { opdsShowOnlyUnreadChapters?: Maybe; opdsUseBinaryFileSizes?: Maybe; port?: Maybe; + serveConversions?: Maybe>; socksProxyEnabled?: Maybe; socksProxyHost?: Maybe; socksProxyPassword?: Maybe; @@ -2247,6 +2267,7 @@ export type Settings = { socksProxyVersion?: Maybe; systemTrayEnabled?: Maybe; updateMangas?: Maybe; + useHikariConnectionPool?: Maybe; webUIChannel?: Maybe; webUIFlavor?: Maybe; webUIInterface?: Maybe; @@ -2254,20 +2275,45 @@ export type Settings = { }; export type SettingsDownloadConversion = { + callTimeout?: Maybe; compressionLevel?: Maybe; + connectTimeout?: Maybe; + headers?: Maybe>; mimeType: Scalars['String']['output']; target: Scalars['String']['output']; }; +export type SettingsDownloadConversionHeader = { + name: Scalars['String']['output']; + value: Scalars['String']['output']; +}; + +export type SettingsDownloadConversionHeaderType = SettingsDownloadConversionHeader & { + __typename?: 'SettingsDownloadConversionHeaderType'; + name: Scalars['String']['output']; + value: Scalars['String']['output']; +}; + +export type SettingsDownloadConversionHeaderTypeInput = { + name: Scalars['String']['input']; + value: Scalars['String']['input']; +}; + export type SettingsDownloadConversionType = SettingsDownloadConversion & { __typename?: 'SettingsDownloadConversionType'; + callTimeout?: Maybe; compressionLevel?: Maybe; + connectTimeout?: Maybe; + headers?: Maybe>; mimeType: Scalars['String']['output']; target: Scalars['String']['output']; }; export type SettingsDownloadConversionTypeInput = { + callTimeout?: InputMaybe; compressionLevel?: InputMaybe; + connectTimeout?: InputMaybe; + headers?: InputMaybe>; mimeType: Scalars['String']['input']; target: Scalars['String']['input']; }; @@ -2277,6 +2323,13 @@ export type SettingsType = Settings & { authMode: AuthMode; authPassword: Scalars['String']['output']; authUsername: Scalars['String']['output']; + autoBackupIncludeCategories: Scalars['Boolean']['output']; + autoBackupIncludeChapters: Scalars['Boolean']['output']; + autoBackupIncludeClientData: Scalars['Boolean']['output']; + autoBackupIncludeHistory: Scalars['Boolean']['output']; + autoBackupIncludeManga: Scalars['Boolean']['output']; + autoBackupIncludeServerSettings: Scalars['Boolean']['output']; + autoBackupIncludeTracking: Scalars['Boolean']['output']; /** @deprecated Replaced with autoDownloadNewChaptersLimit, replace with autoDownloadNewChaptersLimit */ autoDownloadAheadLimit: Scalars['Int']['output']; autoDownloadIgnoreReUploads: Scalars['Boolean']['output']; @@ -2321,20 +2374,25 @@ export type SettingsType = Settings & { jwtRefreshExpiry: Scalars['Duration']['output']; jwtTokenExpiry: Scalars['Duration']['output']; koreaderSyncChecksumMethod: KoreaderSyncChecksumMethod; + /** @deprecated Moved to preference store. Is supposed to be random and gets auto generated, replace with MOVE TO PREFERENCES */ koreaderSyncDeviceId: Scalars['String']['output']; koreaderSyncPercentageTolerance: Scalars['Float']['output']; + /** @deprecated Moved to preference store. User is supposed to use a login/logout mutation, replace with MOVE TO PREFERENCES */ koreaderSyncServerUrl: Scalars['String']['output']; /** @deprecated Replaced with koreaderSyncStrategyForward and koreaderSyncStrategyBackward, replace with koreaderSyncStrategyForward, koreaderSyncStrategyBackward */ koreaderSyncStrategy: KoreaderSyncLegacyStrategy; koreaderSyncStrategyBackward: KoreaderSyncConflictStrategy; koreaderSyncStrategyForward: KoreaderSyncConflictStrategy; + /** @deprecated Moved to preference store. User is supposed to use a login/logout mutation, replace with MOVE TO PREFERENCES */ koreaderSyncUserkey: Scalars['String']['output']; + /** @deprecated Moved to preference store. User is supposed to use a login/logout mutation, replace with MOVE TO PREFERENCES */ koreaderSyncUsername: Scalars['String']['output']; localSourcePath: Scalars['String']['output']; maxLogFileSize: Scalars['String']['output']; maxLogFiles: Scalars['Int']['output']; maxLogFolderSize: Scalars['String']['output']; maxSourcesInParallel: Scalars['Int']['output']; + opdsCbzMimetype: CbzMediaType; opdsChapterSortOrder: SortOrder; opdsEnablePageReadProgress: Scalars['Boolean']['output']; opdsItemsPerPage: Scalars['Int']['output']; @@ -2343,6 +2401,7 @@ export type SettingsType = Settings & { opdsShowOnlyUnreadChapters: Scalars['Boolean']['output']; opdsUseBinaryFileSizes: Scalars['Boolean']['output']; port: Scalars['Int']['output']; + serveConversions: Array; socksProxyEnabled: Scalars['Boolean']['output']; socksProxyHost: Scalars['String']['output']; socksProxyPassword: Scalars['String']['output']; @@ -2351,6 +2410,7 @@ export type SettingsType = Settings & { socksProxyVersion: Scalars['Int']['output']; systemTrayEnabled: Scalars['Boolean']['output']; updateMangas: Scalars['Boolean']['output']; + useHikariConnectionPool: Scalars['Boolean']['output']; webUIChannel: WebUiChannel; webUIFlavor: WebUiFlavor; webUIInterface: WebUiInterface; @@ -3211,6 +3271,8 @@ export type WebuiUpdateInfoFragment = { __typename?: 'WebUIUpdateInfo', channel: export type WebuiUpdateStatusFragment = { __typename?: 'WebUIUpdateStatus', progress: number, state: UpdateState, info: { __typename?: 'WebUIUpdateInfo', channel: WebUiChannel, tag: string } }; +export type KoSyncStatusFragment = { __typename?: 'KoSyncStatusPayload', isLoggedIn: boolean, serverAddress?: string | null, username?: string | null }; + export type MangaMetaFieldsFragment = { __typename?: 'MangaMetaType', mangaId: number, key: string, value: string }; export type MangaBaseFieldsFragment = { __typename?: 'MangaType', id: number, title: string, thumbnailUrl?: string | null, thumbnailUrlLastFetched?: string | null, inLibrary: boolean, initialized: boolean, sourceId: string }; @@ -3227,7 +3289,7 @@ export type MangaScreenFieldsFragment = { __typename?: 'MangaType', artist?: str export type MangaLibraryDuplicateScreenFieldsFragment = { __typename?: 'MangaType', description?: string | null, id: number, title: string, thumbnailUrl?: string | null, thumbnailUrlLastFetched?: string | null, inLibrary: boolean, initialized: boolean, sourceId: string, unreadCount: number, downloadCount: number, bookmarkCount: number, hasDuplicateChapters: boolean, chapters: { __typename?: 'ChapterNodeList', totalCount: 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, autoDownloadIgnoreReUploads: boolean, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, authMode: AuthMode, authPassword: string, authUsername: string, jwtAudience: string, jwtTokenExpiry: string, jwtRefreshExpiry: string, debugLogsEnabled: boolean, systemTrayEnabled: boolean, maxLogFileSize: string, maxLogFiles: number, maxLogFolderSize: string, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number, flareSolverrAsResponseFallback: boolean, opdsUseBinaryFileSizes: boolean, opdsItemsPerPage: number, opdsEnablePageReadProgress: boolean, opdsMarkAsReadOnDownload: boolean, opdsShowOnlyUnreadChapters: boolean, opdsShowOnlyDownloadedChapters: boolean, opdsChapterSortOrder: SortOrder, koreaderSyncServerUrl: string, koreaderSyncUsername: string, koreaderSyncUserkey: string, koreaderSyncDeviceId: string, koreaderSyncChecksumMethod: KoreaderSyncChecksumMethod, koreaderSyncStrategy: KoreaderSyncLegacyStrategy, koreaderSyncPercentageTolerance: number, databaseType: DatabaseType, databaseUrl: string, databaseUsername: string, databasePassword: string, downloadConversions: Array<{ __typename?: 'SettingsDownloadConversionType', mimeType: string, target: string, compressionLevel?: number | null }> }; +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, autoDownloadIgnoreReUploads: boolean, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, authMode: AuthMode, authPassword: string, authUsername: string, jwtAudience: string, jwtTokenExpiry: string, jwtRefreshExpiry: string, debugLogsEnabled: boolean, systemTrayEnabled: boolean, maxLogFileSize: string, maxLogFiles: number, maxLogFolderSize: string, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number, flareSolverrAsResponseFallback: boolean, opdsUseBinaryFileSizes: boolean, opdsItemsPerPage: number, opdsEnablePageReadProgress: boolean, opdsMarkAsReadOnDownload: boolean, opdsShowOnlyUnreadChapters: boolean, opdsShowOnlyDownloadedChapters: boolean, opdsChapterSortOrder: SortOrder, koreaderSyncChecksumMethod: KoreaderSyncChecksumMethod, koreaderSyncStrategyBackward: KoreaderSyncConflictStrategy, koreaderSyncStrategyForward: KoreaderSyncConflictStrategy, koreaderSyncPercentageTolerance: number, databaseType: DatabaseType, databaseUrl: string, databaseUsername: string, databasePassword: string, downloadConversions: Array<{ __typename?: 'SettingsDownloadConversionType', mimeType: string, target: string, compressionLevel?: number | null }> }; export type SourceMetaFieldsFragment = { __typename?: 'SourceMetaType', sourceId: string, key: string, value: string }; @@ -3510,6 +3572,20 @@ export type ClearServerCacheMutationVariables = Exact<{ export type ClearServerCacheMutation = { __typename?: 'Mutation', clearCachedImages: { __typename?: 'ClearCachedImagesPayload', cachedPages?: boolean | null, cachedThumbnails?: boolean | null, downloadedThumbnails?: boolean | null } }; +export type KoSyncLoginMutationVariables = Exact<{ + serverAddress: Scalars['String']['input']; + username: Scalars['String']['input']; + password: Scalars['String']['input']; +}>; + + +export type KoSyncLoginMutation = { __typename?: 'Mutation', connectKoSyncAccount: { __typename?: 'KoSyncConnectPayload', message?: string | null, status: { __typename?: 'KoSyncStatusPayload', isLoggedIn: boolean, serverAddress?: string | null, username?: string | null } } }; + +export type KoSyncLogoutMutationVariables = Exact<{ [key: string]: never; }>; + + +export type KoSyncLogoutMutation = { __typename?: 'Mutation', logoutKoSyncAccount: { __typename?: 'LogoutKoSyncAccountPayload', status: { __typename?: 'KoSyncStatusPayload', isLoggedIn: boolean, serverAddress?: string | null, username?: string | null } } }; + export type DeleteMangaMetadataMutationVariables = Exact<{ input: DeleteMangaMetaInput; }>; @@ -3590,14 +3666,14 @@ export type ResetServerSettingsMutationVariables = Exact<{ }>; -export type ResetServerSettingsMutation = { __typename?: 'Mutation', resetSettings: { __typename?: 'ResetSettingsPayload', 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, autoDownloadIgnoreReUploads: boolean, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, authMode: AuthMode, authPassword: string, authUsername: string, jwtAudience: string, jwtTokenExpiry: string, jwtRefreshExpiry: string, debugLogsEnabled: boolean, systemTrayEnabled: boolean, maxLogFileSize: string, maxLogFiles: number, maxLogFolderSize: string, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number, flareSolverrAsResponseFallback: boolean, opdsUseBinaryFileSizes: boolean, opdsItemsPerPage: number, opdsEnablePageReadProgress: boolean, opdsMarkAsReadOnDownload: boolean, opdsShowOnlyUnreadChapters: boolean, opdsShowOnlyDownloadedChapters: boolean, opdsChapterSortOrder: SortOrder, koreaderSyncServerUrl: string, koreaderSyncUsername: string, koreaderSyncUserkey: string, koreaderSyncDeviceId: string, koreaderSyncChecksumMethod: KoreaderSyncChecksumMethod, koreaderSyncStrategy: KoreaderSyncLegacyStrategy, koreaderSyncPercentageTolerance: number, databaseType: DatabaseType, databaseUrl: string, databaseUsername: string, databasePassword: string, downloadConversions: Array<{ __typename?: 'SettingsDownloadConversionType', mimeType: string, target: string, compressionLevel?: number | null }> } } }; +export type ResetServerSettingsMutation = { __typename?: 'Mutation', resetSettings: { __typename?: 'ResetSettingsPayload', 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, autoDownloadIgnoreReUploads: boolean, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, authMode: AuthMode, authPassword: string, authUsername: string, jwtAudience: string, jwtTokenExpiry: string, jwtRefreshExpiry: string, debugLogsEnabled: boolean, systemTrayEnabled: boolean, maxLogFileSize: string, maxLogFiles: number, maxLogFolderSize: string, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number, flareSolverrAsResponseFallback: boolean, opdsUseBinaryFileSizes: boolean, opdsItemsPerPage: number, opdsEnablePageReadProgress: boolean, opdsMarkAsReadOnDownload: boolean, opdsShowOnlyUnreadChapters: boolean, opdsShowOnlyDownloadedChapters: boolean, opdsChapterSortOrder: SortOrder, koreaderSyncChecksumMethod: KoreaderSyncChecksumMethod, koreaderSyncStrategyBackward: KoreaderSyncConflictStrategy, koreaderSyncStrategyForward: KoreaderSyncConflictStrategy, koreaderSyncPercentageTolerance: number, databaseType: DatabaseType, databaseUrl: string, databaseUsername: string, databasePassword: string, downloadConversions: Array<{ __typename?: 'SettingsDownloadConversionType', mimeType: string, target: string, compressionLevel?: number | null }> } } }; export type UpdateServerSettingsMutationVariables = Exact<{ input: SetSettingsInput; }>; -export type UpdateServerSettingsMutation = { __typename?: 'Mutation', setSettings: { __typename?: 'SetSettingsPayload', 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, autoDownloadIgnoreReUploads: boolean, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, authMode: AuthMode, authPassword: string, authUsername: string, jwtAudience: string, jwtTokenExpiry: string, jwtRefreshExpiry: string, debugLogsEnabled: boolean, systemTrayEnabled: boolean, maxLogFileSize: string, maxLogFiles: number, maxLogFolderSize: string, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number, flareSolverrAsResponseFallback: boolean, opdsUseBinaryFileSizes: boolean, opdsItemsPerPage: number, opdsEnablePageReadProgress: boolean, opdsMarkAsReadOnDownload: boolean, opdsShowOnlyUnreadChapters: boolean, opdsShowOnlyDownloadedChapters: boolean, opdsChapterSortOrder: SortOrder, koreaderSyncServerUrl: string, koreaderSyncUsername: string, koreaderSyncUserkey: string, koreaderSyncDeviceId: string, koreaderSyncChecksumMethod: KoreaderSyncChecksumMethod, koreaderSyncStrategy: KoreaderSyncLegacyStrategy, koreaderSyncPercentageTolerance: number, databaseType: DatabaseType, databaseUrl: string, databaseUsername: string, databasePassword: string, downloadConversions: Array<{ __typename?: 'SettingsDownloadConversionType', mimeType: string, target: string, compressionLevel?: number | null }> } } }; +export type UpdateServerSettingsMutation = { __typename?: 'Mutation', setSettings: { __typename?: 'SetSettingsPayload', 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, autoDownloadIgnoreReUploads: boolean, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, authMode: AuthMode, authPassword: string, authUsername: string, jwtAudience: string, jwtTokenExpiry: string, jwtRefreshExpiry: string, debugLogsEnabled: boolean, systemTrayEnabled: boolean, maxLogFileSize: string, maxLogFiles: number, maxLogFolderSize: string, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number, flareSolverrAsResponseFallback: boolean, opdsUseBinaryFileSizes: boolean, opdsItemsPerPage: number, opdsEnablePageReadProgress: boolean, opdsMarkAsReadOnDownload: boolean, opdsShowOnlyUnreadChapters: boolean, opdsShowOnlyDownloadedChapters: boolean, opdsChapterSortOrder: SortOrder, koreaderSyncChecksumMethod: KoreaderSyncChecksumMethod, koreaderSyncStrategyBackward: KoreaderSyncConflictStrategy, koreaderSyncStrategyForward: KoreaderSyncConflictStrategy, koreaderSyncPercentageTolerance: number, databaseType: DatabaseType, databaseUrl: string, databaseUsername: string, databasePassword: string, downloadConversions: Array<{ __typename?: 'SettingsDownloadConversionType', mimeType: string, target: string, compressionLevel?: number | null }> } } }; export type GetSourceMangasFetchMutationVariables = Exact<{ input: FetchSourceMangaInput; @@ -3881,6 +3957,11 @@ export type GetGlobalMetadatasQueryVariables = Exact<{ export type GetGlobalMetadatasQuery = { __typename?: 'Query', metas: { __typename?: 'GlobalMetaNodeList', totalCount: number, nodes: Array<{ __typename?: 'GlobalMetaType', key: string, value: string }>, pageInfo: { __typename?: 'PageInfo', endCursor?: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null } } }; +export type GetKoSyncStatusQueryVariables = Exact<{ [key: string]: never; }>; + + +export type GetKoSyncStatusQuery = { __typename?: 'Query', koSyncStatus: { __typename?: 'KoSyncStatusPayload', isLoggedIn: boolean, serverAddress?: string | null, username?: string | null } }; + export type GetMangaScreenQueryVariables = Exact<{ id: Scalars['Int']['input']; }>; @@ -3996,7 +4077,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, 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, autoDownloadIgnoreReUploads: boolean, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, authMode: AuthMode, authPassword: string, authUsername: string, jwtAudience: string, jwtTokenExpiry: string, jwtRefreshExpiry: string, debugLogsEnabled: boolean, systemTrayEnabled: boolean, maxLogFileSize: string, maxLogFiles: number, maxLogFolderSize: string, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number, flareSolverrAsResponseFallback: boolean, opdsUseBinaryFileSizes: boolean, opdsItemsPerPage: number, opdsEnablePageReadProgress: boolean, opdsMarkAsReadOnDownload: boolean, opdsShowOnlyUnreadChapters: boolean, opdsShowOnlyDownloadedChapters: boolean, opdsChapterSortOrder: SortOrder, koreaderSyncServerUrl: string, koreaderSyncUsername: string, koreaderSyncUserkey: string, koreaderSyncDeviceId: string, koreaderSyncChecksumMethod: KoreaderSyncChecksumMethod, koreaderSyncStrategy: KoreaderSyncLegacyStrategy, koreaderSyncPercentageTolerance: number, databaseType: DatabaseType, databaseUrl: string, databaseUsername: string, databasePassword: string, downloadConversions: Array<{ __typename?: 'SettingsDownloadConversionType', mimeType: string, target: string, compressionLevel?: number | null }> } }; +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, autoDownloadIgnoreReUploads: boolean, extensionRepos: Array, maxSourcesInParallel: number, excludeUnreadChapters: boolean, excludeNotStarted: boolean, excludeCompleted: boolean, globalUpdateInterval: number, updateMangas: boolean, authMode: AuthMode, authPassword: string, authUsername: string, jwtAudience: string, jwtTokenExpiry: string, jwtRefreshExpiry: string, debugLogsEnabled: boolean, systemTrayEnabled: boolean, maxLogFileSize: string, maxLogFiles: number, maxLogFolderSize: string, backupPath: string, backupTime: string, backupInterval: number, backupTTL: number, localSourcePath: string, flareSolverrEnabled: boolean, flareSolverrUrl: string, flareSolverrTimeout: number, flareSolverrSessionName: string, flareSolverrSessionTtl: number, flareSolverrAsResponseFallback: boolean, opdsUseBinaryFileSizes: boolean, opdsItemsPerPage: number, opdsEnablePageReadProgress: boolean, opdsMarkAsReadOnDownload: boolean, opdsShowOnlyUnreadChapters: boolean, opdsShowOnlyDownloadedChapters: boolean, opdsChapterSortOrder: SortOrder, koreaderSyncChecksumMethod: KoreaderSyncChecksumMethod, koreaderSyncStrategyBackward: KoreaderSyncConflictStrategy, koreaderSyncStrategyForward: KoreaderSyncConflictStrategy, koreaderSyncPercentageTolerance: number, databaseType: DatabaseType, databaseUrl: string, databaseUsername: string, databasePassword: string, downloadConversions: Array<{ __typename?: 'SettingsDownloadConversionType', mimeType: string, target: string, compressionLevel?: number | null }> } }; export type GetSourceBrowseQueryVariables = Exact<{ id: Scalars['LongString']['input']; diff --git a/src/lib/graphql/mutations/KoreaderSyncMutation.ts b/src/lib/graphql/mutations/KoreaderSyncMutation.ts new file mode 100644 index 00000000..cc27a8a9 --- /dev/null +++ b/src/lib/graphql/mutations/KoreaderSyncMutation.ts @@ -0,0 +1,35 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { KO_SYNC_STATUS } from '@/lib/graphql/fragments/KoreaderSyncFragments.ts'; + +export const KO_SYNC_LOGIN = gql` + ${KO_SYNC_STATUS} + + mutation KO_SYNC_LOGIN($serverAddress: String!, $username: String!, $password: String!) { + connectKoSyncAccount(input: { serverAddress: $serverAddress, username: $username, password: $password }) { + message + status { + ...KO_SYNC_STATUS + } + } + } +`; + +export const KO_SYNC_LOGOUT = gql` + ${KO_SYNC_STATUS} + + mutation KO_SYNC_LOGOUT { + logoutKoSyncAccount(input: {}) { + status { + ...KO_SYNC_STATUS + } + } + } +`; diff --git a/src/lib/graphql/queries/KoreaderSyncQuery.ts b/src/lib/graphql/queries/KoreaderSyncQuery.ts new file mode 100644 index 00000000..29394b2c --- /dev/null +++ b/src/lib/graphql/queries/KoreaderSyncQuery.ts @@ -0,0 +1,20 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { KO_SYNC_STATUS } from '@/lib/graphql/fragments/KoreaderSyncFragments.ts'; + +export const GET_KO_SYNC_STATUS = gql` + ${KO_SYNC_STATUS} + + query GET_KO_SYNC_STATUS { + koSyncStatus { + ...KO_SYNC_STATUS + } + } +`; diff --git a/src/lib/requests/RequestManager.ts b/src/lib/requests/RequestManager.ts index c02a160d..365ee1c7 100644 --- a/src/lib/requests/RequestManager.ts +++ b/src/lib/requests/RequestManager.ts @@ -222,6 +222,12 @@ import { CreateBackupMutation, CreateBackupMutationVariables, RestoreBackupInput, + KoSyncLoginMutation, + KoSyncLoginMutationVariables, + KoSyncLogoutMutation, + KoSyncLogoutMutationVariables, + GetKoSyncStatusQuery, + GetKoSyncStatusQueryVariables, } from '@/lib/graphql/generated/graphql.ts'; import { GET_GLOBAL_METADATAS } from '@/lib/graphql/queries/GlobalMetadataQuery.ts'; import { DELETE_GLOBAL_METADATA, SET_GLOBAL_METADATA } from '@/lib/graphql/mutations/GlobalMetadataMutation.ts'; @@ -341,6 +347,8 @@ import { updateMetadataList } from '@/features/metadata/services/MetadataApolloC import { USER_LOGIN, USER_REFRESH } from '@/lib/graphql/mutations/UserMutation.ts'; import { AuthManager } from '@/features/authentication/AuthManager.ts'; import { useLocalStorage } from '@/base/hooks/useStorage.tsx'; +import { KO_SYNC_LOGIN, KO_SYNC_LOGOUT } from '@/lib/graphql/mutations/KoreaderSyncMutation.ts'; +import { GET_KO_SYNC_STATUS } from '@/lib/graphql/queries/KoreaderSyncQuery.ts'; import { ImageCache } from '@/lib/service-worker/ImageCache.ts'; enum GQLMethod { @@ -3262,22 +3270,33 @@ export class RequestManager { return this.doRequest(GQLMethod.USE_QUERY, document, undefined, options); } - public useLogoutFromTracker( - options?: MutationHookOptions, - ): AbortableApolloUseMutationResponse { - return this.doRequest(GQLMethod.USE_MUTATION, TRACKER_LOGOUT, undefined, options); + public logoutFromTracker( + trackerId: TrackerLogoutMutationVariables['trackerId'], + options?: MutationOptions, + ): AbortableApolloMutationResponse { + return this.doRequest(GQLMethod.MUTATION, TRACKER_LOGOUT, { trackerId }, options); } - public useLoginToTrackerOauth( - options?: MutationHookOptions, - ): AbortableApolloUseMutationResponse { - return this.doRequest(GQLMethod.USE_MUTATION, TRACKER_LOGIN_OAUTH, undefined, options); + public loginToTrackerOauth( + trackerId: number, + callbackUrl: string, + options?: MutationOptions, + ): AbortableApolloMutationResponse { + return this.doRequest(GQLMethod.MUTATION, TRACKER_LOGIN_OAUTH, { input: { trackerId, callbackUrl } }, options); } - public useLoginToTrackerCredentials( - options?: MutationHookOptions, - ): AbortableApolloUseMutationResponse { - return this.doRequest(GQLMethod.USE_MUTATION, TRACKER_LOGIN_CREDENTIALS, undefined, options); + public loginTrackerCredentials( + trackerId: number, + username: string, + password: string, + options?: MutationOptions, + ): AbortableApolloMutationResponse { + return this.doRequest( + GQLMethod.MUTATION, + TRACKER_LOGIN_CREDENTIALS, + { input: { trackerId, username, password } }, + options, + ); } public useTrackerSearch( @@ -3348,6 +3367,36 @@ export class RequestManager { return this.doRequest(GQLMethod.USE_MUTATION, USER_LOGIN, undefined, options); } + public useKoSyncStatus( + options?: QueryHookOptions, + ): AbortableApolloUseQueryResponse { + return this.doRequest(GQLMethod.USE_QUERY, GET_KO_SYNC_STATUS, undefined, options); + } + + public koSyncLogin( + serverAddress: string, + username: string, + password: string, + options?: MutationOptions, + ): AbortableApolloMutationResponse { + return this.doRequest( + GQLMethod.MUTATION, + KO_SYNC_LOGIN, + { + serverAddress, + username, + password, + }, + options, + ); + } + + public koSyncLogout( + options?: MutationOptions, + ): AbortableApolloMutationResponse { + return this.doRequest(GQLMethod.MUTATION, KO_SYNC_LOGOUT, undefined, options); + } + public refreshUser( refreshToken: string, options?: MutationOptions, diff --git a/src/lib/requests/client/GraphQLClient.ts b/src/lib/requests/client/GraphQLClient.ts index 3f549ac7..ab02646e 100644 --- a/src/lib/requests/client/GraphQLClient.ts +++ b/src/lib/requests/client/GraphQLClient.ts @@ -80,6 +80,7 @@ const typePolicies: StrictTypedTypePolicies = { UpdaterJobsInfoType: { keyFields: [] }, WebUIUpdateStatus: { keyFields: [] }, UpdateStatus: { keyFields: [] }, + KoSyncStatusPayload: { keyFields: [] }, Query: { fields: { manga(_, { args, toReference }) { diff --git a/versionToServerVersionMapping.json b/versionToServerVersionMapping.json index 606bd836..5175c564 100644 --- a/versionToServerVersionMapping.json +++ b/versionToServerVersionMapping.json @@ -1,6 +1,11 @@ [ { "uiVersion": "PREVIEW", + "serverVersion": "r2031" + }, + { + "tag": "OLD_PREVIEW", + "uiVersion": "r2914", "serverVersion": "r1960" }, {