默认页面
This commit is contained in:
1 parent
7a03225f4e
commit
76d9b4451d
2 files changed
+62
-1
No files matched your search
+4
-1
@@ -217,9 +217,12 @@ def stream_video(file_path):
|
||||
# ==================== 主路由 ====================
|
||||
@app.route('/')
|
||||
def serve_view():
|
||||
"""根路径固定返回 __view.html 静态文件,由前端 JS 调用 /api/filelist 拉取文件系统信息"""
|
||||
"""根路径:优先返回 index.html(社区首页),不存在时回退到 __view.html(文件浏览)"""
|
||||
if not FILESYSTEM_ENABLED:
|
||||
return "文件系统未启用", 403
|
||||
index_path = os.path.join(HTML_ROOT_DIR, 'index.html')
|
||||
if os.path.exists(index_path):
|
||||
return send_file(index_path, mimetype='text/html')
|
||||
view_path = os.path.join(HTML_ROOT_DIR, VIEW_FILE)
|
||||
if not os.path.exists(view_path):
|
||||
return f"视图文件 {VIEW_FILE} 不存在", 500
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
|
||||
<title>树状菜单 · 开源社区</title>
|
||||
<link rel="stylesheet" href="css/theme.css">
|
||||
<style>
|
||||
.hero { text-align: center; margin-bottom: 1.5rem; }
|
||||
.hero h1 { font-size: 1.6rem; margin-bottom: 0.4rem; }
|
||||
.hero p { font-size: 0.9rem; color: var(--fg-secondary); line-height: 1.6; }
|
||||
.btn-row {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
justify-content: center;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
.btn-row a {
|
||||
display: inline-block;
|
||||
padding: 0.6rem 1.8rem;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
border-radius: var(--radius-sm);
|
||||
text-decoration: none;
|
||||
transition: opacity 0.15s, transform 0.1s;
|
||||
}
|
||||
.btn-row a:active { transform: scale(0.96); }
|
||||
.btn-primary { background: var(--accent); color: #fff; }
|
||||
.btn-primary:hover { opacity: 0.85; }
|
||||
.btn-ghost { background: transparent; color: var(--accent-dark); border: 1.5px solid var(--border); }
|
||||
.btn-ghost:hover { border-color: var(--accent); opacity: 0.85; }
|
||||
.tagline {
|
||||
margin-top: 1.5rem;
|
||||
padding-top: 1rem;
|
||||
border-top: 1px solid var(--border-light);
|
||||
font-size: 0.8rem;
|
||||
color: var(--muted);
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<div class="hero">
|
||||
<h1>树状菜单</h1>
|
||||
<p>一个轻量的开源社区,用树的结构组织知识与文件。<br>自由生长,自由分享。</p>
|
||||
</div>
|
||||
<div class="btn-row">
|
||||
<a class="btn-primary" href="login.html">登录</a>
|
||||
<a class="btn-ghost" href="register.html">注册</a>
|
||||
</div>
|
||||
<div class="tagline">开源 · 轻量 · 自托管</div>
|
||||
</div>
|
||||
<footer class="footer">
|
||||
<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">蜀ICP备2024107064号-2</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user