first commit
This commit is contained in:
commit
db5762abd4
687 files changed
+171307
No files matched your search
@@ -0,0 +1,31 @@
|
||||
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)
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user