fix(website): fetch release version at runtime with asset validation
Move release version resolution from build-time (vite.config.ts) to runtime (server function on Cloudflare Workers). The server function fetches GitHub releases, filters out prereleases/drafts, and only returns a version that has all required assets (Mac DMG, Linux AppImage, Windows exe). Uses Cloudflare's cf.cacheEverything with a 60s TTL to avoid hitting GitHub on every request. This fixes a race condition where the website would deploy and show download links for a new release before the desktop build assets were actually uploaded, resulting in 404s for users.
This commit is contained in:
@@ -6,13 +6,14 @@ import {
|
||||
appStoreUrl,
|
||||
playStoreUrl,
|
||||
webAppUrl,
|
||||
downloadOptions,
|
||||
getDownloadOptions,
|
||||
useDetectedPlatform,
|
||||
AppleIcon,
|
||||
AndroidIcon,
|
||||
TerminalIcon,
|
||||
GlobeIcon,
|
||||
} from "~/downloads";
|
||||
import { useRelease } from "~/routes/__root";
|
||||
import { Mic } from "lucide-react";
|
||||
import { HeroMockup } from "~/components/hero-mockup";
|
||||
import { ClaudeIcon } from "~/components/mockup";
|
||||
@@ -772,8 +773,9 @@ function GetStarted() {
|
||||
}
|
||||
|
||||
function DownloadButton() {
|
||||
const { version } = useRelease();
|
||||
const detectedPlatform = useDetectedPlatform();
|
||||
const primary = downloadOptions.find((o) => o.platform === detectedPlatform)!;
|
||||
const primary = getDownloadOptions(version).find((o) => o.platform === detectedPlatform)!;
|
||||
const PrimaryIcon = primary.icon;
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user