重构Cookie监控系统:添加Web管理后台、Vue3前端界面、Cookie Cloud参数支持、5秒倒计时自动刷新、专业UI配色
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""
|
||||
后台管理路由
|
||||
"""
|
||||
from flask import Blueprint, render_template, request, jsonify, session
|
||||
from config.settings import Config
|
||||
|
||||
admin_bp = Blueprint('admin', __name__)
|
||||
|
||||
|
||||
@admin_bp.route('/')
|
||||
@admin_bp.route('/<path:path>')
|
||||
def admin_page(path=None):
|
||||
"""管理后台页面"""
|
||||
return render_template('index.html')
|
||||
|
||||
|
||||
@admin_bp.route('/api/admin/login', methods=['POST'])
|
||||
def admin_login():
|
||||
"""后台登录验证"""
|
||||
data = request.json
|
||||
password = data.get('password', '')
|
||||
|
||||
if password == Config.ADMIN_PASSWORD:
|
||||
session['admin_logged_in'] = True
|
||||
return jsonify({'success': True, 'message': '登录成功'})
|
||||
else:
|
||||
return jsonify({'success': False, 'message': '密码错误'}), 401
|
||||
|
||||
|
||||
@admin_bp.route('/api/admin/logout', methods=['POST'])
|
||||
def admin_logout():
|
||||
"""后台退出登录"""
|
||||
session.pop('admin_logged_in', None)
|
||||
return jsonify({'success': True, 'message': '已退出'})
|
||||
|
||||
|
||||
@admin_bp.route('/api/admin/status', methods=['GET'])
|
||||
def admin_status():
|
||||
"""检查后台登录状态"""
|
||||
return jsonify({'logged_in': session.get('admin_logged_in', False)})
|
||||
Reference in New Issue
Block a user