完善站点运营设置:分路由管理、登录可见评论、邮件模板内联与关闭注册 SSR。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
15
frontend/app/admin/settings/layout.tsx
Normal file
15
frontend/app/admin/settings/layout.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import { cookies } from "next/headers";
|
||||
import { authCookieHeader } from "@/lib/cookies";
|
||||
import { getMeCached } from "@/lib/serverData";
|
||||
import { isSuperOrOwner } from "@/lib/roles";
|
||||
import Forbidden from "../Forbidden";
|
||||
import SettingsShell from "./SettingsShell";
|
||||
|
||||
export default async function SettingsLayout({ children }: { children: React.ReactNode }) {
|
||||
const cookie = authCookieHeader(await cookies());
|
||||
const me = await getMeCached(cookie || undefined);
|
||||
if (!me.user || !isSuperOrOwner(me.user.role)) {
|
||||
return <Forbidden text="站点设置仅超级管理员和站长可操作。" />;
|
||||
}
|
||||
return <SettingsShell>{children}</SettingsShell>;
|
||||
}
|
||||
Reference in New Issue
Block a user