feat: added multi-spider in git

https://github.com/crawlab-team/crawlab/issues/1485
This commit is contained in:
Marvin Zhang
2024-06-28 18:52:49 +08:00
parent 68888107a0
commit 0b3fbcfed8
3 changed files with 33 additions and 9 deletions

View File

@@ -560,7 +560,8 @@ func PostSpiderSaveFiles(c *gin.Context) {
HandleErrorForbidden(c, err)
return
}
PostBaseFileSaveFiles(rootPath, c)
targetDirectory := c.PostForm("targetDirectory")
PostBaseFileSaveFiles(filepath.Join(rootPath, targetDirectory), c)
}
func PostSpiderSaveDir(c *gin.Context) {
@@ -723,10 +724,6 @@ func getSpiderFsSvc(s *models.SpiderV2) (svc interfaces.FsServiceV2, err error)
return fsSvc, nil
}
func GetSpiderFsSvcById(id primitive.ObjectID) (svc interfaces.FsServiceV2, err error) {
return getSpiderFsSvcById(id)
}
func getSpiderFsSvcById(id primitive.ObjectID) (svc interfaces.FsServiceV2, err error) {
s, err := service.NewModelServiceV2[models.SpiderV2]().GetById(id)
if err != nil {
@@ -803,5 +800,5 @@ func getSpiderRootPath(c *gin.Context) (rootPath string, err error) {
return id.Hex(), nil
}
return filepath.Join(s.GitId.Hex(), rootPath), nil
return filepath.Join(s.GitId.Hex(), s.GitRootPath), nil
}

View File

@@ -25,7 +25,7 @@ require (
github.com/emirpasic/gods v1.18.1
github.com/fsnotify/fsnotify v1.7.0
github.com/gavv/httpexpect/v2 v2.16.0
github.com/gin-gonic/gin v1.9.1
github.com/gin-gonic/gin v1.10.0
github.com/go-git/go-git/v5 v5.12.0
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/uuid v1.6.0