ftp support

This commit is contained in:
微凉
2021-12-16 18:03:58 +08:00
parent 92a0453e00
commit d49f92b542
9 changed files with 294 additions and 7 deletions

View File

@ -68,6 +68,10 @@ func Proxy(c *gin.Context) {
common.ErrorResp(c, err, 500)
return
}
// 本机读取数据
if account.Type == "FTP" {
c.Data(http.StatusOK, "application/octet-stream", link.Data)
}
// 本机文件直接返回文件
if account.Type == "Native" {
// 对于名称为index.html的文件需要特殊处理

View File

@ -88,20 +88,20 @@ func Link(c *gin.Context) {
common.ErrorResp(c, err, 500)
return
}
link, err := driver.Link(path, account)
if err != nil {
common.ErrorResp(c, err, 500)
return
}
if driver.Config().NoLink {
common.SuccessResp(c, base.Link{
Url: fmt.Sprintf("//%s/d%s?d=1&sign=%s", c.Request.Host, req.Path, utils.SignWithToken(utils.Base(rawPath), conf.Token)),
})
return
} else {
common.SuccessResp(c, link)
}
link, err := driver.Link(path, account)
if err != nil {
common.ErrorResp(c, err, 500)
return
}
common.SuccessResp(c, link)
return
}
func Preview(c *gin.Context) {