mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 07:09:07 +03:00
* Add NL input * Add chart to sidebar * Better loading animation * Redo api route to not use edge * Remove edge stuff * Allow sheet to close * Cleanup * Adjust loading state * Add timezone * CR comments * Replace query with useCompletion * Set the form value * Tiny clean up * Tinyyyyy tweaks * Fix missing syntax * Smol refactor * Fixy * Remove console log --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
27 lines
698 B
TypeScript
27 lines
698 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/suggest',
|
|
'/ai/sql/generate-v2',
|
|
'/ai/sql/title',
|
|
'/ai/sql/debug',
|
|
'/ai/sql/cron',
|
|
'/get-ip-address',
|
|
]
|
|
|
|
export function middleware(request: NextRequest) {
|
|
const url = request.url
|
|
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 }
|
|
)
|
|
}
|
|
}
|