update projects and contact form

This commit is contained in:
will
2026-04-02 23:02:19 +01:00
parent ea864a99c4
commit 746e51370d
9776 changed files with 953 additions and 2075549 deletions

View File

@@ -0,0 +1,43 @@
import { NextRequest, NextResponse } from 'next/server';
import { marked } from 'marked';
const GITEA_URL = process.env.GITEA_URL;
const GITEA_USERNAME = process.env.GITEA_USERNAME;
if (!GITEA_URL || !GITEA_USERNAME) {
throw new Error('GITEA_URL and GITEA_USERNAME must be set in env');
}
export async function GET(req: NextRequest) {
const repo = req.nextUrl.searchParams.get('repo');
if (!repo) {
return new NextResponse('Missing repo', { status: 400 });
}
// raw README (default branch)
const readmeUrl = `${GITEA_URL}/api/v1/repos/${GITEA_USERNAME}/${encodeURIComponent(
repo,
)}/raw/README.md`;
const res = await fetch(readmeUrl, {
headers: { Accept: 'text/plain' },
cache: 'no-store',
});
if (!res.ok) {
return new NextResponse(
`Failed to fetch README: HTTP ${res.status}`,
{ status: 502 },
);
}
const md = await res.text();
const html = marked.parse(md || '');
return new NextResponse(html, {
status: 200,
headers: {
'Content-Type': 'text/html; charset=utf-8',
},
});
}