feat: 重构博客为水墨纸质风格 + 搭建后台管理系统

- 重新设计全站 UI:parchment/ink/terracotta 水墨纸质色系,宋式 serif 排版
- 新增页面:文章列表、文章详情、分类、标签、关于
- GSAP ScrollTrigger 滚动动画 + 逐字揭示效果
- 后台管理系统 /admin:文章/分类/标签 CRUD,JSON 文件存储
- 登录认证(cookie session)
- 设计系统文档 UI.md
This commit is contained in:
胡旭
2026-06-24 08:45:28 +08:00
parent 507f12e501
commit dce8fe62ea
35 changed files with 3124 additions and 96 deletions
+36
View File
@@ -0,0 +1,36 @@
import { NextRequest, NextResponse } from "next/server";
import { cookies } from "next/headers";
import { getPosts, createPost, deletePost } from "@/lib/store";
async function checkAuth(): Promise<boolean> {
const cookieStore = await cookies();
return cookieStore.get("admin_session")?.value === "authenticated";
}
export async function GET() {
if (!(await checkAuth())) {
return NextResponse.json({ error: "未授权" }, { status: 401 });
}
const posts = getPosts();
return NextResponse.json(posts);
}
export async function POST(request: NextRequest) {
if (!(await checkAuth())) {
return NextResponse.json({ error: "未授权" }, { status: 401 });
}
const body = await request.json();
const post = createPost(body);
return NextResponse.json(post, { status: 201 });
}
export async function DELETE(request: NextRequest) {
if (!(await checkAuth())) {
return NextResponse.json({ error: "未授权" }, { status: 401 });
}
const { searchParams } = new URL(request.url);
const id = searchParams.get("id");
if (!id) return NextResponse.json({ error: "缺少 id" }, { status: 400 });
const ok = deletePost(id);
return NextResponse.json({ ok });
}