32 lines
808 B
JavaScript
32 lines
808 B
JavaScript
const authPages = new Set([
|
|
"/login",
|
|
"/register",
|
|
"/signup",
|
|
"/forgot-password",
|
|
"/forgot_password",
|
|
"/oauth/bind",
|
|
"/oauth/callback",
|
|
"/official-site",
|
|
]);
|
|
const shopPages = new Set([
|
|
"/products",
|
|
"/products/cloud-server",
|
|
"/products/cvm",
|
|
"/products/dedicated-server",
|
|
"/products/dedicated-server/customize",
|
|
]);
|
|
|
|
export function isPublicShop(route) {
|
|
if (Object.hasOwn(route.query || {}, "edit_position")) return false;
|
|
const path = route.path.replace(/\/+$/, "") || "/";
|
|
return shopPages.has(path) || /^\/products\/[1-9]\d*$/.test(path);
|
|
}
|
|
export function isAuthPage(path) {
|
|
return authPages.has(path.replace(/\/+$/, "") || "/");
|
|
}
|
|
export function isPublicRoute(route) {
|
|
return (
|
|
route.path === "/home.htm" || isAuthPage(route.path) || isPublicShop(route)
|
|
);
|
|
}
|