mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-20 00:18:55 +00:00
fix(channel-monitor-v2): 修复 CI gofmt 与 public settings 注入契约
对齐 gofmt,并在 PublicSettingsInjectionPayload 补齐 channel_monitor_mode, 使 SSR 注入字段与 dto.PublicSettings 一致,修复 schema drift 单测失败。
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user