mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
fix: resolve remaining gofmt alignment and deprecated API issues
- Fix struct tag alignment in dto/types.go (AffinityClientCount) - Fix struct literal alignment in sora_generation_service.go - Replace deprecated google.CredentialsFromJSONWithParams with option.WithCredentialsJSON for service account auth (SA1019) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -193,7 +193,7 @@ type Account struct {
|
||||
ClientAffinityEnabled *bool `json:"client_affinity_enabled,omitempty"`
|
||||
|
||||
// 亲和客户端数据(仅 admin 列表端点注入,不由 mapper 填充)
|
||||
AffinityClientCount *int64 `json:"affinity_client_count,omitempty"`
|
||||
AffinityClientCount *int64 `json:"affinity_client_count,omitempty"`
|
||||
AffinityClients []string `json:"affinity_clients,omitempty"`
|
||||
|
||||
// API Key 账号配额限制
|
||||
|
||||
@@ -153,13 +153,7 @@ func (s *SoraGDriveStorage) buildOAuth2Service(ctx context.Context, profile *Sor
|
||||
}
|
||||
|
||||
func (s *SoraGDriveStorage) buildServiceAccountService(ctx context.Context, profile *SoraS3Profile) (*drive.Service, error) {
|
||||
creds, err := google.CredentialsFromJSONWithParams(ctx, []byte(profile.ServiceAccountJSON), google.CredentialsParams{
|
||||
Scopes: []string{drive.DriveFileScope},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parse service account json: %w", err)
|
||||
}
|
||||
srv, err := drive.NewService(ctx, option.WithCredentials(creds))
|
||||
srv, err := drive.NewService(ctx, option.WithCredentialsJSON([]byte(profile.ServiceAccountJSON)))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("create gdrive service account service: %w", err)
|
||||
}
|
||||
|
||||
@@ -47,9 +47,9 @@ func NewSoraGenerationService(
|
||||
quotaService *SoraQuotaService,
|
||||
) *SoraGenerationService {
|
||||
return &SoraGenerationService{
|
||||
genRepo: genRepo,
|
||||
objectStorage: objectStorage,
|
||||
quotaService: quotaService,
|
||||
genRepo: genRepo,
|
||||
objectStorage: objectStorage,
|
||||
quotaService: quotaService,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user