Skip to content

Commit ed3f76a

Browse files
committed
[FIX](web) 修改api路径&重复文件不上传
1 parent 2adff36 commit ed3f76a

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

internal/ssh/sftp.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ func (m *Manager) UploadFileOneAsync(c *transport.Client, fileH *multipart.FileH
8181
}()
8282

8383
key := fmt.Sprintf("%s/%s", addr, filename)
84-
m.fileList.Store(key, task)
84+
if _, ok := m.fileList.Load(key); !ok {
85+
m.fileList.Store(key, task)
86+
}
8587

8688
go m.manageChannel(ch, key)
8789

internal/web/router.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@ func (s *Service) InitRouter() *Service {
139139
apiV1.POST("/job/start", s.StartJob)
140140
apiV1.POST("/job/stop", s.StopJob)
141141
apiV1.POST("/job/restart", s.RestartJob)
142+
143+
// tools
144+
apiV1.GET("/tools/cmd", s.RunCmd)
145+
apiV1.GET("/tools/browse", s.GetPathInfo)
146+
apiV1.GET("/tools/download", s.DownLoadFile)
147+
apiV1.POST("/tools/delete", s.DeleteFile)
148+
apiV1.GET("/tools/export", s.ExportData)
149+
apiV1.POST("/tools/import", s.ImportData)
150+
apiV1.POST("/tools/upload_file", s.FileUploadUnBlock)
142151
}
143152
s.engine = r
144153
return s

0 commit comments

Comments
 (0)