fix: 修复暗色主题UI对比度、端口占用死循环及多项Web表单bug
后端修复: - engine/instances.py: Socks5Server.start() 端口占用时死循环, 增加超时和异常透传 - engine/instances.py: import time 移至顶层 - engine/instances.py: sync_instances/start_instance 容忍单实例启动失败 - run.py: 启动时 sync_instances 失败不退出进程 - web/routes.py: instances start/restart/edit 路由捕获 OSError, flash 友好提示 - api/v1.py: instances start/restart/update API 返回 JSON 错误而非 500 崩溃 - web/routes.py: toggle_user/ban_user 支持 hidden 字段语义, 缺字段时切换状态 - web/routes.py: inject_nav 增加独立 nav.dashboard 和 page_name, 修复双 active bug - auth.py: login 路由添加 logging import, 修 NameError 前端重构: - templates/base.html: 全局对比度提升(--text #f1f5f9, --accent #a5b4fc), 标题色显式声明, alert/modal/progress/table 完整暗色样式 - templates/base.html: main-content padding-top 修复 navbar 遮挡内容 - templates/base.html: 侧边栏 active 高亮 (白字 + elevated bg + 左边框) - templates/base.html: 顶栏动态显示当前页面名 - templates/*.html: 统一 page-header 类, 所有图标按钮添加 title tooltip - templates/users.html: toggle/ban 表单添加 hidden enabled/ban 字段 - templates/connections.html: fmtBytes 改为 Jinja macro, 时间格式化 - templates/dashboard.html: 时间格式化为 YYYY-MM-DD HH:MM:SS, chart canvas 高度调整 - templates/logs.html: 时间格式化为可读格式 - templates/stats.html: 提升 chart 颜色对比度 - templates/system.html: 使用 time.localtime() 显示本地时间
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
{% block title %}仪表盘 · SOCKS Manager{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h5 class="mb-3"><i class="bi bi-speedometer2"></i> 仪表盘</h5>
|
||||
<div class="page-header">
|
||||
<h5><i class="bi bi-speedometer2"></i> 仪表盘</h5>
|
||||
</div>
|
||||
|
||||
<!-- 系统状态卡片 -->
|
||||
<div class="row g-3 mb-3">
|
||||
@@ -75,7 +77,7 @@
|
||||
<span class="text-muted small">每 10 秒刷新</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<canvas id="metricsChart" height="80"></canvas>
|
||||
<canvas id="metricsChart" style="height:240px"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -118,14 +120,20 @@ const chart = new Chart(ctx, {
|
||||
maintainAspectRatio: false,
|
||||
animation: false,
|
||||
plugins: {
|
||||
legend: { labels: { color: '#94a3b8' } },
|
||||
legend: { labels: { color: '#cbd5e1' } },
|
||||
},
|
||||
scales: {
|
||||
x: { grid: { color: '#1f2335' }, ticks: { color: '#6b7280' } },
|
||||
y: { grid: { color: '#1f2335' }, ticks: { color: '#6b7280' }, min: 0, max: 100 },
|
||||
x: { grid: { color: '#262b3d' }, ticks: { color: '#a3acbf', maxTicksLimit: 10 } },
|
||||
y: { grid: { color: '#262b3d' }, ticks: { color: '#a3acbf' }, min: 0, max: 100 },
|
||||
},
|
||||
}
|
||||
});
|
||||
// 工具函数
|
||||
function fmtTs(s) {
|
||||
if (!s) return '-';
|
||||
// 把 ISO 格式 "2026-07-16T14:33:38.297700" 转成 "2026-07-16 14:33:38"
|
||||
return s.replace('T', ' ').slice(0, 19);
|
||||
}
|
||||
|
||||
// 加载最近日志
|
||||
async function loadRecentLogs() {
|
||||
@@ -144,7 +152,7 @@ async function loadRecentLogs() {
|
||||
else if (l.event.includes('fail') || l.event.includes('reject')) badgeClass = 'danger';
|
||||
else if (l.event.includes('start') || l.event.includes('stop')) badgeClass = 'warning';
|
||||
return `<tr>
|
||||
<td><small>${l.timestamp.slice(0,19).replace('T',' ')}</small></td>
|
||||
<td><small>${fmtTs(l.timestamp)}</small></td>
|
||||
<td><span class="badge badge-${badgeClass}">${l.event}</span></td>
|
||||
<td>${l.user || '-'}</td>
|
||||
<td><code>${l.src_ip || '-'}</code></td>
|
||||
|
||||
Reference in New Issue
Block a user