diff --git a/app/api/analytics/route.ts b/app/api/analytics/route.ts deleted file mode 100644 index 3bc2070b..00000000 --- a/app/api/analytics/route.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { prisma } from "@/lib/db"; -import { resolveUserId } from "@/lib/server-auth"; - -export async function POST(req: Request) { - try { - const { eventType, eventData } = await req.json(); - - if (!eventType) { - return Response.json( - { error: "Event type is required" }, - { status: 400 }, - ); - } - - // 服务端验证身份,不信任客户端传入的 userId - const userId = await resolveUserId(req); - - await prisma.analyticsEvent.create({ - data: { - eventType, - eventData: eventData ?? {}, - // userId 对应 user_accounts.id(BigInt);匿名访问为 null - ...(userId != null && { userId }), - }, - }); - - return Response.json({ success: true }); - } catch (error) { - console.error("Analytics API error:", error); - return Response.json({ error: "Failed to log event" }, { status: 500 }); - } -} diff --git a/app/api/docs/history/route.ts b/app/api/docs/history/route.ts index 08ad6e30..714799a4 100644 --- a/app/api/docs/history/route.ts +++ b/app/api/docs/history/route.ts @@ -47,6 +47,11 @@ function normalizeDocsPath(raw: string): string | null { if (normalized.startsWith("docs/")) { normalized = `app/${normalized}`; } + // fumadocs 的 page.file.path 返回"相对 app/docs/"路径(如 ai/xxx/index.mdx) + // 而不是仓库根。这里补上前缀,和 page.tsx 传参保持兼容。 + if (!normalized.startsWith("app/")) { + normalized = `app/docs/${normalized}`; + } // 必须落在 app/docs/ 下才放行 if (!normalized.startsWith("app/docs/")) { return null; diff --git a/app/components/BrandMark.tsx b/app/components/BrandMark.tsx index efbfa1f2..b86ac1cc 100644 --- a/app/components/BrandMark.tsx +++ b/app/components/BrandMark.tsx @@ -12,6 +12,7 @@ * @param {boolean} priority - 是否优先加载 */ import Image from "next/image"; +import Link from "next/link"; import { cn } from "@/lib/utils"; export const BRAND_NAME = "Involution Hell"; @@ -38,7 +39,7 @@ export function BrandMark({ const width = Math.round(imageSize * BRAND_LOGO_ASPECT_RATIO); return ( -
+
{BRAND_NAME} -
+ ); } diff --git a/app/components/DispatchNetwork.tsx b/app/components/DispatchNetwork.tsx new file mode 100644 index 00000000..16829c85 --- /dev/null +++ b/app/components/DispatchNetwork.tsx @@ -0,0 +1,85 @@ +import Link from "next/link"; +import { Github as GithubIcon } from "./icons/Github"; +import { MessageCircle, BookMarked, ArrowRight } from "lucide-react"; + +/** + * DispatchNetwork — 主页 Top Rank 之后的极简网络入口横条 + * 替代原先 Features(口号四格)+ Community(链接三卡)两个 section + * 设计意图:报纸末版的"发行网络"小栏,48px 高横条,不重复 Footer + */ +export function DispatchNetwork() { + return ( +
+
+
+ {/* 左:栏目标签 */} + + Dispatch Network + · + + Sec. Net-01 + + + + {/* 中:三个外链 */} + + + {/* 右:加入 CTA */} + + Join + + +
+
+
+ ); +} diff --git a/app/components/DocHistoryPanel.tsx b/app/components/DocHistoryPanel.tsx index b1a3298a..577c33c0 100644 --- a/app/components/DocHistoryPanel.tsx +++ b/app/components/DocHistoryPanel.tsx @@ -50,10 +50,10 @@ function relativeTime(dateStr: string): string { function SkeletonRow() { return (
-
+
-
-
+
+
); @@ -129,7 +129,7 @@ export function DocHistoryPanel({ path }: DocHistoryPanelProps) { href={item.htmlUrl} target="_blank" rel="noopener noreferrer" - className="flex items-start gap-3 py-2.5 group hover:bg-neutral-50 dark:hover:bg-neutral-900 rounded transition-colors px-1 -mx-1" + className="flex items-start gap-3 py-2.5 group hover:bg-neutral-50 dark:hover:bg-neutral-900 transition-colors px-1 -mx-1" > {/* 头像 */} {item.authorLogin} diff --git a/app/components/DocShareButton.tsx b/app/components/DocShareButton.tsx index f71fdeaa..9d0b5659 100644 --- a/app/components/DocShareButton.tsx +++ b/app/components/DocShareButton.tsx @@ -38,7 +38,7 @@ export function DocShareButton() {