You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

36 lines
1.5 KiB

export type RouteRule = {
path: string;
methods?: string[];
};
export const API_ALLOWLIST: RouteRule[] = [
{ path: "/api/auth/captcha", methods: ["GET"] },
{ path: "/api/auth/login", methods: ["POST"] },
{ path: "/api/auth/register", methods: ["POST"] },
/** 访客可读:无 Cookie 时不查库,用于客户端与 SSR 会话对齐 */
{ path: "/api/auth/session", methods: ["GET"] },
{ path: "/api/config/global", methods: ["GET"] },
{ path: "/api/auth/oauth/:provider/callback", methods: ["GET"] },
{ path: "/api/auth/oauth/:provider/authorize", methods: ["GET"] },
/** 卡片列表 + 详情 */
{ path: "/api/cards", methods: ["GET"] },
{ path: "/api/cards/:id", methods: ["GET"] },
/** 分类(只读) */
{ path: "/api/categories", methods: ["GET"] },
{ path: "/api/categories/:id", methods: ["GET"] },
/** 标签(只读) */
{ path: "/api/tags", methods: ["GET"] },
{ path: "/api/tags/:id", methods: ["GET"] },
/** 文章列表 + 详情 */
{ path: "/api/articles", methods: ["GET"] },
{ path: "/api/articles/:id", methods: ["GET"] },
/** 工具(只读) */
{ path: "/api/tools", methods: ["GET"] },
{ path: "/api/tools/:id", methods: ["GET"] },
{ path: "/api/pic/random", methods: ["GET"] },
];
export const FRONTEND_LOGIN_PATH = "/auth/login"
export const FRONTEND_REGISTER_PATH = "/auth/register"
export const FRONTEND_PAGE_ALLOWLIST = new Set(["/", FRONTEND_LOGIN_PATH, FRONTEND_REGISTER_PATH, '/test', '/articles'])
export const FRONTEND_PAGE_GUEST_ONLY = new Set([FRONTEND_LOGIN_PATH, FRONTEND_REGISTER_PATH])