项目整理:添加Cookie Cloud下载功能、优化前端界面、配置改为config.json、打包脚本、清理无用文件
This commit is contained in:
+1
-1
@@ -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)
|
||||
|
||||
Binary file not shown.
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<el-container>
|
||||
<el-header>
|
||||
<div class="header-left">
|
||||
<h1>Cookie监控管理系统</h1>
|
||||
<h1>网站监控仪表板</h1>
|
||||
<el-button v-if="activeTab === 'settings'" @click="activeTab = 'dashboard'" type="primary" plain>返回监控首页</el-button>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
@@ -24,8 +24,17 @@
|
||||
<el-icon class="rotating-icon"><Refresh /></el-icon>
|
||||
<span class="refresh-text">{{ countdown }}秒后自动刷新</span>
|
||||
</div>
|
||||
<el-button v-if="activeTab === 'dashboard'" @click="loadDashboard" type="primary" plain>刷新</el-button>
|
||||
<el-button @click="showAdminLogin" type="warning" plain v-if="!isAdmin">登录后台</el-button>
|
||||
<span class="header-stat" v-if="activeTab === 'dashboard'">网站总数:<b>{{ stats.totalWebsites }}</b></span>
|
||||
<el-dropdown @command="handleDropdownCommand" v-if="!isAdmin">
|
||||
<el-button link type="text" style="color: rgba(255,255,255,0.8); font-size: 18px">
|
||||
<el-icon><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="login"><el-icon><Lock /></el-icon> 登录后台</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-dropdown @command="handleAdminCommand" v-else>
|
||||
<el-button type="success" plain>后台管理 <el-icon><arrow-down /></el-icon></el-button>
|
||||
<template #dropdown>
|
||||
@@ -42,19 +51,6 @@
|
||||
<el-main>
|
||||
<!-- 监控仪表板 -->
|
||||
<div v-if="activeTab === 'dashboard'">
|
||||
<div class="dashboard-header">
|
||||
<h2>网站监控仪表板</h2>
|
||||
<div class="dashboard-stats">
|
||||
<el-statistic title="网站总数" :value="stats.totalWebsites" />
|
||||
<el-statistic title="在线" :value="stats.onlineCount">
|
||||
<template #suffix><el-icon><circle-check /></el-icon></template>
|
||||
</el-statistic>
|
||||
<el-statistic title="离线" :value="stats.offlineCount">
|
||||
<template #suffix><el-icon><circle-close /></el-icon></template>
|
||||
</el-statistic>
|
||||
<el-statistic title="未检测" :value="stats.unknownCount" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-for="user in dashboardData" :key="user.id" class="user-section">
|
||||
<div class="user-header">
|
||||
@@ -65,6 +61,13 @@
|
||||
</div>
|
||||
|
||||
<el-table :data="user.websites" style="width: 100%; margin-bottom: 20px">
|
||||
<el-table-column label="启用状态" width="90">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.status === 1 ? 'success' : 'danger'" size="small">
|
||||
{{ scope.row.status === 1 ? '启用' : '禁用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="网站名称" width="150"></el-table-column>
|
||||
<el-table-column prop="url" label="URL" width="250">
|
||||
<template #default="scope">
|
||||
@@ -98,6 +101,10 @@
|
||||
</div>
|
||||
|
||||
<el-empty v-if="dashboardData.length === 0" description="暂无网站数据"></el-empty>
|
||||
|
||||
<div class="dashboard-footer">
|
||||
<p>免责声明:本系统仅用于Cookie状态监控和自动化管理,不对任何网站数据承担责任。请确保您有权访问和管理相关网站账号。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 网站管理 -->
|
||||
|
||||
Reference in New Issue
Block a user