Fix missing OpenCode and Pi downloads

This commit is contained in:
AliFozooni
2026-03-15 12:22:53 -07:00
parent 3c3ee6b4f2
commit 6d8c851c25
6 changed files with 107 additions and 37 deletions
@@ -1,19 +1,10 @@
import {
FILE_DOWNLOAD_PROVIDERS,
FILE_DOWNLOAD_PROVIDER_CONFIG_DIRS
} from "../../../../../lib/download-providers.js";
const VALID_ID = /^[a-zA-Z0-9_-]+$/;
const ALLOWED_PROVIDERS = [
'cursor', 'claude-code', 'gemini', 'codex', 'agents', 'kiro',
'universal', 'universal-prefixed',
];
const PROVIDER_CONFIG_DIRS = {
'cursor': '.cursor',
'claude-code': '.claude',
'gemini': '.gemini',
'codex': '.codex',
'agents': '.agents',
'kiro': '.kiro',
};
export async function onRequestGet(context) {
const { type, provider, id } = context.params;
@@ -21,7 +12,7 @@ export async function onRequestGet(context) {
return Response.json({ error: "Invalid type" }, { status: 400 });
}
if (!provider || !ALLOWED_PROVIDERS.includes(provider)) {
if (!provider || !FILE_DOWNLOAD_PROVIDERS.includes(provider)) {
return Response.json({ error: "Invalid provider" }, { status: 400 });
}
@@ -29,7 +20,7 @@ export async function onRequestGet(context) {
return Response.json({ error: "Invalid file ID" }, { status: 400 });
}
const configDir = PROVIDER_CONFIG_DIRS[provider];
const configDir = FILE_DOWNLOAD_PROVIDER_CONFIG_DIRS[provider];
if (!configDir) {
return Response.json({ error: "Invalid provider" }, { status: 400 });
}
+2 -2
View File
@@ -1,9 +1,9 @@
const ALLOWED_PROVIDERS = ['universal', 'universal-prefixed'];
import { BUNDLE_DOWNLOAD_PROVIDERS } from "../../../../lib/download-providers.js";
export async function onRequestGet(context) {
const { provider } = context.params;
if (!provider || !ALLOWED_PROVIDERS.includes(provider)) {
if (!provider || !BUNDLE_DOWNLOAD_PROVIDERS.includes(provider)) {
return Response.json({ error: "Invalid provider" }, { status: 400 });
}