diff --git a/backend/app.py b/backend/app.py index bf6239f..1512d37 100644 --- a/backend/app.py +++ b/backend/app.py @@ -49,4 +49,4 @@ def create_app(config_class=Config): if __name__ == '__main__': app = create_app() - app.run(host='0.0.0.0', port=5000, debug=True) + app.run(host='0.0.0.0', port=5000, debug=False) diff --git a/backend/instance/cookie_monitor.db b/backend/instance/cookie_monitor.db index e2064a9..b1892c8 100644 Binary files a/backend/instance/cookie_monitor.db and b/backend/instance/cookie_monitor.db differ diff --git a/backend/routes/websites.py b/backend/routes/websites.py index 5b48155..672d1dc 100644 --- a/backend/routes/websites.py +++ b/backend/routes/websites.py @@ -13,17 +13,34 @@ website_bp = Blueprint('websites', __name__) @website_bp.route('/check-network', methods=['GET']) def check_all_network(): """检测所有网站的网络可达性""" + import urllib3 + urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) + websites = Website.query.all() result = {} for website in websites: try: - resp = http_requests.get(website.url, timeout=5, allow_redirects=True) + resp = http_requests.get(website.url, timeout=5, allow_redirects=True, verify=False) result[website.id] = { 'status': resp.status_code, - 'reachable': resp.status_code < 400, + 'reachable': resp.status_code < 500, 'response_time': resp.elapsed.total_seconds() * 1000 } + except http_requests.exceptions.SSLError: + try: + resp = http_requests.get(website.url, timeout=5, allow_redirects=True, verify=False) + result[website.id] = { + 'status': resp.status_code, + 'reachable': resp.status_code < 500, + 'response_time': resp.elapsed.total_seconds() * 1000 + } + except Exception: + result[website.id] = { + 'status': 0, + 'reachable': False, + 'response_time': 0 + } except Exception: result[website.id] = { 'status': 0, diff --git a/backend/static/css/style.css b/backend/static/css/style.css index e551f70..56bbaf8 100644 --- a/backend/static/css/style.css +++ b/backend/static/css/style.css @@ -73,6 +73,18 @@ body { background-clip: text; } +.header-stat { + color: rgba(255, 255, 255, 0.8); + font-size: 14px; + font-weight: 500; +} + +.header-stat b { + color: #fff; + font-size: 18px; + margin-left: 4px; +} + .header-right { display: flex; align-items: center; @@ -465,11 +477,36 @@ body { font-size: 14px; } +/* 仪表板页脚 */ +.dashboard-footer { + margin-top: 40px; + padding: 16px 20px; + background: var(--card-bg); + border-radius: var(--radius); + border: 1px solid var(--border-color); + box-shadow: var(--shadow-sm); +} + +.dashboard-footer p { + margin: 0; + color: var(--text-secondary); + font-size: 13px; + text-align: center; + line-height: 1.6; +} + /* 统计数字卡片颜色 */ .stat-total .el-statistic__content { color: var(--primary-color); } +.refresh-hint { + font-size: 12px; + color: var(--text-light); + font-weight: 400; + margin-left: 4px; +} + .stat-online .el-statistic__content { color: var(--success-color); } diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 10ad649..e062963 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -66,6 +66,12 @@ createApp({ } }; + const handleDropdownCommand = async (command) => { + if (command === 'login') { + showAdminLogin(); + } + }; + const showAdminLogin = () => { adminLoginForm.value = { password: '' }; adminLoginVisible.value = true; @@ -579,7 +585,7 @@ createApp({ cookieDialogVisible, cookieDialogTitle, cookieForm, websiteForm, filterWebsiteUser, currentUserWebsites, filteredWebsites, - checkAdminStatus, showAdminLogin, adminLogin, handleAdminCommand, + checkAdminStatus, showAdminLogin, adminLogin, handleAdminCommand, handleDropdownCommand, loadUsers, loadUsersWithWebsites, loadWebsites, loadDashboard, refreshDashboardStatus, startAutoRefresh, stopAutoRefresh, checkLogin, manageWebsite, manageUserWebsites, diff --git a/backend/templates/index.html b/backend/templates/index.html index 1a1912c..555d50a 100644 --- a/backend/templates/index.html +++ b/backend/templates/index.html @@ -16,7 +16,7 @@
-

Cookie监控管理系统

+

网站监控仪表板

返回监控首页
@@ -24,8 +24,17 @@ {{ countdown }}秒后自动刷新
- 刷新 - 登录后台 + 网站总数:{{ stats.totalWebsites }} + + + + + + 后台管理