fix: 带宽验证码模块从GitHub Pages迁移到用户仪表盘
- 移除 docs/index.html 中的带宽验证码页面(CSS/HTML/JS) - 在 subscription-server-v3.js 用户仪表盘中集成带宽验证功能 - 仪表盘中邮箱自动填充、发送验证码、验证码提交、60s冷却 - 解决 guanghulab.online 无法正常展示的问题 Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/a13d4c74-f23c-45ce-9df9-ea5796120fbc Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
parent
806121a41b
commit
ac2a26ec64
211
docs/index.html
211
docs/index.html
|
|
@ -718,34 +718,7 @@ label{display:block;font-size:12px;color:var(--dim);margin-bottom:4px;font-weigh
|
||||||
.app-card:hover .app-card-arrow{opacity:1;transform:translateX(4px)}
|
.app-card:hover .app-card-arrow{opacity:1;transform:translateX(4px)}
|
||||||
|
|
||||||
/* ═══ PAGE: Bandwidth Sharing (带宽共享) ═══ */
|
/* ═══ PAGE: Bandwidth Sharing (带宽共享) ═══ */
|
||||||
#pg-bandwidth .bw-hero{text-align:center;padding:28px 0 20px}
|
|
||||||
#pg-bandwidth .bw-hero h2{font-size:1.4em;background:linear-gradient(135deg,var(--accent),var(--accent2));-webkit-background-clip:text;-webkit-text-fill-color:transparent}
|
|
||||||
#pg-bandwidth .bw-hero p{color:var(--dim);font-size:.9em;margin-top:6px}
|
|
||||||
#pg-bandwidth .bw-stats{display:flex;justify-content:space-around;margin:16px 0;gap:12px}
|
|
||||||
#pg-bandwidth .bw-stat{text-align:center;flex:1}
|
|
||||||
#pg-bandwidth .bw-stat .num{font-size:1.5em;font-weight:700;color:var(--accent);font-family:var(--m)}
|
|
||||||
#pg-bandwidth .bw-stat .label{font-size:.75em;color:var(--dim);margin-top:4px}
|
|
||||||
#pg-bandwidth .bw-card{background:var(--bg1);border-radius:var(--r);padding:20px;margin:12px 0;border:1px solid var(--border)}
|
|
||||||
#pg-bandwidth .bw-card h3{font-size:1em;color:var(--accent);margin-bottom:14px}
|
|
||||||
#pg-bandwidth .bw-input{width:100%;padding:12px 14px;background:var(--bg2);border:2px solid var(--border);border-radius:var(--rs);color:var(--text);font-size:1em;outline:none;transition:border-color .3s;font-family:var(--f)}
|
|
||||||
#pg-bandwidth .bw-input:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(138,180,248,.15)}
|
|
||||||
#pg-bandwidth .bw-input::placeholder{color:var(--dim);font-size:.85em}
|
|
||||||
#pg-bandwidth .bw-code-input{text-align:center;letter-spacing:8px;font-size:1.3em;font-family:var(--m)}
|
|
||||||
#pg-bandwidth .bw-code-input::placeholder{letter-spacing:0;font-size:.6em}
|
|
||||||
#pg-bandwidth .bw-btn{width:100%;padding:14px;background:linear-gradient(135deg,var(--accent),var(--accent2));color:#fff;border:none;border-radius:var(--rs);font-size:1em;font-weight:600;cursor:pointer;transition:opacity .3s,transform .15s;margin-top:8px;font-family:var(--f)}
|
|
||||||
#pg-bandwidth .bw-btn:hover{opacity:.9}
|
|
||||||
#pg-bandwidth .bw-btn:active{transform:scale(.98)}
|
|
||||||
#pg-bandwidth .bw-btn:disabled{opacity:.5;cursor:not-allowed;transform:none}
|
|
||||||
#pg-bandwidth .bw-btn-outline{background:transparent;border:1px solid var(--accent);color:var(--accent)}
|
|
||||||
#pg-bandwidth .bw-btn-outline:hover{background:rgba(138,180,248,.1)}
|
|
||||||
#pg-bandwidth .bw-result{text-align:center;padding:14px;border-radius:var(--rs);margin-top:12px;display:none;font-size:.9em;line-height:1.6}
|
|
||||||
#pg-bandwidth .bw-result.ok{display:block;background:rgba(52,211,153,.1);color:var(--ok);border:1px solid rgba(52,211,153,.2)}
|
|
||||||
#pg-bandwidth .bw-result.err{display:block;background:rgba(248,113,113,.1);color:var(--err);border:1px solid rgba(248,113,113,.2)}
|
|
||||||
#pg-bandwidth .bw-info{background:var(--bg2);border-radius:var(--rs);padding:14px 16px;margin:10px 0;font-size:.85em;line-height:1.8;color:var(--dim);border-left:3px solid var(--accent)}
|
|
||||||
#pg-bandwidth .bw-consent{display:flex;align-items:flex-start;gap:10px;margin:14px 0;padding:12px 14px;background:var(--bg2);border-radius:var(--rs);border:1px solid var(--border);cursor:pointer;transition:border-color .3s}
|
|
||||||
#pg-bandwidth .bw-consent:hover{border-color:var(--accent)}
|
|
||||||
#pg-bandwidth .bw-consent input{margin-top:3px;width:18px;height:18px;accent-color:var(--accent);cursor:pointer;flex-shrink:0}
|
|
||||||
#pg-bandwidth .bw-consent span{color:var(--dim);font-size:.85em;line-height:1.7}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
@ -951,9 +924,9 @@ label{display:block;font-size:12px;color:var(--dim);margin-bottom:4px;font-weigh
|
||||||
<div class="sys-section">
|
<div class="sys-section">
|
||||||
<div class="sys-section-title">⚡ 快速入口</div>
|
<div class="sys-section-title">⚡ 快速入口</div>
|
||||||
<div style="display:flex;flex-direction:column;gap:8px">
|
<div style="display:flex;flex-direction:column;gap:8px">
|
||||||
<div class="sys-team-card" style="cursor:pointer" onclick="go('bandwidth')">
|
<div class="sys-team-card" style="cursor:pointer" onclick="go('system')">
|
||||||
<div class="sys-team-av" style="background:linear-gradient(135deg,#22d3ee,#06b6d4)">🌊</div>
|
<div class="sys-team-av" style="background:linear-gradient(135deg,#22d3ee,#06b6d4)">🌊</div>
|
||||||
<div><div class="sys-team-nm">带宽共享加速池</div><div class="sys-team-role">共享你的带宽 · 加速所有人</div></div>
|
<div><div class="sys-team-nm">带宽共享加速池</div><div class="sys-team-role">请在用户仪表盘中操作</div></div>
|
||||||
</div>
|
</div>
|
||||||
<a href="https://github.com/qinfendebingshuo/guanghulab/issues/new?labels=deputy-message-board&title=给铸渊副将留言" style="text-decoration:none;color:inherit" target="_blank">
|
<a href="https://github.com/qinfendebingshuo/guanghulab/issues/new?labels=deputy-message-board&title=给铸渊副将留言" style="text-decoration:none;color:inherit" target="_blank">
|
||||||
<div class="sys-team-card" style="cursor:pointer">
|
<div class="sys-team-card" style="cursor:pointer">
|
||||||
|
|
@ -1202,61 +1175,8 @@ label{display:block;font-size:12px;color:var(--dim);margin-bottom:4px;font-weigh
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- ═══════════════════════════════════════ -->
|
<!-- ═══════════════════════════════════════ -->
|
||||||
<!-- PAGE: Bandwidth Sharing (带宽共享) -->
|
<!-- PAGE: Bandwidth (已迁移到用户仪表盘) -->
|
||||||
<!-- ═══════════════════════════════════════ -->
|
<!-- ═══════════════════════════════════════ -->
|
||||||
<div class="page" id="pg-bandwidth" data-state="hidden">
|
|
||||||
<div class="bar">
|
|
||||||
<button class="btn" onclick="go('home')">← 首页</button>
|
|
||||||
<div class="bar-title">🌊 带宽共享</div>
|
|
||||||
<div class="bar-right"><span class="dot"></span></div>
|
|
||||||
</div>
|
|
||||||
<div class="content">
|
|
||||||
<div class="bw-hero">
|
|
||||||
<h2>🌊 带宽共享加速池</h2>
|
|
||||||
<p>共享你的带宽 · 加速所有人</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="bw-stats">
|
|
||||||
<div class="bw-stat"><div class="num" id="bwContributors">—</div><div class="label">贡献者</div></div>
|
|
||||||
<div class="bw-stat"><div class="num" id="bwActive">—</div><div class="label">活跃</div></div>
|
|
||||||
<div class="bw-stat"><div class="num" id="bwContributed">—</div><div class="label">总贡献(GB)</div></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="bw-card">
|
|
||||||
<h3>📧 第一步 · 发送验证码</h3>
|
|
||||||
<div style="margin-bottom:10px">
|
|
||||||
<input type="email" class="bw-input" id="bwEmail" placeholder="输入你的QQ邮箱" autocomplete="email">
|
|
||||||
</div>
|
|
||||||
<button class="bw-btn" id="bwSendCode" onclick="bwSendCode()">发送验证码</button>
|
|
||||||
<div class="bw-result" id="bwSendResult"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="bw-card">
|
|
||||||
<h3>🔑 第二步 · 输入验证码</h3>
|
|
||||||
<div style="margin-bottom:10px">
|
|
||||||
<input type="text" class="bw-input bw-code-input" id="bwCode" maxlength="6" placeholder="6位验证码" inputmode="numeric" pattern="[0-9]*">
|
|
||||||
</div>
|
|
||||||
<div class="bw-consent" onclick="var cb=document.getElementById('bwConsent');cb.checked=!cb.checked">
|
|
||||||
<input type="checkbox" id="bwConsent">
|
|
||||||
<span>我自愿共享多余带宽加入加速池。系统优先保障我的专属通道,仅将我用不上的资源共享给其他成员。我可以随时退出。</span>
|
|
||||||
</div>
|
|
||||||
<button class="bw-btn" id="bwVerify" onclick="bwVerifyCode()">提交验证码</button>
|
|
||||||
<div class="bw-result" id="bwVerifyResult"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="bw-info">
|
|
||||||
<strong style="color:var(--text);display:block;margin-bottom:6px">💡 带宽共享说明</strong>
|
|
||||||
✅ 提供了验证码的用户 → 优先保障你的专属通道<br>
|
|
||||||
✅ 你用不上的资源才会被共享 → 不抢你的带宽<br>
|
|
||||||
✅ 随时可退出 → 你有完全的控制权<br>
|
|
||||||
⚠️ 验证码15分钟内有效 · 一次性使用
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="text-align:center;padding:20px 0;color:var(--dim);font-size:.75em">
|
|
||||||
<p>© 2026 光湖语言世界 · 国作登字-2026-A-00037559</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- ═══════════════════════════════════════ -->
|
<!-- ═══════════════════════════════════════ -->
|
||||||
<!-- PAGE: Workspace (个人码字工作台) -->
|
<!-- PAGE: Workspace (个人码字工作台) -->
|
||||||
|
|
@ -3576,128 +3496,9 @@ offline = function(msg){
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/* ════════════════════════════════════════
|
/* ════════════════════════════════════════
|
||||||
BANDWIDTH SHARING AGENT (带宽共享验证)
|
BANDWIDTH SHARING (已迁移到用户仪表盘)
|
||||||
GitHub Pages 前端 → 后端API桥接
|
验证码功能现在在 /dashboard/{token} 中
|
||||||
════════════════════════════════════════ */
|
════════════════════════════════════════ */
|
||||||
var BW_API_BASE = 'https://guanghulab.online/api/proxy-v3';
|
|
||||||
|
|
||||||
function bwSendCode(){
|
|
||||||
var email = document.getElementById('bwEmail').value.trim().toLowerCase();
|
|
||||||
var btn = document.getElementById('bwSendCode');
|
|
||||||
var result = document.getElementById('bwSendResult');
|
|
||||||
|
|
||||||
if(!email || email.indexOf('@') === -1){
|
|
||||||
result.className = 'bw-result err';
|
|
||||||
result.textContent = '请输入有效的邮箱地址';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
btn.disabled = true;
|
|
||||||
btn.textContent = '发送中...';
|
|
||||||
result.className = 'bw-result';
|
|
||||||
result.style.display = 'none';
|
|
||||||
|
|
||||||
fetch(BW_API_BASE + '/bandwidth-send-code', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {'Content-Type': 'application/json'},
|
|
||||||
body: JSON.stringify({email: email})
|
|
||||||
}).then(function(r){ return r.json(); }).then(function(data){
|
|
||||||
btn.disabled = false;
|
|
||||||
btn.textContent = '发送验证码';
|
|
||||||
result.className = 'bw-result ' + (data.success ? 'ok' : 'err');
|
|
||||||
result.textContent = data.message || (data.success ? '验证码已发送' : '发送失败');
|
|
||||||
|
|
||||||
if(data.success){
|
|
||||||
// Cooldown 60s
|
|
||||||
var cd = 60;
|
|
||||||
btn.disabled = true;
|
|
||||||
var timer = setInterval(function(){
|
|
||||||
cd--;
|
|
||||||
btn.textContent = cd + 's 后可重发';
|
|
||||||
if(cd <= 0){
|
|
||||||
clearInterval(timer);
|
|
||||||
btn.disabled = false;
|
|
||||||
btn.textContent = '发送验证码';
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
}).catch(function(err){
|
|
||||||
btn.disabled = false;
|
|
||||||
btn.textContent = '发送验证码';
|
|
||||||
result.className = 'bw-result err';
|
|
||||||
result.textContent = '网络错误,请检查网络后重试';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function bwVerifyCode(){
|
|
||||||
var email = document.getElementById('bwEmail').value.trim().toLowerCase();
|
|
||||||
var code = document.getElementById('bwCode').value.trim();
|
|
||||||
var consent = document.getElementById('bwConsent').checked;
|
|
||||||
var btn = document.getElementById('bwVerify');
|
|
||||||
var result = document.getElementById('bwVerifyResult');
|
|
||||||
|
|
||||||
if(!email || email.indexOf('@') === -1){
|
|
||||||
result.className = 'bw-result err';
|
|
||||||
result.textContent = '请先在上方输入邮箱';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!code || code.length !== 6){
|
|
||||||
result.className = 'bw-result err';
|
|
||||||
result.textContent = '请输入6位验证码';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!consent){
|
|
||||||
result.className = 'bw-result err';
|
|
||||||
result.textContent = '请先勾选同意带宽共享协议';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
btn.disabled = true;
|
|
||||||
btn.textContent = '验证中...';
|
|
||||||
result.className = 'bw-result';
|
|
||||||
result.style.display = 'none';
|
|
||||||
|
|
||||||
fetch(BW_API_BASE + '/bandwidth-verify-code', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {'Content-Type': 'application/json'},
|
|
||||||
body: JSON.stringify({email: email, code: code})
|
|
||||||
}).then(function(r){ return r.json(); }).then(function(data){
|
|
||||||
btn.disabled = false;
|
|
||||||
btn.textContent = '提交验证码';
|
|
||||||
result.className = 'bw-result ' + (data.success ? 'ok' : 'err');
|
|
||||||
result.textContent = data.message || (data.success ? '授权成功!' : '验证失败');
|
|
||||||
if(data.success) bwLoadPoolStatus();
|
|
||||||
}).catch(function(){
|
|
||||||
btn.disabled = false;
|
|
||||||
btn.textContent = '提交验证码';
|
|
||||||
result.className = 'bw-result err';
|
|
||||||
result.textContent = '网络错误,请检查网络后重试';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function bwLoadPoolStatus(){
|
|
||||||
fetch(BW_API_BASE + '/bandwidth-pool-status').then(function(r){
|
|
||||||
return r.json();
|
|
||||||
}).then(function(data){
|
|
||||||
var el1 = document.getElementById('bwContributors');
|
|
||||||
var el2 = document.getElementById('bwActive');
|
|
||||||
var el3 = document.getElementById('bwContributed');
|
|
||||||
if(el1) el1.textContent = data.total_contributors || 0;
|
|
||||||
if(el2) el2.textContent = data.active_contributors || 0;
|
|
||||||
if(el3) el3.textContent = data.total_contributed_gb || 0;
|
|
||||||
}).catch(function(){
|
|
||||||
/* Pool status unavailable - keep defaults */
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auto-load pool status when bandwidth page is shown
|
|
||||||
var _origGo = window.go;
|
|
||||||
if(typeof _origGo === 'function'){
|
|
||||||
window.go = function(target){
|
|
||||||
_origGo(target);
|
|
||||||
if(target === 'bandwidth') bwLoadPoolStatus();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -857,10 +857,152 @@ mode: direct
|
||||||
<div class="stat-row"><span class="stat-label">智能选路</span><span class="stat-value">${nodes.length > 1 ? '✅ url-test' : '单节点'}</span></div>
|
<div class="stat-row"><span class="stat-label">智能选路</span><span class="stat-value">${nodes.length > 1 ? '✅ url-test' : '单节点'}</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h3>🌊 带宽共享加速</h3>
|
||||||
|
<p style="font-size: 0.85em; color: #888; margin-bottom: 12px; line-height: 1.6;">共享你的闲置带宽,加速所有人。系统优先保障你的专属通道。</p>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px;">
|
||||||
|
<input type="email" id="bwEmail" value="${esc(user.email || '')}" placeholder="输入邮箱地址" autocomplete="email"
|
||||||
|
style="width:100%;padding:12px 14px;background:#1e2448;border:2px solid #2d3566;border-radius:10px;color:#fff;font-size:0.95em;outline:none;">
|
||||||
|
</div>
|
||||||
|
<button id="bwSendBtn" onclick="bwSendCode()" style="width:100%;padding:12px;background:linear-gradient(135deg,#667eea,#764ba2);color:#fff;border:none;border-radius:10px;font-size:0.95em;font-weight:600;cursor:pointer;margin-bottom:10px;">📧 发送验证码</button>
|
||||||
|
<div id="bwSendResult" style="display:none;text-align:center;padding:10px;border-radius:8px;margin-bottom:10px;font-size:0.85em;"></div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px;">
|
||||||
|
<input type="text" id="bwCode" maxlength="6" pattern="[0-9]*" inputmode="numeric" placeholder="输入6位验证码" autocomplete="off"
|
||||||
|
style="width:100%;padding:12px 14px;background:#1e2448;border:2px solid #2d3566;border-radius:10px;color:#fff;font-size:1.1em;text-align:center;letter-spacing:8px;outline:none;">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label style="display:flex;align-items:flex-start;gap:10px;margin:12px 0;padding:12px;background:#1a1f3d;border-radius:10px;border:1px solid #2d3566;cursor:pointer;font-size:0.82em;color:#aaa;line-height:1.6;">
|
||||||
|
<input type="checkbox" id="bwConsent" style="margin-top:3px;width:18px;height:18px;accent-color:#667eea;flex-shrink:0;">
|
||||||
|
<span>我自愿共享闲置带宽加入加速池。系统优先保障我的专属通道,仅将用不上的资源共享给其他成员。我可以随时退出。</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<button id="bwVerifyBtn" onclick="bwVerifyCode()" style="width:100%;padding:12px;background:linear-gradient(135deg,#22d3ee,#06b6d4);color:#fff;border:none;border-radius:10px;font-size:0.95em;font-weight:600;cursor:pointer;">🔑 提交验证码</button>
|
||||||
|
<div id="bwVerifyResult" style="display:none;text-align:center;padding:10px;border-radius:8px;margin-top:10px;font-size:0.85em;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
光湖语言世界 · 冰朔开发维护<br>
|
光湖语言世界 · 冰朔开发维护<br>
|
||||||
更新于 ${new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' })}
|
更新于 ${new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' })}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function bwSendCode() {
|
||||||
|
var email = document.getElementById('bwEmail').value.trim().toLowerCase();
|
||||||
|
var btn = document.getElementById('bwSendBtn');
|
||||||
|
var result = document.getElementById('bwSendResult');
|
||||||
|
|
||||||
|
if (!email || email.indexOf('@') === -1) {
|
||||||
|
result.style.display = 'block';
|
||||||
|
result.style.background = '#3a1a1a';
|
||||||
|
result.style.color = '#e74c3c';
|
||||||
|
result.textContent = '请输入有效的邮箱地址';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
btn.disabled = true;
|
||||||
|
btn.textContent = '⏳ 发送中...';
|
||||||
|
result.style.display = 'none';
|
||||||
|
|
||||||
|
fetch('/bandwidth-send-code', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ email: email })
|
||||||
|
}).then(function(r) { return r.json(); }).then(function(data) {
|
||||||
|
btn.disabled = false;
|
||||||
|
btn.textContent = '📧 发送验证码';
|
||||||
|
result.style.display = 'block';
|
||||||
|
if (data.success) {
|
||||||
|
result.style.background = '#1a3a2a';
|
||||||
|
result.style.color = '#2ecc71';
|
||||||
|
// 60s cooldown
|
||||||
|
var cd = 60;
|
||||||
|
btn.disabled = true;
|
||||||
|
var timer = setInterval(function() {
|
||||||
|
cd--;
|
||||||
|
btn.textContent = cd + 's 后可重发';
|
||||||
|
if (cd <= 0) {
|
||||||
|
clearInterval(timer);
|
||||||
|
btn.disabled = false;
|
||||||
|
btn.textContent = '📧 发送验证码';
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
} else {
|
||||||
|
result.style.background = '#3a1a1a';
|
||||||
|
result.style.color = '#e74c3c';
|
||||||
|
}
|
||||||
|
result.textContent = data.message || (data.success ? '验证码已发送' : '发送失败');
|
||||||
|
}).catch(function() {
|
||||||
|
btn.disabled = false;
|
||||||
|
btn.textContent = '📧 发送验证码';
|
||||||
|
result.style.display = 'block';
|
||||||
|
result.style.background = '#3a1a1a';
|
||||||
|
result.style.color = '#e74c3c';
|
||||||
|
result.textContent = '网络错误,请重试';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function bwVerifyCode() {
|
||||||
|
var email = document.getElementById('bwEmail').value.trim().toLowerCase();
|
||||||
|
var code = document.getElementById('bwCode').value.trim();
|
||||||
|
var consent = document.getElementById('bwConsent').checked;
|
||||||
|
var btn = document.getElementById('bwVerifyBtn');
|
||||||
|
var result = document.getElementById('bwVerifyResult');
|
||||||
|
|
||||||
|
if (!email || email.indexOf('@') === -1) {
|
||||||
|
result.style.display = 'block';
|
||||||
|
result.style.background = '#3a1a1a';
|
||||||
|
result.style.color = '#e74c3c';
|
||||||
|
result.textContent = '请先输入邮箱地址';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!code || code.length !== 6) {
|
||||||
|
result.style.display = 'block';
|
||||||
|
result.style.background = '#3a1a1a';
|
||||||
|
result.style.color = '#e74c3c';
|
||||||
|
result.textContent = '请输入6位验证码';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!consent) {
|
||||||
|
result.style.display = 'block';
|
||||||
|
result.style.background = '#3a1a1a';
|
||||||
|
result.style.color = '#e74c3c';
|
||||||
|
result.textContent = '请先勾选同意带宽共享协议';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
btn.disabled = true;
|
||||||
|
btn.textContent = '⏳ 验证中...';
|
||||||
|
result.style.display = 'none';
|
||||||
|
|
||||||
|
fetch('/bandwidth-verify-code', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ email: email, code: code })
|
||||||
|
}).then(function(r) { return r.json(); }).then(function(data) {
|
||||||
|
result.style.display = 'block';
|
||||||
|
if (data.success) {
|
||||||
|
result.style.background = '#1a3a2a';
|
||||||
|
result.style.color = '#2ecc71';
|
||||||
|
btn.textContent = '✅ 授权成功';
|
||||||
|
} else {
|
||||||
|
result.style.background = '#3a1a1a';
|
||||||
|
result.style.color = '#e74c3c';
|
||||||
|
btn.disabled = false;
|
||||||
|
btn.textContent = '🔑 提交验证码';
|
||||||
|
}
|
||||||
|
result.textContent = data.message || (data.success ? '授权成功!' : '验证失败');
|
||||||
|
}).catch(function() {
|
||||||
|
btn.disabled = false;
|
||||||
|
btn.textContent = '🔑 提交验证码';
|
||||||
|
result.style.display = 'block';
|
||||||
|
result.style.background = '#3a1a1a';
|
||||||
|
result.style.color = '#e74c3c';
|
||||||
|
result.textContent = '网络错误,请重试';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>`;
|
</html>`;
|
||||||
|
|
||||||
|
|
@ -1732,7 +1874,7 @@ async function submitCode(e) {
|
||||||
|
|
||||||
// ═══════════════════════════════════════════════
|
// ═══════════════════════════════════════════════
|
||||||
// ∞+1 公开API: /bandwidth-send-code (无需token·邮箱验证码发送)
|
// ∞+1 公开API: /bandwidth-send-code (无需token·邮箱验证码发送)
|
||||||
// 用户在GitHub Pages首页输入邮箱 → 调用此API发送验证码
|
// 用户在仪表盘 /dashboard/{token} 中发送验证码
|
||||||
// 安全: 每个IP每小时最多3次
|
// 安全: 每个IP每小时最多3次
|
||||||
// ═══════════════════════════════════════════════
|
// ═══════════════════════════════════════════════
|
||||||
if (pathname === '/bandwidth-send-code' && req.method === 'POST') {
|
if (pathname === '/bandwidth-send-code' && req.method === 'POST') {
|
||||||
|
|
@ -1811,7 +1953,7 @@ async function submitCode(e) {
|
||||||
|
|
||||||
// ═══════════════════════════════════════════════
|
// ═══════════════════════════════════════════════
|
||||||
// ∞+1 公开API: /bandwidth-verify-code (无需token·验证码校验+注册)
|
// ∞+1 公开API: /bandwidth-verify-code (无需token·验证码校验+注册)
|
||||||
// 用户在GitHub Pages首页输入邮箱+验证码 → 调用此API完成授权
|
// 用户在仪表盘 /dashboard/{token} 中输入验证码 → 调用此API完成授权
|
||||||
// ═══════════════════════════════════════════════
|
// ═══════════════════════════════════════════════
|
||||||
if (pathname === '/bandwidth-verify-code' && req.method === 'POST') {
|
if (pathname === '/bandwidth-verify-code' && req.method === 'POST') {
|
||||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||||
|
|
@ -1895,7 +2037,7 @@ async function submitCode(e) {
|
||||||
|
|
||||||
// ═══════════════════════════════════════════════
|
// ═══════════════════════════════════════════════
|
||||||
// ∞+1 公开API: /bandwidth-pool-status (无需token·带宽池状态)
|
// ∞+1 公开API: /bandwidth-pool-status (无需token·带宽池状态)
|
||||||
// GitHub Pages首页实时显示带宽池状态
|
// 仪表盘实时显示带宽池状态
|
||||||
// ═══════════════════════════════════════════════
|
// ═══════════════════════════════════════════════
|
||||||
if (pathname === '/bandwidth-pool-status' && req.method === 'GET') {
|
if (pathname === '/bandwidth-pool-status' && req.method === 'GET') {
|
||||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue