feat: 迁移自定义功能至 1.5.9.9 版本
包含音乐源限制、CI 防 OOM 优化、数据库连接池优化、管理端权限及 UI 细节定制等功能
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import { SmtpService } from '~~/server/services/smtpService'
|
||||
import { getSystemSettingsCached } from '~~/server/utils/system-settings-helper'
|
||||
import { SMTP_PASSWORD_MASK } from '~~/server/api/admin/system-settings/secretMask'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
// 检查请求方法
|
||||
@@ -54,19 +52,11 @@ export default defineEventHandler(async (event) => {
|
||||
const originalTransporter = smtpService.transporter
|
||||
|
||||
try {
|
||||
// 掩码密码回退:以数据库持久化值为准,内存单例不可靠(冷启动竞态/陈旧配置)
|
||||
let testPassword = body.smtpPassword
|
||||
if (testPassword === SMTP_PASSWORD_MASK) {
|
||||
const dbSettings = await getSystemSettingsCached()
|
||||
testPassword = dbSettings?.smtpPassword || ''
|
||||
}
|
||||
|
||||
if (!testPassword) {
|
||||
return {
|
||||
success: false,
|
||||
message: '未找到有效的SMTP密码,请重新填写授权码并保存配置'
|
||||
}
|
||||
}
|
||||
// 如果密码是掩码,则使用原始配置中的密码
|
||||
const testPassword =
|
||||
body.smtpPassword === '****************'
|
||||
? originalConfig?.auth?.pass || body.smtpPassword
|
||||
: body.smtpPassword
|
||||
|
||||
// 设置测试配置
|
||||
smtpService.smtpConfig = {
|
||||
|
||||
Reference in New Issue
Block a user