Handle server version changes

Server version now contains the "revision" as the "patch" number
This commit is contained in:
schroda
2025-04-06 23:58:58 +02:00
parent ddababf716
commit 791ccf1f6a
4 changed files with 20 additions and 39 deletions

View File

@@ -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(

View File

@@ -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();