fix: 修复 JavaScript 字符串转义错误

修复内容:
- 修正 sendDesktopNotification 函数中的字符串转义
- warnings.join('\n') 改为 warnings.join('\n')
- 解决浏览器控制台 SyntaxError 错误
This commit is contained in:
2026-06-01 11:41:19 +08:00
parent 248c951a96
commit 1fdb00a1ec
2 changed files with 7 additions and 8 deletions

2
app.py
View File

@@ -2522,7 +2522,7 @@ HTML_TEMPLATE = '''<!DOCTYPE html>
if (!desktopNotifyEnabled || Notification.permission !== 'granted') return;
const notification = new Notification('⚠️ 系统资源告警', {
body: warnings.join('\\n'),
body: warnings.join('\n'),
icon: 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" font-size="90">📊</text></svg>',
tag: 'system-alert',
requireInteraction: false

View File

@@ -1,8 +1,8 @@
[2026-06-01 11:36:47] ==================================================
[2026-06-01 11:36:47] 项目服务管理面板 v2.0.0 启动
[2026-06-01 11:36:47] 访问地址: http://localhost:16022
[2026-06-01 11:36:47] 进程PID: 773965
[2026-06-01 11:36:47] ==================================================
[2026-06-01 11:40:58] ==================================================
[2026-06-01 11:40:58] 项目服务管理面板 v2.0.0 启动
[2026-06-01 11:40:58] 访问地址: http://localhost:16022
[2026-06-01 11:40:58] 进程PID: 774683
[2026-06-01 11:40:58] ==================================================
* Serving Flask app 'app'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
@@ -10,5 +10,4 @@
* Running on http://127.0.0.1:16022
* Running on http://192.168.0.101:16022
Press CTRL+C to quit
127.0.0.1 - - [01/Jun/2026 11:37:01] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/Jun/2026 11:37:01] "GET /api/projects HTTP/1.1" 200 -
127.0.0.1 - - [01/Jun/2026 11:41:03] "GET / HTTP/1.1" 200 -