实现内置虎牙扫码登录与绑定 Connector

This commit is contained in:
yml2213
2026-11-09 17:11:01 +08:00
parent b0b8e983ba
commit a9937ef8c6
41 changed files with 4246 additions and 152 deletions
@@ -0,0 +1,21 @@
import { isProductionLike } from '../../config/runtime-validation.js'
import { createHttpError } from '../../utils/http.js'
export function isDevMockEnabled(env: NodeJS.ProcessEnv = process.env): boolean {
const flag = String(env.ENABLE_DEV_MOCK || '')
.trim()
.toLowerCase()
if (flag === '1' || flag === 'true') {
return true
}
return !isProductionLike(env)
}
export function assertDevMockEnabled() {
if (!isDevMockEnabled()) {
throw createHttpError('当前环境未开启开发 Mock(仅非 production 或 ENABLE_DEV_MOCK=1)', {
statusCode: 403,
errorCode: 'dev_mock_disabled',
})
}
}