Handle server version changes
Server version now contains the "revision" as the "patch" number
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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();
|
||||
@@ -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() {
|
||||
<ListItem>
|
||||
<ListItemText
|
||||
primary={t('settings.server.title.server')}
|
||||
secondary={`${aboutServer.name} ${aboutServer.buildType}`}
|
||||
secondary={`${aboutServer.name} (${aboutServer.buildType})`}
|
||||
/>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
@@ -103,7 +103,7 @@ export function About() {
|
||||
primary={t('settings.about.server.label.version')}
|
||||
secondary={
|
||||
<VersionInfo
|
||||
version={getVersion(aboutServer)}
|
||||
version={aboutServer.version}
|
||||
isCheckingForUpdate={isCheckingForServerUpdate}
|
||||
isUpdateAvailable={isServerUpdateAvailable}
|
||||
updateCheckError={serverUpdateCheckError}
|
||||
@@ -117,7 +117,7 @@ export function About() {
|
||||
<ListItem>
|
||||
<ListItemText
|
||||
primary={t('settings.about.server.label.build_time')}
|
||||
secondary={getBuildTime(aboutServer)}
|
||||
secondary={epochToDate(Number(aboutServer.buildTime)).toString()}
|
||||
/>
|
||||
</ListItem>
|
||||
</List>
|
||||
|
||||
Reference in New Issue
Block a user