diff --git a/.github/workflows/infinity-evolution.yml b/.github/workflows/infinity-evolution.yml index 9d67856b..3b26c53c 100644 --- a/.github/workflows/infinity-evolution.yml +++ b/.github/workflows/infinity-evolution.yml @@ -44,6 +44,8 @@ on: - send-update-notify - send-update-notify-single - send-traffic-warn + - send-bandwidth-auth + - send-bandwidth-auth-single - send-threat-alert - send-threat-cleared - list-user-emails @@ -53,7 +55,7 @@ on: required: false type: string email: - description: '目标邮箱 (send-update-notify-single时需要 · 可先用list-user-emails查看)' + description: '目标邮箱 (send-update-notify-single/send-bandwidth-auth-single时需要 · 可先用list-user-emails查看)' required: false type: string @@ -238,6 +240,37 @@ jobs: " ;; + send-bandwidth-auth) + sync_email_files + echo "一键发送带宽验证码 (全部用户·自动提取邮箱·加密发送)..." + $SSH_CMD " + cd $PROXY_DIR + export ZY_SMTP_USER='$ZY_SMTP_USER' + export ZY_SMTP_PASS='$ZY_SMTP_PASS' + node service/email-hub.js bandwidth-auth-all + " + ;; + + send-bandwidth-auth-single) + if [ -z "$EMAIL" ]; then + echo "❌ 请提供目标邮箱 (email字段)" + echo "💡 可先使用 list-user-emails 查看所有用户邮箱" + exit 1 + fi + if ! echo "$EMAIL" | grep -qE '^[^@]+@[^@]+\.[^@]+$'; then + echo "❌ 邮箱格式不正确: $EMAIL" + exit 1 + fi + sync_email_files + echo "单独发送带宽验证码给: $EMAIL ..." + $SSH_CMD " + cd $PROXY_DIR + export ZY_SMTP_USER='$ZY_SMTP_USER' + export ZY_SMTP_PASS='$ZY_SMTP_PASS' + node service/email-hub.js bandwidth-auth '$EMAIL' + " + ;; + list-user-emails) sync_email_files echo "查询所有用户邮箱..." diff --git a/server/proxy/service/email-hub.js b/server/proxy/service/email-hub.js index 4751ee1a..0add01a1 100644 --- a/server/proxy/service/email-hub.js +++ b/server/proxy/service/email-hub.js @@ -10,11 +10,11 @@ // // 邮件类型: // 1. 月初重置通知 — 每月1号通知流量池已重置 -// 2. 更新升级通知 — 系统更新后告知用户 +// 2. 更新升级通知 — 系统更新后告知用户 (含VPN系统介绍) // 3. 流量预警通知 — 70%/80%/90%/100% 阶梯告警 // 4. 安全风险提醒 — 单用户异常行为告知 // 5. 反馈确认回复 — 收到用户反馈后的自动确认 -// 6. 带宽共享验证码 — 发送6位验证码 (∞+1) +// 6. 带宽共享验证码 — 发送6位验证码 (∞+1·含VPN系统介绍) // 7. 风险提示通知 — 全体用户风险提醒 (∞+1) // 8. 安全恢复通知 — 危机解除后全体通知 (∞+1) // @@ -27,7 +27,8 @@ // node email-hub.js traffic-warn — 发送流量预警给所有用户 // node email-hub.js security-warn — 发送安全提醒给单用户 // node email-hub.js feedback-ack — 发送反馈确认给单用户 -// node email-hub.js bandwidth-auth — 发送带宽共享验证码 (∞+1) +// node email-hub.js bandwidth-auth — 发送带宽共享验证码 (单用户·∞+1) +// node email-hub.js bandwidth-auth-all — 一键发送带宽验证码 (全部用户·∞+1) // node email-hub.js threat-alert — 全体用户风险提示 (∞+1) // node email-hub.js threat-cleared — 全体用户安全恢复通知 (∞+1) // node email-hub.js list-emails — 列出所有启用用户的邮箱 @@ -62,6 +63,64 @@ function loadReleaseNotes() { return ''; } +// ── 加载完整版本信息对象 ─────────────────────────── +function loadReleaseNotesObj() { + try { + return JSON.parse(fs.readFileSync(RELEASE_NOTES_FILE, 'utf-8')); + } catch { + return { version: '∞+1', updated_at: '', features: [] }; + } +} + +// ── VPN系统介绍HTML (通用模块) ───────────────────── +function getVpnSystemIntroHtml(releaseNotes) { + const version = (releaseNotes && releaseNotes.version) || '∞+1'; + const updatedAt = (releaseNotes && releaseNotes.updated_at) || ''; + + return ` + +
+

🔰 关于光湖语言世界 · VPN专线

+

+ 本VPN节点由光湖语言系统完全自主研发,仅供团队内部自用
+ 非商业服务,不面向公众开放。所有用户均为受邀团队成员。 +

+ +

🏗️ 核心技术架构

+ + + + + + + + + + + + + + + + + + + + + + + + + +
传输协议VLESS + Reality — 业界顶级隐蔽传输协议,流量特征完全伪装
防御体系蜂群防御 · Moving Target Defense — 多服务器动态融合/分裂,真节点永远隐匿
隐私保护用户守护Agent — 每条专线专属守护人格体,自毁式隐私保护
智能选路协议镜像加速 — AI自动探测最优路径,连接速度与稳定性大幅提升
自主进化AI驱动进化引擎 — 系统自动检测并升级核心协议,无需手动操作
安全层级7层安全体系 — 语言膜·蜂群分裂·真节点隐匿·守护Agent·威胁切断·日志格式化·自毁消失
+ +
+ 📌 当前系统版本: ${escapeHtml(version)} + ${updatedAt ? `更新于 ${escapeHtml(updatedAt)}` : ''} +
+
`; +} + // ── 加载配置 ───────────────────────────────── function loadConfig() { const config = { @@ -375,6 +434,8 @@ function generateMonthlyResetEmail(config) { // ═══════════════════════════════════════════════ function generateUpdateNotifyEmail(description, config) { const now = new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' }); + const releaseNotes = loadReleaseNotesObj(); + const vpnIntro = getVpnSystemIntroHtml(releaseNotes); // 支持用分号或换行符分隔的多条更新内容,自动渲染为功能清单 const items = description.split(/[;\n]/).map(s => s.trim()).filter(Boolean); @@ -393,7 +454,9 @@ function generateUpdateNotifyEmail(description, config) { 🔄 系统已完成升级 -

📋 本次更新内容

+ ${vpnIntro} + +

📋 本次更新内容 · 版本 ${escapeHtml(releaseNotes.version || '∞+1')}

${detailHtml}
@@ -532,13 +595,20 @@ function generateFeedbackAckEmail(config) { // 📧 邮件类型 6: 带宽共享验证码 (∞+1) // ═══════════════════════════════════════════════ function generateBandwidthAuthEmail(code, authPageUrl, config) { + const releaseNotes = loadReleaseNotesObj(); + const vpnIntro = getVpnSystemIntroHtml(releaseNotes); + const content = `
🌊 带宽共享加速 · 授权验证
+ ${vpnIntro} + +

🔑 带宽共享加速 · 验证码授权

您正在参与光湖语言世界的带宽共享加速计划。
+ 这是一项完全自愿的功能,参与后可让VPN网络整体更快。
如果您同意授权,请复制以下验证码并提交:

@@ -567,10 +637,11 @@ function generateBandwidthAuthEmail(code, authPageUrl, config) {
-

❌ 不同意 = 忽略此邮件

+

❌ 不同意 = 忽略此邮件即可

- 完全没问题。您可以继续正常使用VPN,只是走我们系统的带宽,
- 速度可能慢一些,但也比普通VPN好太多了。 + 完全没问题,这是您的自由选择。您可以继续正常使用VPN,
+ 只是走系统自身带宽,速度可能慢一些,但也比普通VPN好太多了。
+ 如果以后改变主意,随时可以联系我们重新发送验证码。

@@ -578,7 +649,7 @@ function generateBandwidthAuthEmail(code, authPageUrl, config) {

🔒 安全说明:本VPN是内部专用的,用户都是团队自己人。 - 您的IP仅用于带宽加速,系统内部加密存储,外部无法看到。 + 您的IP仅用于带宽加速,系统内部加密存储(SHA256 + 盐值),外部无法看到。 若检测到任何风险,系统会自动切断您的共享通道, 并格式化所有共享记录——就像这条路从未出现过一样。 危机解除后,我们会重新为您推送新的订阅链接。您的隐私安全,铸渊守护。 @@ -865,6 +936,63 @@ async function sendThreatClearedEmail() { return result; } +/** + * 一键发送带宽共享验证码给所有用户 (∞+1) + * 自动提取所有启用用户邮箱,为每位用户生成独立验证码并加密发送 + */ +async function sendBandwidthAuthAllEmail() { + const users = getEnabledUsers(); + const config = loadConfig(); + + if (users.length === 0) { + console.log('[邮件中枢] 无启用用户,跳过发送'); + return { sent: 0, failed: 0, errors: [] }; + } + + let bwPool; + try { + bwPool = require('./bandwidth-pool-agent'); + } catch (err) { + console.error('[邮件中枢] ❌ 无法加载带宽池模块:', err.message); + return { sent: 0, failed: 0, errors: ['无法加载bandwidth-pool-agent模块'] }; + } + + let sent = 0; + let failed = 0; + const errors = []; + + console.log(`[邮件中枢] 开始一键批量发送带宽验证码 (${users.length}位用户)`); + + for (const user of users) { + try { + // 为每位用户生成独立验证码 + const authCode = bwPool.createAuthCode(user.email); + + // 构建用户专属授权页面URL + let authPageUrl; + if (user.token) { + const host = config.server_host || 'guanghulab.com'; + authPageUrl = `https://${host}/api/proxy-v3/bandwidth-auth/${user.token}`; + } + + const html = generateBandwidthAuthEmail(authCode, authPageUrl, config); + await sendEmail(user.email, '🌊 光湖语言世界 · 带宽共享授权验证码', html); + sent++; + console.log(` ✅ ${user.email}`); + // 间隔500ms避免SMTP限流 + await new Promise(r => setTimeout(r, 500)); + } catch (err) { + failed++; + errors.push(`${user.email}: ${err.message}`); + console.error(` ❌ ${user.email}: ${err.message}`); + } + } + + console.log(`[邮件中枢] 带宽验证码批量发送完成: ${sent}成功 / ${failed}失败`); + logEmail('bandwidth-auth-all', sent + failed, sent, errors.join('; ')); + return { sent, failed, errors }; +} + // ═══════════════════════════════════════════════ // CLI 主入口 @@ -881,7 +1009,8 @@ async function main() { console.log(' node email-hub.js traffic-warn <百分比> — 流量预警通知 (全部用户)'); console.log(' node email-hub.js security-warn <邮箱> <消息> — 安全风险提醒 (单用户)'); console.log(' node email-hub.js feedback-ack <邮箱> — 反馈确认回复 (单用户)'); - console.log(' node email-hub.js bandwidth-auth <邮箱> — 发送带宽共享验证码 (∞+1)'); + console.log(' node email-hub.js bandwidth-auth <邮箱> — 发送带宽共享验证码 (单用户·∞+1)'); + console.log(' node email-hub.js bandwidth-auth-all — 一键发送带宽验证码 (全部用户·∞+1)'); console.log(' node email-hub.js threat-alert <消息> — 全体用户风险提示 (∞+1)'); console.log(' node email-hub.js threat-cleared — 全体用户安全恢复通知 (∞+1)'); console.log(' node email-hub.js list-emails — 列出所有用户邮箱'); @@ -889,6 +1018,7 @@ async function main() { console.log('💡 描述支持分号分隔多条内容,自动渲染为功能清单:'); console.log(' node email-hub.js update-notify "新增智能选路;优化连接速度;修复断连问题"'); console.log('💡 省略描述时自动读取 config/release-notes.json 中的版本特性'); + console.log('💡 bandwidth-auth-all 会自动提取所有用户邮箱,为每人生成独立验证码加密发送'); process.exit(0); } @@ -993,6 +1123,12 @@ async function main() { break; } + case 'bandwidth-auth-all': { + const resultAll = await sendBandwidthAuthAllEmail(); + console.log(`📧 带宽验证码 (一键全发): ${resultAll.sent}成功 / ${resultAll.failed}失败`); + break; + } + case 'threat-alert': { if (!arg1) { console.error('❌ 请提供风险消息'); @@ -1025,11 +1161,13 @@ module.exports = { sendSecurityWarnEmail, sendFeedbackAckEmail, sendBandwidthAuthEmail, + sendBandwidthAuthAllEmail, sendThreatAlertEmail, sendThreatClearedEmail, getEnabledUsers, listUserEmails, loadReleaseNotes, + loadReleaseNotesObj, sendEmail };