mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
console: add /download/[platform] endpoint
This commit is contained in:
parent
1e4bfbcf6f
commit
be1a3536ae
1 changed files with 20 additions and 0 deletions
20
packages/console/app/src/routes/download/[platform].ts
Normal file
20
packages/console/app/src/routes/download/[platform].ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { APIEvent } from "@solidjs/start";
|
||||
|
||||
const assetNames: Record<string, string> = {
|
||||
"darwin-aarch64-dmg": "opencode-desktop-darwin-aarch64.dmg",
|
||||
"windows-x64-nsis": "opencode-desktop-windows-x64.exe",
|
||||
"linux-x64-deb": "opencode-desktop-linux-amd64.deb",
|
||||
"linux-x64-rpm": "opencode-desktop-linux-x86_64.rpm"
|
||||
}
|
||||
|
||||
export async function GET({ params: { platform } }: APIEvent) {
|
||||
const assetName = assetNames[platform];
|
||||
if(!assetName) return new Response("Not Found", { status: 404 });
|
||||
|
||||
return await fetch(`https://github.com/sst/opencode/releases/latest/download/${assetName}`, {
|
||||
cf: {
|
||||
cacheTtl: 60 * 60 * 24,
|
||||
cacheEverything: true,
|
||||
}
|
||||
} as any)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue