diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index a349565..bf54e1a 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -423,8 +423,19 @@ export const api = { reciprocal_check_enabled?: boolean; }>(`/api/admin/friend-link-applies${qs ? `?${qs}` : ''}`); }, - adminUpdateFriendLinkSettings: (body: { reciprocal_check_enabled: boolean }) => - request<{ message: string; reciprocal_check_enabled: boolean }>('/api/admin/friend-link-settings', { + adminUpdateFriendLinkSettings: (body: { + reciprocal_check_enabled?: boolean; + nav_show_friend_links?: boolean; + footer_show_friend_links?: boolean; + aside_show_friend_links?: boolean; + }) => + request<{ + message: string; + reciprocal_check_enabled: boolean; + nav_show_friend_links: boolean; + footer_show_friend_links: boolean; + aside_show_friend_links: boolean; + }>('/api/admin/friend-link-settings', { method: 'PUT', body: JSON.stringify(body), }), diff --git a/frontend/src/api/types.ts b/frontend/src/api/types.ts index aad28e5..25d0ade 100644 --- a/frontend/src/api/types.ts +++ b/frontend/src/api/types.ts @@ -233,6 +233,10 @@ export interface ForumLimits { aside_show_friend_links: boolean; /** 右侧栏可选组件顺序与开关 */ aside_widgets: AsideWidget[]; + /** 左侧栏「站点」展示友情链接入口 */ + nav_show_friend_links: boolean; + /** 页脚展示友情链接入口 */ + footer_show_friend_links: boolean; /** 首页列表样式:title 仅标题 / thumbnail 缩略图 */ feed_list_style: 'title' | 'excerpt' | 'thumbnail'; /** 伪静态(固定链接)开关 */ @@ -259,6 +263,8 @@ export interface ForumLimitsPublic { aside_show_recent_comments: boolean; aside_show_friend_links: boolean; aside_widgets: AsideWidget[]; + nav_show_friend_links: boolean; + footer_show_friend_links: boolean; feed_list_style: 'title' | 'excerpt' | 'thumbnail'; permalink_enabled: boolean; permalink_ext: string; diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index fdfe5ad..160d147 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -66,6 +66,8 @@ export default function Sidebar({ const isAdmin = user?.role === 'admin'; const { navPages } = useSitePages(); const { limits } = useForumLimits(); + const showFriendLinksNav = limits.nav_show_friend_links !== false; + const showSiteSection = navPages.length > 0 || showFriendLinksNav; const keyword = params.get('keyword') || ''; const menuKey = resolveMenuKey(loc.pathname, activeBoard, keyword); @@ -135,7 +137,6 @@ export default function Sidebar({ {feedNavLink('all', buildHomeUrl(0, sort, permalinkOpts), '全部帖子', , 0)} {user && navItem('favorites', '我的收藏', , () => nav('/favorites'))} {navItem('projects', '开源码桶', , () => nav('/projects'))} - {navItem('links', '友情链接', , () => nav('/links'))} {(boardsLoading && boards.length === 0) ? ( @@ -191,10 +192,11 @@ export default function Sidebar({ ) : null} - {(navPages.length > 0) && ( + {showSiteSection && ( <>
站点