新增群聊/私信与公共 WebSocket 总线,站长用户内容档案,并将通知与待审角标改为推送驱动;同步精简管理仪表盘并修复主题换肤 DOM 冲突。 Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
1010 B
TypeScript
35 lines
1010 B
TypeScript
import { redirect } from "next/navigation";
|
|
import { cookies } from "next/headers";
|
|
import type { Metadata } from "next";
|
|
import { authCookieHeader } from "@/lib/cookies";
|
|
import { getMeCached } from "@/lib/serverData";
|
|
import { fetchChatRooms } from "@/lib/api";
|
|
import ChatShell from "./ChatShell";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "消息",
|
|
description: "私聊与群聊,实时交流。",
|
|
};
|
|
|
|
export default async function ChatListPage() {
|
|
const cookie = authCookieHeader(await cookies());
|
|
const me = await getMeCached(cookie || undefined);
|
|
if (!me.user) {
|
|
redirect(`/login?redirect=${encodeURIComponent("/chat")}`);
|
|
}
|
|
|
|
let rooms: Awaited<ReturnType<typeof fetchChatRooms>>["rooms"] = [];
|
|
try {
|
|
const data = await fetchChatRooms(1, 50, "", cookie, "joined");
|
|
rooms = data.rooms || [];
|
|
} catch {
|
|
rooms = [];
|
|
}
|
|
|
|
return (
|
|
<div className="max-w-6xl mx-auto">
|
|
<ChatShell meId={me.user.id} initialRooms={rooms} activeRoomId={null} />
|
|
</div>
|
|
);
|
|
}
|