mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-20 15:06:36 +00:00
feat(sora): add Google Drive storage backend with unified storage abstraction
- Define SoraObjectStorage interface abstracting S3 and GDrive backends - Implement SoraGDriveStorage with OAuth2 and Service Account auth - Add SoraStorageRouter to route requests based on active profile provider - Add GDrive OAuth handler for authorization flow (start + callback) - Extend profile model with provider, auth_type, and GDrive-specific fields - Update frontend UI with provider selection, dynamic form fields, and i18n - Migrate API paths from /sora-s3 to /sora-storage (old paths preserved) - All existing S3 functionality remains backward compatible Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
a9ecd7bcc6
commit
ad54040c07
26 files changed
+1711
-280
No files matched your search
@@ -124,6 +124,8 @@ type SoraS3Profile struct {
|
||||
ProfileID string `json:"profile_id"`
|
||||
Name string `json:"name"`
|
||||
IsActive bool `json:"is_active"`
|
||||
Provider string `json:"provider"` // "s3" / "gdrive",空值视为 "s3"
|
||||
AccessMode string `json:"access_mode"` // "direct" / "proxy",空值视为 "direct"
|
||||
Enabled bool `json:"enabled"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
Region string `json:"region"`
|
||||
@@ -136,6 +138,25 @@ type SoraS3Profile struct {
|
||||
CDNURL string `json:"cdn_url"`
|
||||
DefaultStorageQuotaBytes int64 `json:"default_storage_quota_bytes"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
|
||||
// --- Google Drive 专属 ---
|
||||
AuthType string `json:"auth_type,omitempty"` // "oauth2" / "service_account"
|
||||
ClientID string `json:"client_id,omitempty"`
|
||||
ClientSecret string `json:"-"`
|
||||
ClientSecretConfigured bool `json:"client_secret_configured"`
|
||||
RefreshToken string `json:"-"`
|
||||
RefreshTokenConfigured bool `json:"refresh_token_configured"`
|
||||
ServiceAccountJSON string `json:"-"`
|
||||
ServiceAccountConfigured bool `json:"service_account_configured"`
|
||||
FolderID string `json:"folder_id,omitempty"`
|
||||
}
|
||||
|
||||
// GetProvider 返回 Provider,空值视为 "s3"。
|
||||
func (p *SoraS3Profile) GetProvider() string {
|
||||
if p.Provider == "" {
|
||||
return SoraStorageTypeS3
|
||||
}
|
||||
return p.Provider
|
||||
}
|
||||
|
||||
// SoraS3ProfileList Sora S3 多配置列表
|
||||
|
||||
Reference in new issue
Block a user