Add registration flow and improve admin post management

This commit is contained in:
爱喝水的木子
2026-03-19 20:17:56 +08:00
parent 50a1e476c8
commit 17f5f6adcb
28 changed files with 799 additions and 192 deletions

View File

@@ -5,6 +5,7 @@ import { normalizeImageUrl } from "@/lib/normalize";
import { Post } from "@/types/post";
import { SharePanel } from "@/components/SharePanel";
import { getSiteUrl } from "@/lib/site";
import { DEFAULT_OPC_SIGNAL } from "@/lib/opc";
export const dynamic = "force-dynamic";
@@ -25,7 +26,8 @@ async function fetchPost(slug: string): Promise<Post | null> {
markdown: doc.markdown ?? "",
cover: doc.cover,
tags: doc.tags ?? [],
author: doc.author ?? "admin",
signal: doc.signal ?? DEFAULT_OPC_SIGNAL,
author: doc.author ?? "佚名",
createdAt: doc.createdAt ?? new Date().toISOString(),
updatedAt: doc.updatedAt ?? doc.createdAt ?? new Date().toISOString(),
views: doc.views ?? 0
@@ -49,7 +51,7 @@ export default async function PostPage({ params }: Props) {
<SharePanel url={shareUrl} />
</div>
<p className="mt-2 text-sm text-slate-500">
{new Date(post.createdAt).toLocaleString("zh-CN", { hour12: false })}
{post.author || "佚名"} · {new Date(post.createdAt).toLocaleString("zh-CN", { hour12: false })}
</p>
{coverUrl ? (
<img