🐛 fix: Add the VITE_SHOW_LANDING_PAGE configuration to control the landing page display logic.
This commit is contained in:
parent
76481755ea
commit
a8a3d18061
@ -9,6 +9,10 @@ VITE_CDN_URL=https://cdn.jsdmirror.com
|
|||||||
# Enable tutorial document feature (true/false)
|
# Enable tutorial document feature (true/false)
|
||||||
VITE_TUTORIAL_DOCUMENT=true
|
VITE_TUTORIAL_DOCUMENT=true
|
||||||
|
|
||||||
|
# Show landing page on home route (true/false, default: true)
|
||||||
|
# When set to false, users will be redirected to login page directly
|
||||||
|
VITE_SHOW_LANDING_PAGE=true
|
||||||
|
|
||||||
# Default login credentials (for development only)
|
# Default login credentials (for development only)
|
||||||
VITE_USER_EMAIL=
|
VITE_USER_EMAIL=
|
||||||
VITE_USER_PASSWORD=
|
VITE_USER_PASSWORD=
|
||||||
|
|||||||
@ -10,11 +10,20 @@ export default function Main() {
|
|||||||
const { user } = useGlobalStore();
|
const { user } = useGlobalStore();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const showLanding = import.meta.env.VITE_SHOW_LANDING_PAGE !== "false";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (user) {
|
if (user) {
|
||||||
navigate({ to: "/dashboard" });
|
navigate({ to: "/dashboard" });
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}, [user, navigate]);
|
|
||||||
|
if (!showLanding) {
|
||||||
|
navigate({ to: "/auth" });
|
||||||
|
}
|
||||||
|
}, [user, navigate, showLanding]);
|
||||||
|
|
||||||
|
if (!showLanding) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="container space-y-16">
|
<main className="container space-y-16">
|
||||||
|
|||||||
@ -99,6 +99,9 @@ VITE_CDN_URL=https://cdn.jsdmirror.com
|
|||||||
# Enable tutorial documentation (optional)
|
# Enable tutorial documentation (optional)
|
||||||
VITE_TUTORIAL_DOCUMENT=true
|
VITE_TUTORIAL_DOCUMENT=true
|
||||||
|
|
||||||
|
# Show landing page (optional, set to false to redirect to login directly)
|
||||||
|
VITE_SHOW_LANDING_PAGE=true
|
||||||
|
|
||||||
# Development default credentials (leave empty in production)
|
# Development default credentials (leave empty in production)
|
||||||
VITE_USER_EMAIL=
|
VITE_USER_EMAIL=
|
||||||
VITE_USER_PASSWORD=
|
VITE_USER_PASSWORD=
|
||||||
@ -461,6 +464,7 @@ sudo systemctl enable caddy
|
|||||||
| `VITE_API_BASE_URL` | Backend API address | ✅ | - | `https://api.your-domain.com` |
|
| `VITE_API_BASE_URL` | Backend API address | ✅ | - | `https://api.your-domain.com` |
|
||||||
| `VITE_CDN_URL` | CDN address | ❌ | `https://cdn.jsdmirror.com` | `https://cdn.your-domain.com` |
|
| `VITE_CDN_URL` | CDN address | ❌ | `https://cdn.jsdmirror.com` | `https://cdn.your-domain.com` |
|
||||||
| `VITE_TUTORIAL_DOCUMENT` | Enable tutorial docs | ❌ | `true` | `true` / `false` |
|
| `VITE_TUTORIAL_DOCUMENT` | Enable tutorial docs | ❌ | `true` | `true` / `false` |
|
||||||
|
| `VITE_SHOW_LANDING_PAGE` | Show landing page | ❌ | `true` | `true` / `false` |
|
||||||
| `VITE_USER_EMAIL` | Default login email (dev only) | ❌ | - | - |
|
| `VITE_USER_EMAIL` | Default login email (dev only) | ❌ | - | - |
|
||||||
| `VITE_USER_PASSWORD` | Default login password (dev only) | ❌ | - | - |
|
| `VITE_USER_PASSWORD` | Default login password (dev only) | ❌ | - | - |
|
||||||
|
|
||||||
|
|||||||
@ -116,6 +116,9 @@ VITE_CDN_URL=https://cdn.jsdmirror.com
|
|||||||
# 启用教程文档(可选)
|
# 启用教程文档(可选)
|
||||||
VITE_TUTORIAL_DOCUMENT=true
|
VITE_TUTORIAL_DOCUMENT=true
|
||||||
|
|
||||||
|
# 显示落地页(可选,设为 false 则直接跳转登录页)
|
||||||
|
VITE_SHOW_LANDING_PAGE=true
|
||||||
|
|
||||||
# 开发环境默认登录凭证(生产环境请留空)
|
# 开发环境默认登录凭证(生产环境请留空)
|
||||||
VITE_USER_EMAIL=
|
VITE_USER_EMAIL=
|
||||||
VITE_USER_PASSWORD=
|
VITE_USER_PASSWORD=
|
||||||
@ -461,6 +464,7 @@ sudo systemctl enable caddy
|
|||||||
| `VITE_API_BASE_URL` | 后端 API 地址 | ✅ | - | `https://api.your-domain.com` |
|
| `VITE_API_BASE_URL` | 后端 API 地址 | ✅ | - | `https://api.your-domain.com` |
|
||||||
| `VITE_CDN_URL` | CDN 地址 | ❌ | `https://cdn.jsdmirror.com` | `https://cdn.your-domain.com` |
|
| `VITE_CDN_URL` | CDN 地址 | ❌ | `https://cdn.jsdmirror.com` | `https://cdn.your-domain.com` |
|
||||||
| `VITE_TUTORIAL_DOCUMENT` | 启用教程文档 | ❌ | `true` | `true` / `false` |
|
| `VITE_TUTORIAL_DOCUMENT` | 启用教程文档 | ❌ | `true` | `true` / `false` |
|
||||||
|
| `VITE_SHOW_LANDING_PAGE` | 显示落地页 | ❌ | `true` | `true` / `false` |
|
||||||
| `VITE_USER_EMAIL` | 默认登录邮箱(仅开发) | ❌ | - | - |
|
| `VITE_USER_EMAIL` | 默认登录邮箱(仅开发) | ❌ | - | - |
|
||||||
| `VITE_USER_PASSWORD` | 默认登录密码(仅开发) | ❌ | - | - |
|
| `VITE_USER_PASSWORD` | 默认登录密码(仅开发) | ❌ | - | - |
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user