mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-04 02:52:55 +08:00
- Introduced a new documentation site for Cursor BYOK using Next.js and Fumadocs. - Added a product demo page with a corresponding Vite configuration. - Implemented a demo API to simulate LLM calls and responses. - Enhanced the Makefile to include new build and development commands for the documentation. - Updated package.json scripts for building and running the documentation site. - Created various components and layouts for the documentation structure, including blog and user documentation sections. - Added styling for the new components and layouts to ensure a cohesive design. - Included a README and other necessary files for local development and deployment.
33 lines
981 B
TypeScript
33 lines
981 B
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { isMarkdownPreferred, rewritePath } from 'fumadocs-core/negotiation';
|
|
import { docsContentRoute, docsRoute } from '@/lib/shared';
|
|
|
|
const { rewrite: rewriteDocs } = rewritePath(
|
|
`${docsRoute}{/*path}`,
|
|
`${docsContentRoute}{/*path}/content.md`,
|
|
);
|
|
const { rewrite: rewriteSuffix } = rewritePath(
|
|
`${docsRoute}{/*path}.md`,
|
|
`${docsContentRoute}{/*path}/content.md`,
|
|
);
|
|
|
|
export default function proxy(request: NextRequest) {
|
|
const result = rewriteSuffix(request.nextUrl.pathname);
|
|
if (result) {
|
|
return NextResponse.rewrite(new URL(result, request.nextUrl));
|
|
}
|
|
|
|
if (isMarkdownPreferred(request)) {
|
|
const result = rewriteDocs(request.nextUrl.pathname);
|
|
|
|
if (result) {
|
|
return NextResponse.rewrite(new URL(result, request.nextUrl), {
|
|
// this URL has two representations, selected by `Accept`
|
|
headers: { Vary: 'Accept' },
|
|
});
|
|
}
|
|
}
|
|
|
|
return NextResponse.next();
|
|
}
|