Handle server version changes
Server version now contains the "revision" as the "patch" number
This commit is contained in:
@@ -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