Add dynamic download redirect routes and update README links

This commit is contained in:
Jamie Pine
2026-03-15 23:22:03 -07:00
parent 3c30c5bec1
commit 82cd4bf2ef
2 changed files with 47 additions and 3 deletions
+5 -3
View File
@@ -78,11 +78,13 @@ Voicebox is a **local-first voice cloning studio** — a free and open-source al
| Platform | Download |
|----------|----------|
| macOS (Apple Silicon) | [Download DMG](https://github.com/jamiepine/voicebox/releases/latest/download/Voicebox_aarch64.dmg) |
| macOS (Intel) | [Download DMG](https://github.com/jamiepine/voicebox/releases/latest/download/Voicebox_x64.dmg) |
| Windows | [Latest Release](https://github.com/jamiepine/voicebox/releases/latest) |
| macOS (Apple Silicon) | [Download DMG](https://voicebox.sh/download/mac-arm) |
| macOS (Intel) | [Download DMG](https://voicebox.sh/download/mac-intel) |
| Windows | [Download MSI](https://voicebox.sh/download/windows) |
| Docker | `docker compose up` |
> **[View all binaries →](https://github.com/jamiepine/voicebox/releases/latest)**
> **Linux** — Pre-built binaries are not yet available. See [voicebox.sh/linux-install](https://voicebox.sh/linux-install) for build-from-source instructions.
---
@@ -0,0 +1,42 @@
import { type NextRequest, NextResponse } from 'next/server';
import { getLatestRelease } from '@/lib/releases';
export const dynamic = 'force-dynamic';
const PLATFORM_MAP: Record<
string,
keyof Awaited<ReturnType<typeof getLatestRelease>>['downloadLinks']
> = {
'mac-arm': 'macArm',
'mac-intel': 'macIntel',
windows: 'windows',
linux: 'linux',
};
export async function GET(
_request: NextRequest,
{ params }: { params: Promise<{ platform: string }> },
) {
const { platform } = await params;
const key = PLATFORM_MAP[platform];
if (!key) {
return NextResponse.json(
{ error: `Unknown platform: ${platform}. Use: ${Object.keys(PLATFORM_MAP).join(', ')}` },
{ status: 404 },
);
}
try {
const release = await getLatestRelease();
const url = release.downloadLinks[key];
if (!url) {
return NextResponse.json({ error: `No download available for ${platform}` }, { status: 404 });
}
return NextResponse.redirect(url);
} catch {
return NextResponse.redirect(`https://github.com/jamiepine/voicebox/releases/latest`);
}
}