完善半自动履约凭证与客户重新授权流程
统一虎牙和微博账号级 CK 保存与导出;CK 失效后回到客户重新登录,后台支持重发授权;客户授权页改为统一深色布局并收敛开发迁移配置。
This commit is contained in:
@@ -66,7 +66,6 @@ export function createDefaultRuntimeConfig(projectRoot: string): RuntimeConfig {
|
||||
connectorBaseUrl: '',
|
||||
connectorApiKey: '',
|
||||
connectorTimeoutMs: 15_000,
|
||||
credentialEncryptionKey: '',
|
||||
huya: {
|
||||
bindActId: 9271,
|
||||
outerActId: '17096',
|
||||
|
||||
@@ -55,7 +55,6 @@ export const ENV_OVERRIDES: readonly EnvOverride[] = [
|
||||
stringEnv('SEMI_AUTO_CONNECTOR_API_KEY', ['semiAuto', 'connectorApiKey']),
|
||||
integerEnv('SEMI_AUTO_CONNECTOR_TIMEOUT_MS', ['semiAuto', 'connectorTimeoutMs']),
|
||||
stringEnv('SEMI_AUTO_DEFAULT_CONNECTOR_MODE', ['semiAuto', 'defaultConnectorMode']),
|
||||
stringEnv('SEMI_AUTO_CREDENTIAL_ENCRYPTION_KEY', ['semiAuto', 'credentialEncryptionKey']),
|
||||
integerEnv('HUYA_BIND_ACT_ID', ['semiAuto', 'huya', 'bindActId']),
|
||||
stringEnv('HUYA_OUTER_ACT_ID', ['semiAuto', 'huya', 'outerActId']),
|
||||
stringEnv('HUYA_ROOM_PID', ['semiAuto', 'huya', 'roomPid']),
|
||||
|
||||
@@ -142,22 +142,6 @@ test('validateRuntimeConfig rejects unknown semi-auto connector mode', () => {
|
||||
)
|
||||
})
|
||||
|
||||
test('validateRuntimeConfig requires a strong semi-auto credential key in production', () => {
|
||||
const issues = validateRuntimeConfig(
|
||||
createRuntimeConfig({
|
||||
semiAuto: {
|
||||
credentialEncryptionKey: 'short-key',
|
||||
},
|
||||
}),
|
||||
{ env: { NODE_ENV: 'production' } },
|
||||
)
|
||||
|
||||
assert.deepEqual(
|
||||
issues.map((issue) => issue.path),
|
||||
['semiAuto.credentialEncryptionKey'],
|
||||
)
|
||||
})
|
||||
|
||||
test('assertRuntimeConfigValid throws a readable validation error', () => {
|
||||
assert.throws(
|
||||
() => {
|
||||
@@ -224,7 +208,6 @@ function createRuntimeConfig(overrides: Record<string, unknown> = {}): RuntimeCo
|
||||
connectorBaseUrl: '',
|
||||
connectorApiKey: '',
|
||||
connectorTimeoutMs: 15000,
|
||||
credentialEncryptionKey: '0123456789abcdef0123456789abcdef',
|
||||
huya: {
|
||||
bindActId: 9271,
|
||||
outerActId: '17096',
|
||||
|
||||
@@ -85,13 +85,6 @@ export function validateRuntimeConfig(
|
||||
message: '仅支持 embedded、external 或 mock',
|
||||
})
|
||||
}
|
||||
const credentialEncryptionKey = String(config.semiAuto?.credentialEncryptionKey || '').trim()
|
||||
if (!productionLike && credentialEncryptionKey && credentialEncryptionKey.length < 32) {
|
||||
issues.push({
|
||||
path: 'semiAuto.credentialEncryptionKey',
|
||||
message: '长度不能少于 32 个字符',
|
||||
})
|
||||
}
|
||||
requireOptionalInteger(
|
||||
issues,
|
||||
'semiAuto.connectorTimeoutMs',
|
||||
@@ -141,12 +134,6 @@ export function validateRuntimeConfig(
|
||||
}
|
||||
validateRequiredHttpUrl(issues, 'orders.claimBaseUrl', config.orders?.claimBaseUrl)
|
||||
validateSecret(issues, 'admin.sessionSecret', config.admin?.sessionSecret, { minLength: 32 })
|
||||
validateSecret(
|
||||
issues,
|
||||
'semiAuto.credentialEncryptionKey',
|
||||
config.semiAuto?.credentialEncryptionKey,
|
||||
{ minLength: 32 },
|
||||
)
|
||||
validateAdminDefaultUsers(issues, config.admin?.defaultUsers)
|
||||
const allowedOrigins = config.cors?.allowedOrigins
|
||||
if (Array.isArray(allowedOrigins)) {
|
||||
|
||||
Reference in New Issue
Block a user