feat: 实现 OpenClaw Mission Control 仪表盘框架
- 创建 API Blueprint 模块结构 - 实现系统状态 API (CPU/内存/磁盘/进程) - 实现服务状态 API - 创建仪表盘页面模板 - 添加仪表盘 CSS 样式 - 添加仪表盘 JavaScript 交互 - 登录后自动跳转到仪表盘
This commit is contained in:
17
app.py
17
app.py
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
云下飞的个人网站 - Flask 版本
|
||||
支持登录、注册功能
|
||||
OpenClaw Mission Control - Flask 版本
|
||||
支持登录、注册、控制中心功能
|
||||
作者:小白 🐶
|
||||
"""
|
||||
|
||||
@@ -36,6 +36,10 @@ login_manager = LoginManager()
|
||||
login_manager.init_app(app)
|
||||
login_manager.login_view = 'login'
|
||||
|
||||
# 注册 API Blueprint
|
||||
from api import api
|
||||
app.register_blueprint(api)
|
||||
|
||||
|
||||
# 用户模型
|
||||
class User(UserMixin, db.Model):
|
||||
@@ -59,10 +63,17 @@ def load_user(user_id):
|
||||
@app.route('/')
|
||||
def index():
|
||||
if current_user.is_authenticated:
|
||||
return render_template('welcome.html', username=current_user.username)
|
||||
return redirect(url_for('dashboard'))
|
||||
return render_template('index.html')
|
||||
|
||||
|
||||
# 路由 - 控制中心仪表盘
|
||||
@app.route('/dashboard')
|
||||
@login_required
|
||||
def dashboard():
|
||||
return render_template('dashboard/index.html', username=current_user.username)
|
||||
|
||||
|
||||
# 路由 - 登录
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
def login():
|
||||
|
||||
Reference in New Issue
Block a user