新增功能: - 新增 Sora 账号管理和 OAuth 认证 - 新增 Sora 视频/图片生成 API 网关 - 新增 Sora 任务调度和缓存机制 - 新增 Sora 使用统计和计费支持 - 前端增加 Sora 平台配置界面 安全修复(代码审核): - [SEC-001] 限制媒体下载响应体大小(图片 20MB、视频 200MB),防止 DoS 攻击 - [SEC-002] 限制 SDK API 响应大小(1MB),防止内存耗尽 - [SEC-003] 修复 SSRF 风险,添加 URL 验证并强制使用代理配置 BUG 修复(代码审核): - [BUG-001] 修复 for 循环内 defer 累积导致的资源泄漏 - [BUG-002] 修复图片并发槽位获取失败时已持有锁未释放的永久泄漏 性能优化(代码审核): - [PERF-001] 添加 Sentinel Token 缓存(3 分钟有效期),减少 PoW 计算开销 技术细节: - 使用 io.LimitReader 限制所有外部输入的大小 - 添加 urlvalidator 验证防止 SSRF 攻击 - 使用 sync.Map 实现线程安全的包级缓存 - 优化并发槽位管理,添加 releaseAll 模式防止泄漏 影响范围: - 后端:新增 Sora 相关数据模型、服务、网关和管理接口 - 前端:新增 Sora 平台配置、账号管理和监控界面 - 配置:新增 Sora 相关配置项和环境变量 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
101 lines
5.0 KiB
Go
101 lines
5.0 KiB
Go
package dto
|
|
|
|
// SystemSettings represents the admin settings API response payload.
|
|
type SystemSettings struct {
|
|
RegistrationEnabled bool `json:"registration_enabled"`
|
|
EmailVerifyEnabled bool `json:"email_verify_enabled"`
|
|
PromoCodeEnabled bool `json:"promo_code_enabled"`
|
|
|
|
SMTPHost string `json:"smtp_host"`
|
|
SMTPPort int `json:"smtp_port"`
|
|
SMTPUsername string `json:"smtp_username"`
|
|
SMTPPasswordConfigured bool `json:"smtp_password_configured"`
|
|
SMTPFrom string `json:"smtp_from_email"`
|
|
SMTPFromName string `json:"smtp_from_name"`
|
|
SMTPUseTLS bool `json:"smtp_use_tls"`
|
|
|
|
TurnstileEnabled bool `json:"turnstile_enabled"`
|
|
TurnstileSiteKey string `json:"turnstile_site_key"`
|
|
TurnstileSecretKeyConfigured bool `json:"turnstile_secret_key_configured"`
|
|
|
|
LinuxDoConnectEnabled bool `json:"linuxdo_connect_enabled"`
|
|
LinuxDoConnectClientID string `json:"linuxdo_connect_client_id"`
|
|
LinuxDoConnectClientSecretConfigured bool `json:"linuxdo_connect_client_secret_configured"`
|
|
LinuxDoConnectRedirectURL string `json:"linuxdo_connect_redirect_url"`
|
|
|
|
SiteName string `json:"site_name"`
|
|
SiteLogo string `json:"site_logo"`
|
|
SiteSubtitle string `json:"site_subtitle"`
|
|
APIBaseURL string `json:"api_base_url"`
|
|
ContactInfo string `json:"contact_info"`
|
|
DocURL string `json:"doc_url"`
|
|
HomeContent string `json:"home_content"`
|
|
HideCcsImportButton bool `json:"hide_ccs_import_button"`
|
|
|
|
DefaultConcurrency int `json:"default_concurrency"`
|
|
DefaultBalance float64 `json:"default_balance"`
|
|
|
|
// Model fallback configuration
|
|
EnableModelFallback bool `json:"enable_model_fallback"`
|
|
FallbackModelAnthropic string `json:"fallback_model_anthropic"`
|
|
FallbackModelOpenAI string `json:"fallback_model_openai"`
|
|
FallbackModelGemini string `json:"fallback_model_gemini"`
|
|
FallbackModelAntigravity string `json:"fallback_model_antigravity"`
|
|
|
|
// Identity patch configuration (Claude -> Gemini)
|
|
EnableIdentityPatch bool `json:"enable_identity_patch"`
|
|
IdentityPatchPrompt string `json:"identity_patch_prompt"`
|
|
|
|
// Sora configuration
|
|
SoraBaseURL string `json:"sora_base_url"`
|
|
SoraTimeout int `json:"sora_timeout"`
|
|
SoraMaxRetries int `json:"sora_max_retries"`
|
|
SoraPollInterval float64 `json:"sora_poll_interval"`
|
|
SoraCallLogicMode string `json:"sora_call_logic_mode"`
|
|
SoraCacheEnabled bool `json:"sora_cache_enabled"`
|
|
SoraCacheBaseDir string `json:"sora_cache_base_dir"`
|
|
SoraCacheVideoDir string `json:"sora_cache_video_dir"`
|
|
SoraCacheMaxBytes int64 `json:"sora_cache_max_bytes"`
|
|
SoraCacheAllowedHosts []string `json:"sora_cache_allowed_hosts"`
|
|
SoraCacheUserDirEnabled bool `json:"sora_cache_user_dir_enabled"`
|
|
SoraWatermarkFreeEnabled bool `json:"sora_watermark_free_enabled"`
|
|
SoraWatermarkFreeParseMethod string `json:"sora_watermark_free_parse_method"`
|
|
SoraWatermarkFreeCustomParseURL string `json:"sora_watermark_free_custom_parse_url"`
|
|
SoraWatermarkFreeCustomParseToken string `json:"sora_watermark_free_custom_parse_token"`
|
|
SoraWatermarkFreeFallbackOnFailure bool `json:"sora_watermark_free_fallback_on_failure"`
|
|
SoraTokenRefreshEnabled bool `json:"sora_token_refresh_enabled"`
|
|
|
|
// Ops monitoring (vNext)
|
|
OpsMonitoringEnabled bool `json:"ops_monitoring_enabled"`
|
|
OpsRealtimeMonitoringEnabled bool `json:"ops_realtime_monitoring_enabled"`
|
|
OpsQueryModeDefault string `json:"ops_query_mode_default"`
|
|
OpsMetricsIntervalSeconds int `json:"ops_metrics_interval_seconds"`
|
|
}
|
|
|
|
type PublicSettings struct {
|
|
RegistrationEnabled bool `json:"registration_enabled"`
|
|
EmailVerifyEnabled bool `json:"email_verify_enabled"`
|
|
PromoCodeEnabled bool `json:"promo_code_enabled"`
|
|
TurnstileEnabled bool `json:"turnstile_enabled"`
|
|
TurnstileSiteKey string `json:"turnstile_site_key"`
|
|
SiteName string `json:"site_name"`
|
|
SiteLogo string `json:"site_logo"`
|
|
SiteSubtitle string `json:"site_subtitle"`
|
|
APIBaseURL string `json:"api_base_url"`
|
|
ContactInfo string `json:"contact_info"`
|
|
DocURL string `json:"doc_url"`
|
|
HomeContent string `json:"home_content"`
|
|
HideCcsImportButton bool `json:"hide_ccs_import_button"`
|
|
LinuxDoOAuthEnabled bool `json:"linuxdo_oauth_enabled"`
|
|
Version string `json:"version"`
|
|
}
|
|
|
|
// StreamTimeoutSettings 流超时处理配置 DTO
|
|
type StreamTimeoutSettings struct {
|
|
Enabled bool `json:"enabled"`
|
|
Action string `json:"action"`
|
|
TempUnschedMinutes int `json:"temp_unsched_minutes"`
|
|
ThresholdCount int `json:"threshold_count"`
|
|
ThresholdWindowMinutes int `json:"threshold_window_minutes"`
|
|
}
|