Update provider type from "drive" to "gdrive" across codebase for Google Drive storage

This commit is contained in:
StarFleetCPTN
2025-04-18 21:12:47 -07:00
parent d9cb1cac03
commit 6e8fe9ad72
9 changed files with 34 additions and 34 deletions
+1 -1
View File
@@ -161,7 +161,7 @@ templ formFields(data StorageProviderFormData) {
selected="selected"
}
>OneDrive</option>
<option value="drive"
<option value="gdrive"
if data.Provider.Type == db.ProviderTypeGoogleDrive {
selected="selected"
}
+4 -4
View File
@@ -493,11 +493,11 @@ templ StorageProviders_ProvidersList(providers []db.StorageProvider) {
Region: { provider.Region }
</p>
}
} else if provider.Type == "drive" || provider.Type == "gphotos" {
} else if provider.Type == "gdrive" || provider.Type == "gphotos" {
<p class="flex items-center text-sm text-gray-500 dark:text-gray-400">
<i class="fab fa-google-drive w-4 h-4 mr-1.5 text-gray-400 dark:text-gray-500"></i>
Google
if provider.Type == "drive" {
if provider.Type == "gdrive" {
Drive
} else {
Photos
@@ -611,13 +611,13 @@ templ StorageProviders_ProvidersList(providers []db.StorageProvider) {
</div>
<!-- Authentication Notice (More Visible) -->
if (provider.Type == "drive" || provider.Type == "gphotos") && (provider.Authenticated == nil || !*provider.Authenticated) {
if (provider.Type == "gdrive" || provider.Type == "gphotos") && (provider.Authenticated == nil || !*provider.Authenticated) {
<div class="mt-3 flex items-center justify-between bg-yellow-50 dark:bg-yellow-900/30 rounded-lg p-3 border border-yellow-200 dark:border-yellow-800">
<div class="flex items-center">
<i class="fas fa-exclamation-triangle text-yellow-500 w-5 h-5 mr-2"></i>
<span class="text-sm text-yellow-700 dark:text-yellow-300">
Authentication required for Google
if provider.Type == "drive" {
if provider.Type == "gdrive" {
Drive
} else {
Photos
+1 -1
View File
@@ -230,7 +230,7 @@ templ RcloneImportPreviewContent(ctx context.Context, preview RcloneImportPrevie
}
<!-- OAuth credentials -->
if remote.Type == "drive" || remote.Type == "onedrive" || remote.Type == "gphotos" {
if remote.Type == "gdrive" || remote.Type == "onedrive" || remote.Type == "gphotos" {
<!-- Client ID -->
if _, exists := remote.Fields["client_id"]; !exists {
<div class="flex items-center gap-2">
+1 -1
View File
@@ -13,7 +13,7 @@ const (
ProviderTypeSFTP StorageProviderType = "sftp"
ProviderTypeS3 StorageProviderType = "s3"
ProviderTypeOneDrive StorageProviderType = "onedrive"
ProviderTypeGoogleDrive StorageProviderType = "drive"
ProviderTypeGoogleDrive StorageProviderType = "gdrive"
ProviderTypeGooglePhoto StorageProviderType = "gphotos"
ProviderTypeFTP StorageProviderType = "ftp"
ProviderTypeSMB StorageProviderType = "smb"
+2 -2
View File
@@ -465,7 +465,7 @@ func (db *DB) GenerateRcloneConfig(config *TransferConfig) error {
if err := os.WriteFile(configPath, []byte(content), 0600); err != nil {
return fmt.Errorf("failed to write source config (local): %v", err)
}
case "drive":
case "gdrive":
// For Google Drive, we need client ID and secret
clientID := getStringValue(sourceCredentials, "client_id", config.SourceClientID)
@@ -1018,7 +1018,7 @@ func (db *DB) GenerateRcloneConfig(config *TransferConfig) error {
if _, err := f.WriteString(content); err != nil {
return fmt.Errorf("failed to write destination config (local): %v", err)
}
case "drive":
case "gdrive":
// For Google Drive, we need client ID and secret
clientID := getStringValue(destCredentials, "client_id", config.DestClientID)
+2 -2
View File
@@ -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"
}
@@ -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)
@@ -426,7 +426,7 @@ func TestInputValidation(t *testing.T) {
"ftp": true,
"smb": true,
"onedrive": true,
"drive": true,
"gdrive": true,
"gphotos": true,
"hetzner": true,
"local": true,