mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-10-14 10:08:16 +02:00
Update provider type from "drive" to "gdrive" across codebase for Google Drive storage
This commit is contained in:
1 parent
d9cb1cac03
commit
6e8fe9ad72
9 files changed
+34
-34
No files matched your search
@@ -132,9 +132,9 @@ func (h *Handlers) HandleGDriveAuth(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Create a config file with redirect URI-based auth
|
||||
configType := "drive"
|
||||
configType := "gdrive"
|
||||
if config.DestinationType == "gphotos" {
|
||||
configType = "google photos"
|
||||
configType = "gphotos"
|
||||
}
|
||||
|
||||
configContent := fmt.Sprintf(`[temp_%s]
|
||||
|
||||
@@ -39,7 +39,7 @@ func (h *Handlers) HandleStorageProviderGDriveAuth(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Ensure it's a Google Drive or Google Photos provider
|
||||
if provider.Type != "drive" && provider.Type != "gphotos" {
|
||||
if provider.Type != "gdrive" && provider.Type != "gphotos" {
|
||||
RenderErrorPage(c, "Not a Google provider", "The selected provider is not set up for Google Drive or Google Photos")
|
||||
return
|
||||
}
|
||||
@@ -113,14 +113,14 @@ func (h *Handlers) HandleStorageProviderGDriveAuth(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Create a config file with redirect URI-based auth
|
||||
configType := "drive"
|
||||
if provider.Type == "google_photo" {
|
||||
configType = "google photos"
|
||||
configType := "gdrive"
|
||||
if provider.Type == "gphotos" {
|
||||
configType = "gphotos"
|
||||
}
|
||||
|
||||
// Use a standardized name for the rclone config section
|
||||
configSection := "temp_drive"
|
||||
if provider.Type == "google_photo" {
|
||||
configSection := "temp_gdrive"
|
||||
if provider.Type == "gphotos" {
|
||||
configSection = "temp_gphotos"
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ func (h *Handlers) HandleStorageProviderGDriveTokenProcess(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Ensure it's a Google Drive or Google Photos provider
|
||||
if provider.Type != "drive" && provider.Type != "gphotos" {
|
||||
if provider.Type != "gdrive" && provider.Type != "gphotos" {
|
||||
RenderErrorPage(c, "Not a Google provider", "")
|
||||
return
|
||||
}
|
||||
@@ -378,15 +378,15 @@ func (h *Handlers) HandleStorageProviderGDriveHeadlessAuth(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Ensure it's a Google Drive or Google Photos provider
|
||||
if provider.Type != "drive" && provider.Type != "gphotos" {
|
||||
if provider.Type != "gdrive" && provider.Type != "gphotos" {
|
||||
RenderErrorPage(c, "Not a Google provider", "The selected provider is not set up for Google Drive or Google Photos")
|
||||
return
|
||||
}
|
||||
|
||||
// Determine which Google service we're authenticating with
|
||||
var serviceType string
|
||||
if provider.Type == "drive" {
|
||||
serviceType = "drive"
|
||||
if provider.Type == "gdrive" {
|
||||
serviceType = "gdrive"
|
||||
} else {
|
||||
serviceType = "gphotos"
|
||||
}
|
||||
|
||||
@@ -683,7 +683,7 @@ func (h *Handlers) HandleStorageProvidersImportConfirm(c *gin.Context) {
|
||||
|
||||
// Create template context
|
||||
ctx := components.CreateTemplateContext(c)
|
||||
|
||||
|
||||
// Prepare result message
|
||||
if c.GetHeader("HX-Request") == "true" {
|
||||
var resultHTML string
|
||||
@@ -794,8 +794,8 @@ func (h *Handlers) HandleImportRcloneConfig(c *gin.Context) {
|
||||
continue
|
||||
}
|
||||
// Log that we're handling already encrypted values from rclone
|
||||
if provider.EncryptedPassword != "" || provider.EncryptedSecretKey != "" ||
|
||||
provider.EncryptedClientSecret != "" || provider.EncryptedRefreshToken != "" {
|
||||
if provider.EncryptedPassword != "" || provider.EncryptedSecretKey != "" ||
|
||||
provider.EncryptedClientSecret != "" || provider.EncryptedRefreshToken != "" {
|
||||
log.Printf("Processing provider %s with pre-encrypted values from rclone", provider.Name)
|
||||
}
|
||||
|
||||
@@ -898,7 +898,7 @@ func storageProviderFromRcloneSection(name string, section map[string]string, us
|
||||
}
|
||||
// Optionally: you can check for known types and set generic if not recognized
|
||||
knownTypes := map[string]bool{
|
||||
"sftp": true, "s3": true, "onedrive": true, "drive": true, "gphotos": true, "ftp": true, "smb": true, "hetzner": true, "local": true, "webdav": true, "nextcloud": true, "b2": true, "wasabi": true, "minio": true,
|
||||
"sftp": true, "s3": true, "onedrive": true, "gdrive": true, "gphotos": true, "ftp": true, "smb": true, "hetzner": true, "local": true, "webdav": true, "nextcloud": true, "b2": true, "wasabi": true, "minio": true,
|
||||
}
|
||||
if !knownTypes[providerType] {
|
||||
providerType = string(db.ProviderTypeGeneric)
|
||||
|
||||
@@ -421,15 +421,15 @@ func TestInputValidation(t *testing.T) {
|
||||
|
||||
// Validate type is one of the allowed values
|
||||
validTypes := map[string]bool{
|
||||
"s3": true,
|
||||
"sftp": true,
|
||||
"ftp": true,
|
||||
"smb": true,
|
||||
"onedrive": true,
|
||||
"drive": true,
|
||||
"gphotos": true,
|
||||
"hetzner": true,
|
||||
"local": true,
|
||||
"s3": true,
|
||||
"sftp": true,
|
||||
"ftp": true,
|
||||
"smb": true,
|
||||
"onedrive": true,
|
||||
"gdrive": true,
|
||||
"gphotos": true,
|
||||
"hetzner": true,
|
||||
"local": true,
|
||||
}
|
||||
|
||||
if !validTypes[providerType] {
|
||||
|
||||
Reference in new issue
Block a user