feat: migrate rice preview to Next.js
Verify mini program and deploy preview / verify-deploy (push) Successful in 3m0s

This commit is contained in:
2026-09-20 14:22:47 +08:00
parent 5a16113a6d
commit 2bf21a9f97
29 changed files with 6338 additions and 47 deletions
+12
View File
@@ -0,0 +1,12 @@
const API_BASE = process.env.API_INTERNAL_URL || 'http://pk-lab-api:8000';
async function forward(request, context) {
const { path } = await context.params;
const incoming = new URL(request.url);
const target = new URL(`/api/${path.join('/')}${incoming.search}`, API_BASE);
const headers = new Headers();
for (const name of ['authorization', 'content-type', 'accept']) { const value = request.headers.get(name); if (value) headers.set(name, value); }
const response = await fetch(target, { method: request.method, headers, body: ['GET','HEAD'].includes(request.method) ? undefined : await request.arrayBuffer(), cache: 'no-store' });
return new Response(response.body, { status: response.status, headers: { 'content-type': response.headers.get('content-type') || 'application/json' } });
}
export const dynamic = 'force-dynamic';
export const GET = forward; export const POST = forward; export const PUT = forward; export const PATCH = forward; export const DELETE = forward;
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
export function GET() { return Response.json({ status: 'ok' }); }
+4
View File
@@ -0,0 +1,4 @@
import './globals.css';
export const metadata = { title: '本命饭 PK', description: '各种各样的饭,二选一。' };
export const viewport = { width: 'device-width', initialScale: 1, themeColor: '#fff8f2' };
export default function RootLayout({ children }) { return <html lang="zh-CN"><body>{children}</body></html>; }
+2
View File
@@ -0,0 +1,2 @@
import RiceHome from '../components/RiceHome';
export default function HomePage() { return <RiceHome />; }
+2
View File
@@ -0,0 +1,2 @@
import RicePosterEditor from '../../../components/RicePosterEditor';
export default async function ResultPage({ params }) { const { id } = await params; return <RicePosterEditor runId={id} />; }
+2
View File
@@ -0,0 +1,2 @@
import RiceArena from '../../components/RiceArena';
export default function TestPage() { return <RiceArena />; }