Merge branch 'transfer-calendar' into development

This commit is contained in:
StarFleetCPTN committed 2025-04-19 06:25:32 -07:00
commit 98e20ea843
22 files changed
+1258 -95

No files matched your search

+3 -3
View File
@@ -37,7 +37,7 @@ func (h *Handlers) HandleGDriveAuth(c *gin.Context) {
}
// Ensure it's a Google Drive or Google Photos configuration
if config.SourceType != "gdrive" && config.DestinationType != "gdrive" && config.SourceType != "gphotos" && config.DestinationType != "gphotos" {
if config.SourceType != "drive" && config.DestinationType != "drive" && config.SourceType != "gphotos" && config.DestinationType != "gphotos" {
RenderErrorPage(c, "Not a Google configuration", "The selected configuration is not set up for Google Drive or Google Photos")
return
}
@@ -132,7 +132,7 @@ func (h *Handlers) HandleGDriveAuth(c *gin.Context) {
}
// Create a config file with redirect URI-based auth
configType := "gdrive"
configType := "drive"
if config.DestinationType == "gphotos" {
configType = "gphotos"
}
@@ -362,7 +362,7 @@ func (h *Handlers) HandleGDriveTokenProcess(c *gin.Context) {
}
// Ensure it's a Google Drive or Google Photos configuration
if config.SourceType != "gdrive" && config.DestinationType != "gdrive" && config.SourceType != "gphotos" && config.DestinationType != "gphotos" {
if config.SourceType != "drive" && config.DestinationType != "drive" && config.SourceType != "gphotos" && config.DestinationType != "gphotos" {
RenderErrorPage(c, "Not a Google Drive configuration", "")
return
}
+17
View File
@@ -42,6 +42,23 @@ func (h *Handlers) HandleJobs(c *gin.Context) {
components.Jobs(c, data).Render(c, c.Writer)
}
// HandleCalendarView handles the GET /calendar route
func (h *Handlers) HandleCalendarView(c *gin.Context) {
userID := c.GetUint("userID")
// Get all jobs with Next Run time for this user
var jobs []db.Job
h.DB.Where("created_by = ?", userID).Preload("Config").Find(&jobs)
// Prepare data for the calendar view
data := components.JobCalendarData{
Jobs: jobs,
}
// Render the calendar view
components.JobCalendar(c, data).Render(c, c.Writer)
}
// HandleJobRunDetails handles the GET /job/:id route
func (h *Handlers) HandleJobRunDetails(c *gin.Context) {
userID := c.GetUint("userID")
+4
View File
@@ -109,6 +109,10 @@ func (h *Handlers) RegisterRoutes(router *gin.Engine) {
authorized.POST("/jobs/:id/run", h.HandleRunJob)
authorized.GET("/history", h.HandleHistory)
authorized.GET("/job-runs/:id", h.HandleJobRunDetails)
// Calendar view route
authorized.GET("/calendar", h.HandleCalendarView)
authorized.GET("/profile", h.HandleProfile)
authorized.POST("/profile/theme", h.HandleUpdateTheme)
authorized.POST("/logout", h.HandleLogout)
@@ -39,7 +39,7 @@ func (h *Handlers) HandleStorageProviderGDriveAuth(c *gin.Context) {
}
// Ensure it's a Google Drive or Google Photos provider
if provider.Type != "gdrive" && provider.Type != "gphotos" {
if provider.Type != "drive" && provider.Type != "gphotos" {
RenderErrorPage(c, "Not a Google provider", "The selected provider is not set up for Google Drive or Google Photos")
return
}
@@ -113,7 +113,7 @@ func (h *Handlers) HandleStorageProviderGDriveAuth(c *gin.Context) {
}
// Create a config file with redirect URI-based auth
configType := "gdrive"
configType := "drive"
if provider.Type == "gphotos" {
configType = "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 != "gdrive" && provider.Type != "gphotos" {
if provider.Type != "drive" && 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 != "gdrive" && provider.Type != "gphotos" {
if provider.Type != "drive" && 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 == "gdrive" {
serviceType = "gdrive"
if provider.Type == "drive" {
serviceType = "drive"
} 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, "gdrive": 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, "drive": 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,
"gdrive": true,
"drive": true,
"gphotos": true,
"hetzner": true,
"local": true,