mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
- Updated router groups to utilize the new crawlab-team/fizz package for improved routing capabilities. - Refactored controller methods to accept Fizz router groups, enhancing consistency and maintainability. - Simplified route registration by incorporating OpenAPI metadata directly into group definitions. - Improved error handling and response generation in sync controller methods for better clarity. - Enhanced overall code structure by standardizing route definitions and improving parameter handling.
26 lines
594 B
Go
26 lines
594 B
Go
package controllers
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"github.com/crawlab-team/crawlab/core/utils"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func GetSyncScan(c *gin.Context) {
|
|
workspacePath := utils.GetWorkspace()
|
|
dirPath := filepath.Join(workspacePath, c.Param("id"), c.Param("path"))
|
|
files, err := utils.ScanDirectory(dirPath)
|
|
if err != nil {
|
|
HandleErrorInternalServerError(c, err)
|
|
return
|
|
}
|
|
HandleSuccessWithData(c, files)
|
|
}
|
|
|
|
func GetSyncDownload(c *gin.Context) {
|
|
workspacePath := utils.GetWorkspace()
|
|
filePath := filepath.Join(workspacePath, c.Param("id"), c.Param("path"))
|
|
c.File(filePath)
|
|
}
|