mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 02:15:05 +03:00
* page components * page component changes * settings but broken saving * rvert * use sheet for provider * styling * remove things * Some refactoring and fixing, added JSDocs to layouts * Smol refactor * Fix * Update JSDocs * updated scaffolding * update edge functions layout * remove params * single function layout * invocation cleanup * remove vars * Clean up * Spelling * Clean up FormFieldWrappers * One last clean up * test edge function * sheet flag * remove prop * fix merge errors * fix merge errors * update sheet * rmeove import * fix ts * Some clean ups * Fix * Make test response area resizeable * Final clean up --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
33 lines
837 B
TypeScript
33 lines
837 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/generate-v3',
|
|
'/ai/edge-function/complete',
|
|
'/ai/onboarding/design',
|
|
'/ai/sql/complete',
|
|
'/ai/sql/title',
|
|
'/ai/sql/debug',
|
|
'/ai/sql/cron',
|
|
'/ai/docs',
|
|
'/get-ip-address',
|
|
'/get-utc-time',
|
|
'/edge-functions/test',
|
|
]
|
|
|
|
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 }
|
|
)
|
|
}
|
|
}
|