mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
* First * Update * Cleanup * Reduce debounce * Add a picker before displaying feedback widget * Update styles * Clean up * Fix error msg * More prompt examples --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
31 lines
811 B
TypeScript
31 lines
811 B
TypeScript
import { IS_PLATFORM } from 'lib/constants'
|
|
import type { NextRequest } from 'next/server'
|
|
|
|
export const config = {
|
|
matcher: '/api/:function*',
|
|
}
|
|
|
|
// [Joshen] Return 404 for all next.js API endpoints EXCEPT the ones we use in hosted:
|
|
const HOSTED_SUPPORTED_API_URLS = [
|
|
'/ai/sql/generate-v3',
|
|
'/ai/edge-function/complete',
|
|
'/ai/onboarding/design',
|
|
'/ai/sql/complete',
|
|
'/ai/sql/title',
|
|
'/ai/sql/cron',
|
|
'/ai/feedback/classify',
|
|
'/get-ip-address',
|
|
'/get-utc-time',
|
|
'/edge-functions/test',
|
|
'/edge-functions/body',
|
|
]
|
|
|
|
export function middleware(request: NextRequest) {
|
|
if (IS_PLATFORM && !HOSTED_SUPPORTED_API_URLS.some((url) => request.url.endsWith(url))) {
|
|
return Response.json(
|
|
{ success: false, message: 'Endpoint not supported on hosted' },
|
|
{ status: 404 }
|
|
)
|
|
}
|
|
}
|