Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions apps/web/src/app/api/get-upload-url/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ export async function POST(request: NextRequest) {
return NextResponse.json({ error: "Too many requests" }, { status: 429 });
}

// Check R2 configuration
if (
!env.R2_ACCESS_KEY_ID ||
!env.R2_SECRET_ACCESS_KEY ||
!env.R2_BUCKET_NAME ||
!env.CLOUDFLARE_ACCOUNT_ID
) {
return NextResponse.json(
{
error: "Upload storage not configured",
message:
"File uploads require R2 environment variables. Check README for setup instructions.",
},
{ status: 503 }
);
}

// Check transcription configuration
const transcriptionCheck = isTranscriptionConfigured();
if (!transcriptionCheck.configured) {
Expand Down
12 changes: 12 additions & 0 deletions apps/web/src/app/api/sounds/search/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ export async function GET(request: NextRequest) {
return NextResponse.json({ error: "Too many requests" }, { status: 429 });
}

// Check Freesound configuration
if (!env.FREESOUND_API_KEY) {
return NextResponse.json(
{
error: "Sound search not configured",
message:
"Sound search requires Freesound API key. Check README for setup instructions.",
},
{ status: 503 }
);
}

const { searchParams } = new URL(request.url);

const validationResult = searchParamsSchema.safeParse({
Expand Down
8 changes: 8 additions & 0 deletions apps/web/src/app/api/transcribe/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ export async function POST(request: NextRequest) {
modalRequestBody.iv = iv;
}

// TypeScript guard: we already checked this above, but need to satisfy the type checker
if (!env.MODAL_TRANSCRIPTION_URL) {
return NextResponse.json(
{ error: "Transcription service URL not configured" },
{ status: 503 }
);
}

// Call Modal transcription service
const response = await fetch(env.MODAL_TRANSCRIPTION_URL, {
method: "POST",
Expand Down
14 changes: 7 additions & 7 deletions apps/web/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ export const env = createEnv({
.default("development"),
UPSTASH_REDIS_REST_URL: z.string().url(),
UPSTASH_REDIS_REST_TOKEN: z.string(),
FREESOUND_CLIENT_ID: z.string(),
FREESOUND_API_KEY: z.string(),
FREESOUND_CLIENT_ID: z.string().optional(),
FREESOUND_API_KEY: z.string().optional(),
// R2 / Cloudflare
CLOUDFLARE_ACCOUNT_ID: z.string(),
R2_ACCESS_KEY_ID: z.string(),
R2_SECRET_ACCESS_KEY: z.string(),
R2_BUCKET_NAME: z.string(),
CLOUDFLARE_ACCOUNT_ID: z.string().optional(),
R2_ACCESS_KEY_ID: z.string().optional(),
R2_SECRET_ACCESS_KEY: z.string().optional(),
R2_BUCKET_NAME: z.string().optional(),
// Modal transcription
MODAL_TRANSCRIPTION_URL: z.string(),
MODAL_TRANSCRIPTION_URL: z.string().optional(),
},
client: {},
runtimeEnv: {
Expand Down