Skip to content

Commit 039eab9

Browse files
author
yangtao
committed
将全局通知改为仅更改状态时才通知,版本1.3.3
1 parent 157aafd commit 039eab9

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 🚀 NodePassDash
22

3-
![Version](https://img.shields.io/badge/version-1.3.2-blue.svg)
3+
![Version](https://img.shields.io/badge/version-1.3.3-blue.svg)
44

55
一个现代化的 NodePass 管理界面,基于 Next.js 14、HeroUI 和 TypeScript 构建。提供实时隧道监控、流量统计和端点管理功能。
66

lib/server/sse-service.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ export class SSEService {
709709
this.sseManager.sendTunnelUpdateByInstanceId(instanceId, eventData);
710710
}
711711
// 只有非 log 类型的事件才转发
712-
if (eventData.type !== 'log') {
712+
/** if (eventData.type !== 'log') {
713713
// console.log(`[SSE-Service] 准备转发数据到全局SSE管理器`, {
714714
// instanceId,
715715
// 事件类型: eventData.type
@@ -723,7 +723,7 @@ export class SSEService {
723723
timestamp: eventTime.toISOString(),
724724
data: eventData
725725
});
726-
}
726+
}*/
727727
} else {
728728
console.warn(`[SSE-Service] ⚠️ 无法提取instanceId,跳过转发`, {
729729
endpointId,
@@ -1187,6 +1187,17 @@ export class SSEService {
11871187
});
11881188

11891189
logger.debug(`端点 ${endpointId} 更新隧道实例: ${instanceId} -> 状态: ${instance.status}${statusChanged ? ' (状态已变更)' : ''}, 流量: TCP(${instance.tcprx || 0}/${instance.tcptx || 0}) UDP(${instance.udprx || 0}/${instance.udptx || 0})${trafficChanged ? ' (流量已变更)' : ''}, 事件时间: ${eventTime.toISOString()}`);
1190+
1191+
if(statusChanged){
1192+
this.sseManager.sendGlobalUpdate({
1193+
type: eventData.type,
1194+
endpointId,
1195+
instanceId,
1196+
instance,
1197+
timestamp: eventTime.toISOString(),
1198+
data: eventData
1199+
});
1200+
}
11901201
} else {
11911202
logger.debug(`端点 ${endpointId} 隧道实例 ${instanceId} 跳过更新: ${!statusChanged && !trafficChanged ? '无变化' : '事件时间较旧'}, 当前事件时间: ${eventTime.toISOString()}`);
11921203
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "NodePassDash",
3-
"version": "1.3.2",
3+
"version": "1.3.3",
44
"private": true,
55
"scripts": {
66
"dev": "tsx server.ts",

0 commit comments

Comments
 (0)