mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-10-30 12:59:38 -04:00
Replaces the Mintlify setup (mint.json, docs.json, snippets) with a standalone Fumadocs app in docs/: Next.js app router, meta.json nav per section, its own bun install. Run with `just dev-docs`. Content pass alongside the migration: core architecture, data model, CLI, and networking pages rewritten around the daemon/source-store/ library split, new product-direction.mdx defining the product boundary, new drive-catalog plan, and the physical-drives plan updated to reference it. Whitepaper page retired.
32 lines
1018 B
TypeScript
32 lines
1018 B
TypeScript
import {docsContentRoute} from '@/lib/shared';
|
|
import {isMarkdownPreferred} from 'fumadocs-core/negotiation';
|
|
import {NextRequest, NextResponse} from 'next/server';
|
|
|
|
const passthroughPrefixes = ['/llms', '/api/', '/og/', '/_next'];
|
|
|
|
export default function proxy(request: NextRequest) {
|
|
const {pathname} = request.nextUrl;
|
|
if (passthroughPrefixes.some((prefix) => pathname.startsWith(prefix))) {
|
|
return NextResponse.next();
|
|
}
|
|
|
|
// Docs pages are served from the site root, so `/core/jobs.md` and
|
|
// markdown-preferring clients both rewrite to the markdown route.
|
|
if (pathname.endsWith('.md')) {
|
|
const path = pathname.slice(0, -'.md'.length);
|
|
return NextResponse.rewrite(
|
|
new URL(`${docsContentRoute}${path}/content.md`, request.nextUrl)
|
|
);
|
|
}
|
|
|
|
if (isMarkdownPreferred(request)) {
|
|
const path = pathname === '/' ? '' : pathname;
|
|
return NextResponse.rewrite(
|
|
new URL(`${docsContentRoute}${path}/content.md`, request.nextUrl),
|
|
{headers: {Vary: 'Accept'}}
|
|
);
|
|
}
|
|
|
|
return NextResponse.next();
|
|
}
|