mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
31 lines
666 B
Go
31 lines
666 B
Go
package controllers
|
|
|
|
import (
|
|
"github.com/crawlab-team/crawlab/core/utils"
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
"path/filepath"
|
|
)
|
|
|
|
func GetSyncScan(c *gin.Context) {
|
|
id := c.Param("id")
|
|
path := c.Query("path")
|
|
|
|
workspacePath := utils.GetWorkspace()
|
|
dirPath := filepath.Join(workspacePath, id, path)
|
|
files, err := utils.ScanDirectory(dirPath)
|
|
if err != nil {
|
|
HandleErrorInternalServerError(c, err)
|
|
return
|
|
}
|
|
c.AbortWithStatusJSON(http.StatusOK, files)
|
|
}
|
|
|
|
func GetSyncDownload(c *gin.Context) {
|
|
id := c.Param("id")
|
|
path := c.Query("path")
|
|
workspacePath := utils.GetWorkspace()
|
|
filePath := filepath.Join(workspacePath, id, path)
|
|
c.File(filePath)
|
|
}
|