import { notFound } from "next/navigation" import { ChapterContent } from "@/components/chapter-content" import { getSectionBySlug, getChapterBySectionSlug } from "@/lib/book-file-system" import { specialSections, getSectionById } from "@/lib/book-data" interface ReadPageProps { params: Promise<{ id: string }> } export const dynamic = "force-dynamic" export const runtime = "nodejs" export default async function ReadPage({ params }: ReadPageProps) { const { id } = await params if (id === "preface") { return } if (id === "epilogue") { return } if (id.startsWith("appendix-")) { const appendixSection = specialSections.appendix.find((a) => a.id === id) if (appendixSection) { return } } try { // 先从文件系统获取 const section = getSectionBySlug(id) if (section) { const context = getChapterBySectionSlug(id) if (context) { return } } // 再从book-data获取 const bookSection = getSectionById(id) if (bookSection) { return } notFound() } catch (error) { console.error("[Karuo] Error in ReadPage:", error) notFound() } }