perf(webui): Lighthouse 90→97 性能优化 + Bug 修复#9
Merged
massif-01 merged 3 commits intoRMinte:mainfrom Feb 10, 2026
Merged
Conversation
构建时优化: - CMakeLists.txt: 新增 minify+gzip 构建流水线(源文件→复制→Python压缩→gzip→SPIFFS) - tools/minify_web.py: 纯 Python JS/CSS 压缩+gzip 脚本,无 Node.js 依赖 - 总资源体积从 ~1.6MB 降至 ~250KB(压缩率 84%) 服务端优化: - ts_http_server.c: 支持 gzip 预压缩文件发送(Accept-Encoding 检测) - ts_http_server.c: 静态资源 Cache-Control 7天长期缓存,index.html no-cache - 新增 font/woff2、font/woff Content-Type 前端加载优化: - index.html: JS 脚本添加 defer,消除渲染阻塞 - index.html: 语言包动态加载(仅加载当前语言,切换时按需加载) - index.html: 首屏关键 CSS 内联 + 主 CSS 异步 preload - terminal.js: xterm.js 从 <head> 移除,改为首次打开终端时按需加载 Bug 修复: - ts_api_system.c: CPU 监控改用 delta 算法,修复始终显示 0% 的问题 - ts_fan.c: 风扇曲线模式切换时重置迟滞状态,修复不自动调速 - zh-CN.js: SSH 翻译 key 迁移到正确命名空间,修复中文界面显示英文 - zh-CN.js/en-US.js/app.js: 清除全站残留 emoji(29+ 处) 文档: - README/README_EN: 添加 Lighthouse 97 徽章 - frontend_modification.md: 记录 v77 性能优化详情
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WebUI 性能大幅优化,Lighthouse Performance 评分从 90 提升至 97,首次加载资源体积从 ~1.6MB 降至 ~250KB(压缩率 84%),同时修复了多个功能 Bug。
构建时优化
CMakeLists.txt新增三步构建流程(复制→Python 压缩→gzip),所有优化在构建目录中进行,不修改源文件tools/minify_web.py):JS 移除注释/空白 + CSS 压缩 + gzip 预压缩,无 Node.js 依赖服务端优化
ts_http_server.c检测Accept-Encoding: gzip,自动发送.gz预压缩文件Cache-Control: public, max-age=604800, immutable(7天),index.html设为no-cache前端加载优化
defer,消除渲染阻塞<head>移除,首次打开终端页面时从 CDN 按需加载(节省 ~70KB)preload加载压缩效果
Bug 修复
ts_api_system.c改用 delta 算法计算瞬时 CPU 使用率ts_fan.c切换模式时重置迟滞状态zh-CN.js翻译 key 命名空间修正Test plan
idf.py build编译通过Content-Encoding: gzip头)Cache-Control头)