chore: 去掉未上线前的旧兼容垫片,板块流收口到首页
鉴权只认 cookie、SEO 只走 Next、sort 与推荐对齐;删除 Bearer、Go sitemap、post_type 回填等冗余路径。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -134,6 +134,32 @@ export interface OverviewResponse {
|
||||
checkin?: CheckinStatus | null;
|
||||
}
|
||||
|
||||
/** 板块右栏:管理员公开资料 */
|
||||
export interface BoardModerator {
|
||||
id: number;
|
||||
username: string;
|
||||
nickname: string;
|
||||
avatar: string;
|
||||
}
|
||||
|
||||
/** 板块右栏:板级统计 */
|
||||
export interface BoardSidebarStats {
|
||||
post_count: number;
|
||||
today_posts: number;
|
||||
comment_count: number;
|
||||
today_comments: number;
|
||||
}
|
||||
|
||||
/** 首页选中板块后的右栏聚合 */
|
||||
export interface BoardSidebarResponse {
|
||||
board: BoardWithCount;
|
||||
moderators: BoardModerator[];
|
||||
stats: BoardSidebarStats;
|
||||
hot: PostListItem[];
|
||||
active_users: ActiveUser[];
|
||||
checkin?: CheckinStatus | null;
|
||||
}
|
||||
|
||||
export interface PostListItem {
|
||||
id: number;
|
||||
board_id: number;
|
||||
@@ -462,7 +488,7 @@ export async function fetchPosts(
|
||||
page = 1,
|
||||
size = 20,
|
||||
boardId?: number,
|
||||
sort = "latest",
|
||||
sort = "latest", // latest | recommended | new
|
||||
keyword = "",
|
||||
recommended = false,
|
||||
cookieHeader?: string
|
||||
@@ -483,6 +509,19 @@ export async function fetchOverview(cookieHeader?: string): Promise<OverviewResp
|
||||
return res.json();
|
||||
}
|
||||
|
||||
/** SSR 板块右栏;失败时抛错,由首页降级 */
|
||||
export async function fetchBoardSidebar(
|
||||
boardId: number,
|
||||
cookieHeader?: string
|
||||
): Promise<BoardSidebarResponse> {
|
||||
const res = await fetch(
|
||||
`${API_BASE}/api/boards/${boardId}/sidebar`,
|
||||
ssrInit(cookieHeaders(cookieHeader))
|
||||
);
|
||||
if (!res.ok) throw new Error("获取板块侧栏失败");
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function fetchBoards(): Promise<{ boards: BoardWithCount[] }> {
|
||||
const res = await fetch(`${API_BASE}/api/boards`, ssrInit());
|
||||
if (!res.ok) throw new Error("获取板块失败");
|
||||
@@ -1375,7 +1414,7 @@ export async function apiAdminUserAuditMessages(
|
||||
// ===== 站点外观设置 =====
|
||||
|
||||
export async function apiGetSettings(): Promise<PublicSettings> {
|
||||
// no-store:主题同步轮询必须读到管理员刚保存的最新配色,不走浏览器缓存
|
||||
// no-store:主题同步必须读到管理员刚保存的最新配色,不走浏览器缓存
|
||||
const res = await fetchWithRefresh("/api/settings", { method: "GET", cache: "no-store" });
|
||||
if (!res.ok) throw new Error("获取站点设置失败");
|
||||
return res.json();
|
||||
|
||||
Reference in New Issue
Block a user