merge: 同步主线并解决用户侧验证冲突

This commit is contained in:
Entropy.Xu
2026-05-16 01:25:42 +08:00
349 changed files with 1737 additions and 73751 deletions

View File

@@ -0,0 +1,45 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
const { postMock } = vi.hoisted(() => ({
postMock: vi.fn(),
}))
vi.mock('@/api/client', () => ({
default: {
post: postMock,
},
}))
import { authApi } from '@/api/auth'
describe('authApi turnstile payloads', () => {
beforeEach(() => {
postMock.mockReset()
postMock.mockResolvedValue({ data: {} })
})
it('includes turnstile token when sending email verification code', async () => {
await authApi.sendVerificationCode('alice@example.com', 'turnstile-token')
expect(postMock).toHaveBeenCalledWith('/api/auth/send-verification-code', {
email: 'alice@example.com',
turnstile_token: 'turnstile-token',
})
})
it('includes turnstile token when registering', async () => {
await authApi.register({
email: 'alice@example.com',
username: 'alice',
password: 'secret123',
turnstile_token: 'turnstile-token',
})
expect(postMock).toHaveBeenCalledWith('/api/auth/register', {
email: 'alice@example.com',
username: 'alice',
password: 'secret123',
turnstile_token: 'turnstile-token',
})
})
})

View File

@@ -755,13 +755,13 @@ export const adminApi = {
async getSystemConfig(
key: string,
options: { cacheTtlMs?: number } = {},
): Promise<{ key: string; value: unknown }> {
): Promise<{ key: string; value: unknown; is_set?: boolean }> {
const cacheTtlMs = options.cacheTtlMs ?? 0
const cacheKey = buildCacheKey('admin:system:config', { key })
return cachedRequest(
cacheKey,
async () => {
const response = await apiClient.get<{ key: string; value: unknown }>(
const response = await apiClient.get<{ key: string; value: unknown; is_set?: boolean }>(
`/api/admin/system/configs/${key}`
)
return response.data

View File

@@ -85,6 +85,7 @@ export interface RegistrationSettingsResponse {
password_policy_level: string
turnstile_enabled?: boolean
turnstile_site_key?: string | null
turnstile_required_actions?: string[]
}
export interface AuthSettingsResponse {

View File

@@ -583,7 +583,6 @@ export interface PoolAdvancedConfig {
score_fallback_scan_limit?: number | null
score_rules?: PoolScoreRules | null
probing_enabled?: boolean
probing_interval_minutes?: number | null
// deprecated: retained only for backward-compatible reads
probing_target_percent?: number | null
// deprecated: retained only for backward-compatible reads