fix(static): 禁用 yhdet 系列功能并迁移数据库访问到 db 服务

- 注释禁用 yhdet OAuth 相关常量、辅助函数和视图函数(yhdet_callback/yhdet_login/yhdet_verify/proxy_send_code),消除 P0-2/P0-3/P0-4/NEW-1/NEW-2 风险

- YHDET_SECRET 置空并标注已失效;PRIVATE_SECRET 与 YHDET_PRIVATE_API 一并注释

- 新增 _db_call() 辅助函数,api_check_user 改经 pymsg 调 db 服务,不再直连 SQLite

- 修复注册页验证码:点击获取邮箱验证码时图形验证码输入框被清空的问题

- 更新 static 安全审计报告,修复率 25% → 65%
This commit is contained in:
qing committed 2026-08-03 22:05:02 +08:00
1 parent 4749e58eeb
commit f53085b2a6
3 files changed
+202 -230

No files matched your search

+3 -1
View File
@@ -23,6 +23,8 @@ async function refreshCaptcha() {
if (captchaLoading) return;
captchaLoading = true;
captchaToken = '';
captchaInput.value = ''; // 开始刷新时清空输入,避免用户误用旧验证码
captchaImg.style.opacity = '0.5'; // 视觉提示:正在刷新
try {
const res = await fetch('/captcha/image', { cache: 'no-store' });
if (res.status === 403) { // WAF 拦截:body 非图片,提示后待用户点击重试
@@ -36,6 +38,7 @@ async function refreshCaptcha() {
if (captchaImg.src && captchaImg.src.startsWith('blob:')) URL.revokeObjectURL(captchaImg.src);
captchaImg.src = URL.createObjectURL(blob);
captchaImg.alt = '点击刷新';
captchaImg.style.opacity = ''; // 恢复透明度
} catch (e) {
captchaImg.removeAttribute('src');
captchaImg.alt = '加载失败,点击重试';
@@ -220,7 +223,6 @@ getCodeButton.addEventListener('click', async function () {
if (httpStatus === 429) startResendCooldown(60); // 命中冷却/限流,倒计时对齐
} finally {
// CAPTCHA Token 一次性消费,无论成败都刷新
captchaInput.value = '';
refreshCaptcha();
if (!cooldownTimer) getCodeButton.disabled = false;
}