fix: 更新通知邮件自动展示∞版本功能特性

修复更新通知邮件只显示「系统已更新」不展示功能特性的问题。
新增 release-notes.json 存储版本特性,email-hub.js 省略描述时自动读取。

Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/5fb77bb4-5bec-463b-9399-e2c41adb63ac

Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-06 05:55:17 +00:00 committed by GitHub
parent 84c91c4494
commit 9893adefeb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 51 additions and 13 deletions

View File

@ -94,6 +94,7 @@ jobs:
server/proxy/service/auto-evolution.js \
server/proxy/service/email-hub.js \
server/proxy/service/protocol-mirror.js \
server/proxy/config/release-notes.json \
server/proxy/ecosystem.brain-proxy-v3.config.js \
${{ secrets.ZY_BRAIN_USER }}@${{ secrets.ZY_BRAIN_HOST }}:$PROXY_DIR/.deploy-tmp/
@ -101,6 +102,8 @@ jobs:
cp $PROXY_DIR/.deploy-tmp/auto-evolution.js $PROXY_DIR/service/
cp $PROXY_DIR/.deploy-tmp/email-hub.js $PROXY_DIR/service/
cp $PROXY_DIR/.deploy-tmp/protocol-mirror.js $PROXY_DIR/service/
mkdir -p $PROXY_DIR/config
cp $PROXY_DIR/.deploy-tmp/release-notes.json $PROXY_DIR/config/
cp $PROXY_DIR/.deploy-tmp/ecosystem.brain-proxy-v3.config.js $PROXY_DIR/
rm -rf $PROXY_DIR/.deploy-tmp
mkdir -p $PROXY_DIR/data/evolution-reports
@ -155,7 +158,8 @@ jobs:
cd $PROXY_DIR
export ZY_SMTP_USER='$ZY_SMTP_USER'
export ZY_SMTP_PASS='$ZY_SMTP_PASS'
node service/email-hub.js update-notify '${MESSAGE:-系统已更新}'
# 有MESSAGE时传入描述否则省略让email-hub自动读取release-notes.json
node service/email-hub.js update-notify ${MESSAGE:+'$MESSAGE'}
"
;;
@ -174,7 +178,8 @@ jobs:
cd $PROXY_DIR
export ZY_SMTP_USER='$ZY_SMTP_USER'
export ZY_SMTP_PASS='$ZY_SMTP_PASS'
node service/email-hub.js update-notify-single '$EMAIL' '${MESSAGE:-系统已更新}'
# 有MESSAGE时传入描述否则省略让email-hub自动读取release-notes.json
node service/email-hub.js update-notify-single '$EMAIL' ${MESSAGE:+'$MESSAGE'}
"
;;

View File

@ -0,0 +1,11 @@
{
"version": "∞",
"updated_at": "2026-04-06",
"features": [
"🧠 自主进化引擎 — 系统自动检测并升级核心协议,无需手动操作",
"📡 协议镜像加速 — 智能选路优化,连接速度与稳定性大幅提升",
"📊 智能流量监控 — 实时流量预警70%/80%/90%/100%阶梯告警)+ 月度自动重置",
"📧 邮件通信中枢 — 系统通知自动推送,升级/告警/反馈全覆盖",
"🛡️ 安全加固 — 多层防护体系,异常行为自动检测与告知"
]
}

View File

@ -19,8 +19,8 @@
//
// 用法:
// node email-hub.js monthly-reset — 发送月初重置邮件给所有用户
// node email-hub.js update-notify <desc> — 一键发送更新通知给所有用户
// node email-hub.js update-notify-single <email> <desc> — 发送更新通知给单个用户
// node email-hub.js update-notify [desc] — 一键发送更新通知给所有用户 (省略desc则读取release-notes.json)
// node email-hub.js update-notify-single <email> [desc] — 发送更新通知给单个用户
// node email-hub.js traffic-warn <pct> — 发送流量预警给所有用户
// node email-hub.js security-warn <email> <msg> — 发送安全提醒给单用户
// node email-hub.js feedback-ack <email> — 发送反馈确认给单用户
@ -41,6 +41,20 @@ const USERS_FILE = path.join(DATA_DIR, 'users.json');
const KEYS_FILE = process.env.ZY_PROXY_KEYS_FILE || path.join(PROXY_DIR, '.env.keys');
const POOL_STATUS_FILE = path.join(DATA_DIR, 'pool-quota-status.json');
const EMAIL_LOG_FILE = path.join(DATA_DIR, 'email-hub-log.json');
const RELEASE_NOTES_FILE = path.join(__dirname, '../config/release-notes.json');
// ── 加载版本更新说明 ────────────────────────────
function loadReleaseNotes() {
try {
const notes = JSON.parse(fs.readFileSync(RELEASE_NOTES_FILE, 'utf-8'));
if (notes.features && Array.isArray(notes.features) && notes.features.length > 0) {
return notes.features.join(';');
}
} catch {
// release-notes.json 不存在或格式错误,忽略
}
return '';
}
// ── 加载配置 ─────────────────────────────────
function loadConfig() {
@ -573,8 +587,8 @@ async function main() {
console.log('📧 光湖语言世界 · 邮件通信中枢');
console.log('用法:');
console.log(' node email-hub.js monthly-reset — 月初重置通知 (全部用户)');
console.log(' node email-hub.js update-notify <描述> — 一键发送更新通知 (全部用户)');
console.log(' node email-hub.js update-notify-single <邮箱> <描述> — 单独发送更新通知');
console.log(' node email-hub.js update-notify [描述] — 一键发送更新通知 (全部用户)');
console.log(' node email-hub.js update-notify-single <邮箱> [描述] — 单独发送更新通知');
console.log(' node email-hub.js traffic-warn <百分比> — 流量预警通知 (全部用户)');
console.log(' node email-hub.js security-warn <邮箱> <消息> — 安全风险提醒 (单用户)');
console.log(' node email-hub.js feedback-ack <邮箱> — 反馈确认回复 (单用户)');
@ -582,6 +596,7 @@ async function main() {
console.log('');
console.log('💡 描述支持分号分隔多条内容,自动渲染为功能清单:');
console.log(' node email-hub.js update-notify "新增智能选路;优化连接速度;修复断连问题"');
console.log('💡 省略描述时自动读取 config/release-notes.json 中的版本特性');
process.exit(0);
}
@ -593,22 +608,28 @@ async function main() {
}
case 'update-notify': {
if (!arg1) {
console.error('❌ 请提供更新描述');
const desc = arg1 || loadReleaseNotes();
if (!desc) {
console.error('❌ 请提供更新描述,或在 config/release-notes.json 中配置版本特性');
process.exit(1);
}
const result = await sendUpdateNotifyEmail(arg1);
const result = await sendUpdateNotifyEmail(desc);
console.log(`📧 更新通知 (一键发送): ${result.sent}成功 / ${result.failed}失败`);
break;
}
case 'update-notify-single': {
if (!arg1 || !arg2) {
console.error('❌ 请提供邮箱和更新描述');
console.error('用法: node email-hub.js update-notify-single <邮箱> <描述>');
if (!arg1) {
console.error('❌ 请提供邮箱');
console.error('用法: node email-hub.js update-notify-single <邮箱> [描述]');
process.exit(1);
}
const result = await sendUpdateNotifySingleEmail(arg1, arg2);
const singleDesc = arg2 || loadReleaseNotes();
if (!singleDesc) {
console.error('❌ 请提供更新描述,或在 config/release-notes.json 中配置版本特性');
process.exit(1);
}
const result = await sendUpdateNotifySingleEmail(arg1, singleDesc);
console.log(`📧 更新通知 (单独发送): ${result.sent}成功 / ${result.failed}失败`);
break;
}
@ -671,6 +692,7 @@ module.exports = {
sendFeedbackAckEmail,
getEnabledUsers,
listUserEmails,
loadReleaseNotes,
sendEmail
};