diff --git a/backend/internal/service/channel_monitor_v2_test.go b/backend/internal/service/channel_monitor_v2_test.go index 42d33109ac..8407946aed 100644 --- a/backend/internal/service/channel_monitor_v2_test.go +++ b/backend/internal/service/channel_monitor_v2_test.go @@ -10,13 +10,13 @@ import ( ) type channelMonitorV2RepoStub struct { - config serviceChannelMonitorV2ConfigAlias - users *ChannelMonitorV2List[ChannelMonitorV2UserRow] - matrix *ChannelMonitorV2Matrix - errors *ChannelMonitorV2List[ChannelMonitorV2ErrorRow] - snap *ChannelMonitorV2Snapshot - group ChannelMonitorV2GroupBy - admin bool + config serviceChannelMonitorV2ConfigAlias + users *ChannelMonitorV2List[ChannelMonitorV2UserRow] + matrix *ChannelMonitorV2Matrix + errors *ChannelMonitorV2List[ChannelMonitorV2ErrorRow] + snap *ChannelMonitorV2Snapshot + group ChannelMonitorV2GroupBy + admin bool } // Alias keeps composite literals readable without introducing another package. diff --git a/backend/internal/service/setting_public.go b/backend/internal/service/setting_public.go index d3c583ef12..53853d9be5 100644 --- a/backend/internal/service/setting_public.go +++ b/backend/internal/service/setting_public.go @@ -595,17 +595,18 @@ type PublicSettingsInjectionPayload struct { // Feature flags — MUST match the opt-in/opt-out registry in // frontend/src/utils/featureFlags.ts. Missing a field here is the bug // that hid the "可用渠道" menu on page refresh. - ChannelMonitorEnabled bool `json:"channel_monitor_enabled"` - ChannelMonitorDefaultIntervalSeconds int `json:"channel_monitor_default_interval_seconds"` + ChannelMonitorEnabled bool `json:"channel_monitor_enabled"` + ChannelMonitorMode string `json:"channel_monitor_mode"` + ChannelMonitorDefaultIntervalSeconds int `json:"channel_monitor_default_interval_seconds"` // ChannelMonitorHideThroughput is public so the user UI can hide RPM/TPM // without waiting for API redaction alone (defense in depth). ChannelMonitorHideThroughput bool `json:"channel_monitor_hide_throughput"` AvailableChannelsEnabled bool `json:"available_channels_enabled"` - ModelPlazaEnabled bool `json:"model_plaza_enabled"` - ModelPlazaRequireAuth bool `json:"model_plaza_require_auth"` - AffiliateEnabled bool `json:"affiliate_enabled"` - RiskControlEnabled bool `json:"risk_control_enabled"` - AllowUserViewErrorRequests bool `json:"allow_user_view_error_requests"` + ModelPlazaEnabled bool `json:"model_plaza_enabled"` + ModelPlazaRequireAuth bool `json:"model_plaza_require_auth"` + AffiliateEnabled bool `json:"affiliate_enabled"` + RiskControlEnabled bool `json:"risk_control_enabled"` + AllowUserViewErrorRequests bool `json:"allow_user_view_error_requests"` } // GetPublicSettingsForInjection returns public settings in a format suitable for HTML injection. @@ -675,6 +676,7 @@ func (s *SettingService) GetPublicSettingsForInjection(ctx context.Context) (any BalanceLowNotifyRechargeURL: settings.BalanceLowNotifyRechargeURL, ChannelMonitorEnabled: settings.ChannelMonitorEnabled, + ChannelMonitorMode: settings.ChannelMonitorMode, ChannelMonitorDefaultIntervalSeconds: settings.ChannelMonitorDefaultIntervalSeconds, ChannelMonitorHideThroughput: settings.ChannelMonitorHideThroughput, AvailableChannelsEnabled: settings.AvailableChannelsEnabled, diff --git a/backend/internal/service/wire.go b/backend/internal/service/wire.go index 9b384941ef..5b112a539a 100644 --- a/backend/internal/service/wire.go +++ b/backend/internal/service/wire.go @@ -1,9 +1,9 @@ package service import ( - "os" "context" "database/sql" + "os" "time" dbent "github.com/Wei-Shaw/sub2api/ent" @@ -916,7 +916,6 @@ func ProvideChannelMonitorRunner(svc *ChannelMonitorService, settingService *Set return r } - // ProvideChannelMonitorV2Service wires settings for user-facing privacy flags // (e.g. hide RPM/TPM throughput). func ProvideChannelMonitorV2Service(repo ChannelMonitorV2Repository, settingService *SettingService) *ChannelMonitorV2Service {