fix: typings for version api
Some checks failed
Build / build (amd64, 20.x) (push) Has been cancelled
Build / build (amd64, 22.x) (push) Has been cancelled
Build / build (amd64, 23.x) (push) Has been cancelled
Build / build (arm64, 20.x) (push) Has been cancelled
Build / build (arm64, 22.x) (push) Has been cancelled
Build / build (arm64, 23.x) (push) Has been cancelled
Push Docker Images / push (push) Has been cancelled
Push Docker Images / amend-builds (push) Has been cancelled

This commit is contained in:
diced 2025-05-08 21:29:51 -07:00
parent 4a5d01c663
commit 08eb2df26c
No known key found for this signature in database
GPG key ID: 436B2B0FA0DCA354
2 changed files with 19 additions and 19 deletions

View file

@ -80,7 +80,7 @@ export default function VersionBadge() {
{!version.isLatest && !version.isUpstream && version.isRelease && (
<Text>
You are running an <b>outdated</b> version of Zipline. It is recommended to update to the{' '}
<Anchor href={version.latest?.url!}>latest version</Anchor>.
<Anchor href={version.latest.url}>latest version</Anchor>.
</Text>
)}
@ -100,19 +100,19 @@ export default function VersionBadge() {
items={[
{
label: 'Version',
value: version.version?.tag!,
href: `https://github.com/diced/zipline/releases/${version.version?.tag}`,
value: version.version.tag!,
href: `https://github.com/diced/zipline/releases/${version.version.tag}`,
},
{
label: 'Commit',
value: version.version?.sha!,
href: `https://github.com/diced/zipline/commit/${version.version?.sha}`,
value: version.version.sha!,
href: `https://github.com/diced/zipline/commit/${version.version.sha}`,
},
{ label: 'Upstream?', value: version.isUpstream ? 'Yes' : 'No' },
]}
/>
{!version.isLatest && version.isUpstream && (
{!version.isLatest && version.isUpstream && version.latest.commit && (
<>
<Title order={3} mt='sm'>
Latest Commit Available
@ -125,12 +125,12 @@ export default function VersionBadge() {
items={[
{
label: 'Commit',
value: version.latest?.commit?.sha!.slice(0, 7)!,
href: `https://github.com/diced/zipline/commit/${version.latest?.commit?.sha}`,
value: version.latest.commit.sha!.slice(0, 7)!,
href: `https://github.com/diced/zipline/commit/${version.latest.commit.sha}`,
},
{
label: 'Available to update',
value: version.latest?.commit?.pull ? 'Yes' : 'No',
value: version.latest.commit.pull ? 'Yes' : 'No',
},
]}
/>
@ -140,15 +140,15 @@ export default function VersionBadge() {
{!version.isLatest && version.isRelease && (
<>
<Title order={3} mt='sm'>
{version.latest?.tag} is available
{version.latest.tag} is available
</Title>
<VersionButton text='Changelogs' href={version.latest?.url!}>
{version.latest?.tag}
<VersionButton text='Changelogs' href={version.latest.url}>
{version.latest.tag}
</VersionButton>
<VersionButton text='Update' href='https://zipline.diced.sh/docs/get-started/docker#updating'>
{version.latest?.tag}
{version.latest.tag}
</VersionButton>
</>
)}

View file

@ -8,15 +8,15 @@ export type ApiVersionResponse = {
};
interface VersionAPI {
isUpstream?: boolean;
isRelease?: boolean;
isLatest?: boolean;
version?: {
isUpstream: boolean;
isRelease: boolean;
isLatest: boolean;
version: {
tag: string;
sha: string;
url: string;
};
latest?: {
latest: {
tag: string;
url: string;
commit?: {
@ -37,7 +37,7 @@ export default fastifyPlugin(
const resp = await fetch(`https://zipline-version.diced.sh/?${params.toString()}`);
if (!resp.ok) {
return res.internalServerError('failed to fetch version details: ' + await resp.text());
return res.internalServerError('failed to fetch version details: ' + (await resp.text()));
}
const data: VersionAPI = await resp.json();