feat: WS实时推送、网速双线图、按钮MD3修复、页面加载器修复 (v0.6.0)

后端:
- 新增 /api/system/ws WebSocket端点 替代HTTP轮询 (每2s推送系统+框架数据)
- 修复 uptime始终为0 (sm.start_time时间戳)
- 网络采集新增TX上行+实时网速(delta法)
- 进程内存采集 (/proc/self/status VmRSS)
- 抑制aiohttp内部WS帧日志防刷爆日志文件

前端:
- 仪表盘: HTTP轮询→WS连接+指数退避自动重连
- 实时日志: 修复onclose重连bug+批量渲染30fps+500行上限防卡死
- 网速卡片: DualLineChart双线图(下行实线/上行虚线)
- Y轴零点偏移-5% 防止零网速贴底
- 所有按钮修复MD3组合类(btn+btn-tonal+btn-sm)
- 页面加载器: 改动态script元素执行 修复onclick全局作用域问题
- emoji图标→Material Design SVG图标
- CSS去残留</style>+新增.nav-item svg约束
- 登录页输入框+标签左对齐+按钮MD3样式
- 多个版本号显示修复(去双重v前缀)
- chart.js/app.js/HTML页面统一加版本号防浏览器缓存
- .gitignore新增docs/目录

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
qinglong
2026-06-11 16:23:31 +08:00
parent fd0a97fec5
commit 4a989bf50f
24 changed files with 759 additions and 212 deletions
+14 -5
View File
@@ -55,21 +55,30 @@ async function loadPage(pageName) {
content.innerHTML = cleanHtml;
// Execute inline scripts
// Execute inline scripts via dynamic <script> tag so function
// declarations become globally accessible (onclick handlers need them)
for(const code of scripts) {
try { (new Function(code)).call(window); } catch(e) { console.error('Inline script error:', e); }
try {
const s = document.createElement('script');
s.textContent = code;
document.head.appendChild(s);
document.head.removeChild(s);
} catch(e) { console.error('Inline script error:', e); }
}
// Load external JS module (optional — skip if 404)
// Load external JS module the same way (optional — skip if 404)
try {
const jsResp = await fetch(`./static/pages/${pageName}.js?t=${Date.now()}`);
if(jsResp.ok) {
const jsCode = await jsResp.text();
(new Function(jsCode)).call(window);
const s = document.createElement('script');
s.textContent = jsCode;
document.head.appendChild(s);
document.head.removeChild(s);
const moduleName = pageName.charAt(0).toUpperCase() + pageName.slice(1) + 'Module';
if(window[moduleName]?.init) window[moduleName].init();
}
} catch(e) { /* JS module optional */ }
} catch(e) { console.error('Page JS error:', pageName, e); }
bar.style.width = '100%';
setTimeout(() => bar.classList.remove('active'), 200);