diff --git a/src/components/VersionBadge.tsx b/src/components/VersionBadge.tsx index 14948e0c..7fba5200 100644 --- a/src/components/VersionBadge.tsx +++ b/src/components/VersionBadge.tsx @@ -80,7 +80,7 @@ export default function VersionBadge() { {!version.isLatest && !version.isUpstream && version.isRelease && ( You are running an outdated version of Zipline. It is recommended to update to the{' '} - latest version. + latest version. )} @@ -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 && ( <> 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 - - {version.latest?.tag} + + {version.latest.tag} - {version.latest?.tag} + {version.latest.tag} )} diff --git a/src/server/routes/api/version.ts b/src/server/routes/api/version.ts index bdcd5c57..28d703d2 100755 --- a/src/server/routes/api/version.ts +++ b/src/server/routes/api/version.ts @@ -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();