diff --git a/src/lib/graphql/generated/graphql.ts b/src/lib/graphql/generated/graphql.ts index 90deb257..fd88d6dc 100644 --- a/src/lib/graphql/generated/graphql.ts +++ b/src/lib/graphql/generated/graphql.ts @@ -24,13 +24,14 @@ export type AboutServerPayload = { discord: Scalars['String']['output']; github: Scalars['String']['output']; name: Scalars['String']['output']; + /** @deprecated The version includes the revision as the patch number */ revision: Scalars['String']['output']; version: Scalars['String']['output']; }; export type AboutWebUi = { __typename?: 'AboutWebUI'; - channel: Scalars['String']['output']; + channel: WebUiChannel; tag: Scalars['String']['output']; }; @@ -2792,14 +2793,14 @@ export enum WebUiInterface { export type WebUiUpdateCheck = { __typename?: 'WebUIUpdateCheck'; - channel: Scalars['String']['output']; + channel: WebUiChannel; tag: Scalars['String']['output']; updateAvailable: Scalars['Boolean']['output']; }; export type WebUiUpdateInfo = { __typename?: 'WebUIUpdateInfo'; - channel: Scalars['String']['output']; + channel: WebUiChannel; tag: Scalars['String']['output']; }; @@ -2854,13 +2855,13 @@ export type PageInfoFragment = { __typename?: 'PageInfo', endCursor?: string | n export type GlobalMetadataFragment = { __typename?: 'GlobalMetaType', key: string, value: string }; -export type AboutWebuiFragment = { __typename?: 'AboutWebUI', channel: string, tag: string }; +export type AboutWebuiFragment = { __typename?: 'AboutWebUI', channel: WebUiChannel, tag: string }; -export type WebuiUpdateCheckFragment = { __typename?: 'WebUIUpdateCheck', channel: string, tag: string, updateAvailable: boolean }; +export type WebuiUpdateCheckFragment = { __typename?: 'WebUIUpdateCheck', channel: WebUiChannel, tag: string, updateAvailable: boolean }; -export type WebuiUpdateInfoFragment = { __typename?: 'WebUIUpdateInfo', channel: string, tag: string }; +export type WebuiUpdateInfoFragment = { __typename?: 'WebUIUpdateInfo', channel: WebUiChannel, tag: string }; -export type WebuiUpdateStatusFragment = { __typename?: 'WebUIUpdateStatus', progress: number, state: UpdateState, info: { __typename?: 'WebUIUpdateInfo', channel: string, tag: string } }; +export type WebuiUpdateStatusFragment = { __typename?: 'WebUIUpdateStatus', progress: number, state: UpdateState, info: { __typename?: 'WebUIUpdateInfo', channel: WebUiChannel, tag: string } }; export type MangaMetaFieldsFragment = { __typename?: 'MangaMetaType', mangaId: number, key: string, value: string }; @@ -3228,12 +3229,12 @@ export type UpdateWebuiMutationVariables = Exact<{ }>; -export type UpdateWebuiMutation = { __typename?: 'Mutation', updateWebUI?: { __typename?: 'WebUIUpdatePayload', updateStatus: { __typename?: 'WebUIUpdateStatus', progress: number, state: UpdateState, info: { __typename?: 'WebUIUpdateInfo', channel: string, tag: string } } } | null }; +export type UpdateWebuiMutation = { __typename?: 'Mutation', updateWebUI?: { __typename?: 'WebUIUpdatePayload', updateStatus: { __typename?: 'WebUIUpdateStatus', progress: number, state: UpdateState, info: { __typename?: 'WebUIUpdateInfo', channel: WebUiChannel, tag: string } } } | null }; export type ResetWebuiUpdateStatusMutationVariables = Exact<{ [key: string]: never; }>; -export type ResetWebuiUpdateStatusMutation = { __typename?: 'Mutation', resetWebUIUpdateStatus?: { __typename?: 'WebUIUpdateStatus', state: UpdateState, info: { __typename?: 'WebUIUpdateInfo', channel: string, tag: string } } | null }; +export type ResetWebuiUpdateStatusMutation = { __typename?: 'Mutation', resetWebUIUpdateStatus?: { __typename?: 'WebUIUpdateStatus', state: UpdateState, info: { __typename?: 'WebUIUpdateInfo', channel: WebUiChannel, tag: string } } | null }; export type ResetServerSettingsMutationVariables = Exact<{ input: ResetSettingsInput; @@ -3606,7 +3607,7 @@ export type GetLibraryMangaCountQuery = { __typename?: 'Query', mangas: { __type export type GetAboutQueryVariables = Exact<{ [key: string]: never; }>; -export type GetAboutQuery = { __typename?: 'Query', aboutServer: { __typename?: 'AboutServerPayload', buildTime: string, buildType: string, discord: string, github: string, name: string, revision: string, version: string }, aboutWebUI: { __typename?: 'AboutWebUI', channel: string, tag: string } }; +export type GetAboutQuery = { __typename?: 'Query', aboutServer: { __typename?: 'AboutServerPayload', buildTime: string, buildType: string, discord: string, github: string, name: string, revision: string, version: string }, aboutWebUI: { __typename?: 'AboutWebUI', channel: WebUiChannel, tag: string } }; export type CheckForServerUpdatesQueryVariables = Exact<{ [key: string]: never; }>; @@ -3616,12 +3617,12 @@ export type CheckForServerUpdatesQuery = { __typename?: 'Query', checkForServerU export type CheckForWebuiUpdateQueryVariables = Exact<{ [key: string]: never; }>; -export type CheckForWebuiUpdateQuery = { __typename?: 'Query', checkForWebUIUpdate: { __typename?: 'WebUIUpdateCheck', channel: string, tag: string, updateAvailable: boolean } }; +export type CheckForWebuiUpdateQuery = { __typename?: 'Query', checkForWebUIUpdate: { __typename?: 'WebUIUpdateCheck', channel: WebUiChannel, tag: string, updateAvailable: boolean } }; export type GetWebuiUpdateStatusQueryVariables = Exact<{ [key: string]: never; }>; -export type GetWebuiUpdateStatusQuery = { __typename?: 'Query', getWebUIUpdateStatus: { __typename?: 'WebUIUpdateStatus', progress: number, state: UpdateState, info: { __typename?: 'WebUIUpdateInfo', channel: string, tag: string } } }; +export type GetWebuiUpdateStatusQuery = { __typename?: 'Query', getWebUIUpdateStatus: { __typename?: 'WebUIUpdateStatus', progress: number, state: UpdateState, info: { __typename?: 'WebUIUpdateInfo', channel: WebUiChannel, tag: string } } }; export type GetServerSettingsQueryVariables = Exact<{ [key: string]: never; }>; @@ -3697,7 +3698,7 @@ export type DownloadStatusSubscription = { __typename?: 'Subscription', download export type WebuiUpdateSubscriptionVariables = Exact<{ [key: string]: never; }>; -export type WebuiUpdateSubscription = { __typename?: 'Subscription', webUIUpdateStatusChange: { __typename?: 'WebUIUpdateStatus', progress: number, state: UpdateState, info: { __typename?: 'WebUIUpdateInfo', channel: string, tag: string } } }; +export type WebuiUpdateSubscription = { __typename?: 'Subscription', webUIUpdateStatusChange: { __typename?: 'WebUIUpdateStatus', progress: number, state: UpdateState, info: { __typename?: 'WebUIUpdateInfo', channel: WebUiChannel, tag: string } } }; export type UpdaterSubscriptionVariables = Exact<{ input: LibraryUpdateStatusChangedInput; diff --git a/src/modules/app-updates/components/ServerUpdateChecker.tsx b/src/modules/app-updates/components/ServerUpdateChecker.tsx index 02436c06..59e6bc6e 100644 --- a/src/modules/app-updates/components/ServerUpdateChecker.tsx +++ b/src/modules/app-updates/components/ServerUpdateChecker.tsx @@ -19,7 +19,6 @@ import { useUpdateChecker } from '@/modules/app-updates/hooks/useUpdateChecker.t import { VersionUpdateInfoDialog } from '@/modules/app-updates/components/VersionUpdateInfoDialog.tsx'; import { useMetadataServerSettings } from '@/modules/settings/services/ServerSettingsMetadata.ts'; import { useLocalStorage } from '@/modules/core/hooks/useStorage.tsx'; -import { getVersion } from '@/modules/app-updates/services/AppUpdateChecker.tsx'; import { AppRoutes } from '@/modules/core/AppRoute.constants.ts'; const disabledUpdateCheck = () => Promise.resolve(); @@ -50,7 +49,7 @@ export const ServerUpdateChecker = () => { const selectedServerChannelInfo = serverUpdateCheckData?.checkForServerUpdates?.find( (channel) => channel.channel === aboutServer?.buildType, ); - const version = aboutServer ? getVersion(aboutServer) : undefined; + const version = aboutServer ? aboutServer.version : undefined; const isServerUpdateAvailable = !!selectedServerChannelInfo?.tag && selectedServerChannelInfo.tag !== version; const updateChecker = useUpdateChecker( diff --git a/src/modules/app-updates/services/AppUpdateChecker.tsx b/src/modules/app-updates/services/AppUpdateChecker.tsx deleted file mode 100644 index bb8446d1..00000000 --- a/src/modules/app-updates/services/AppUpdateChecker.tsx +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 { epochToDate } from '@/util/DateHelper.ts'; -import { GetAboutQuery } from '@/lib/graphql/generated/graphql.ts'; - -type AboutServer = GetAboutQuery['aboutServer']; - -export const getVersion = (aboutServer: AboutServer) => { - if (aboutServer.buildType === 'Stable') return `${aboutServer.version}`; - return `${aboutServer.version}-${aboutServer.revision}`; -}; - -export const getBuildTime = (aboutServer: AboutServer) => epochToDate(Number(aboutServer.buildTime)).toString(); diff --git a/src/modules/settings/screens/About.tsx b/src/modules/settings/screens/About.tsx index 6bdc5d30..8996db83 100644 --- a/src/modules/settings/screens/About.tsx +++ b/src/modules/settings/screens/About.tsx @@ -19,10 +19,10 @@ import { LoadingPlaceholder } from '@/modules/core/components/placeholder/Loadin import { UpdateState } from '@/lib/graphql/generated/graphql.ts'; import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts'; import { EmptyViewAbsoluteCentered } from '@/modules/core/components/placeholder/EmptyViewAbsoluteCentered.tsx'; -import { getBuildTime, getVersion } from '@/modules/app-updates/services/AppUpdateChecker.tsx'; import { VersionInfo } from '@/modules/app-updates/components/VersionInfo.tsx'; import { getErrorMessage } from '@/lib/HelperFunctions.ts'; import { useNavBarContext } from '@/modules/navigation-bar/contexts/NavbarContext.tsx'; +import { epochToDate } from '@/util/DateHelper.ts'; export function About() { const { t } = useTranslation(); @@ -79,7 +79,7 @@ export function About() { (channel) => channel.channel === aboutServer.buildType, ); const isServerUpdateAvailable = - !!selectedServerChannelInfo?.tag && selectedServerChannelInfo.tag !== getVersion(aboutServer); + !!selectedServerChannelInfo?.tag && selectedServerChannelInfo.tag !== aboutServer.version; const isWebUIUpdateAvailable = !!webUIUpdateData?.checkForWebUIUpdate.updateAvailable; return ( @@ -95,7 +95,7 @@ export function About() { @@ -103,7 +103,7 @@ export function About() { primary={t('settings.about.server.label.version')} secondary={