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.
23 lines
1.0 KiB
23 lines
1.0 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"] },
|
|
/** 卡片相关:ID 在路径参数中 */
|
|
{ path: "/api/cards/: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, '/about'])
|
|
export const FRONTEND_PAGE_GUEST_ONLY = new Set([FRONTEND_LOGIN_PATH, FRONTEND_REGISTER_PATH])
|
|
|