59 lines
1.2 KiB
TypeScript
59 lines
1.2 KiB
TypeScript
|
|
/**
|
||
|
|
* 系统设置服务
|
||
|
|
*
|
||
|
|
* 提供系统设置 API 调用
|
||
|
|
*/
|
||
|
|
|
||
|
|
import { get } from '@/lib/http/client'
|
||
|
|
|
||
|
|
export interface SystemInfo {
|
||
|
|
name: string
|
||
|
|
version: string
|
||
|
|
environment: string
|
||
|
|
description: string
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface SecurityInfo {
|
||
|
|
password_min_length: number
|
||
|
|
password_require_uppercase: boolean
|
||
|
|
password_require_lowercase: boolean
|
||
|
|
password_require_numbers: boolean
|
||
|
|
password_require_symbols: boolean
|
||
|
|
password_history: number
|
||
|
|
totp_enabled: boolean
|
||
|
|
login_fail_lock: boolean
|
||
|
|
login_fail_threshold: number
|
||
|
|
login_fail_duration: number
|
||
|
|
session_timeout: number
|
||
|
|
device_trust_duration: number
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface FeaturesInfo {
|
||
|
|
email_verification: boolean
|
||
|
|
phone_verification: boolean
|
||
|
|
oauth_providers: string[]
|
||
|
|
sso_enabled: boolean
|
||
|
|
operation_log_enabled: boolean
|
||
|
|
login_log_enabled: boolean
|
||
|
|
data_export_enabled: boolean
|
||
|
|
data_import_enabled: boolean
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface SystemSettings {
|
||
|
|
system: SystemInfo
|
||
|
|
security: SecurityInfo
|
||
|
|
features: FeaturesInfo
|
||
|
|
}
|
||
|
|
|
||
|
|
interface SettingsResponse {
|
||
|
|
data: SystemSettings
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取系统设置
|
||
|
|
* GET /api/v1/admin/settings
|
||
|
|
*/
|
||
|
|
export function getSettings(): Promise<SystemSettings> {
|
||
|
|
return get<SettingsResponse>('/admin/settings').then(res => res.data)
|
||
|
|
}
|