feat(admin): 独立后台壳、站点分析与聊天监管,公开站拆出主题切换与访问埋点

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-17 04:00:14 +08:00
parent cda5fad2e5
commit 9a55c2f6f2
41 changed files with 5655 additions and 1810 deletions

View File

@@ -0,0 +1,23 @@
"use client";
import { useEffect, useRef } from "react";
import { usePathname } from "next/navigation";
import { apiTelemetryPageView } from "@/lib/api";
/**
* 公开站页面访问埋点:同 path 30s 内合并;跳过 /admin。
*/
export default function VisitBeacon() {
const pathname = usePathname();
const lastRef = useRef<{ path: string; at: number }>({ path: "", at: 0 });
useEffect(() => {
if (!pathname || pathname === "/admin" || pathname.startsWith("/admin/")) return;
const now = Date.now();
if (lastRef.current.path === pathname && now - lastRef.current.at < 30_000) return;
lastRef.current = { path: pathname, at: now };
void apiTelemetryPageView();
}, [pathname]);
return null;
}