mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: update file content
This commit is contained in:
@@ -143,7 +143,7 @@ func Preview(c *gin.Context) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
var service explorer.FileDownloadCreateService
|
||||
var service explorer.SingleFileService
|
||||
if err := c.ShouldBindUri(&service); err == nil {
|
||||
res := service.PreviewContent(ctx, c)
|
||||
// 是否需要重定向
|
||||
@@ -164,7 +164,7 @@ func CreateDownloadSession(c *gin.Context) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
var service explorer.FileDownloadCreateService
|
||||
var service explorer.SingleFileService
|
||||
if err := c.ShouldBindUri(&service); err == nil {
|
||||
res := service.CreateDownloadSession(ctx, c)
|
||||
c.JSON(200, res)
|
||||
@@ -190,6 +190,21 @@ func Download(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// PutContent 更新文件内容
|
||||
func PutContent(c *gin.Context) {
|
||||
// 创建上下文
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
var service explorer.SingleFileService
|
||||
if err := c.ShouldBindUri(&service); err == nil {
|
||||
res := service.PutContent(ctx, c)
|
||||
c.JSON(200, res)
|
||||
} else {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
// FileUploadStream 本地策略流式上传
|
||||
func FileUploadStream(c *gin.Context) {
|
||||
// 创建上下文
|
||||
@@ -251,6 +266,5 @@ func FileUploadStream(c *gin.Context) {
|
||||
|
||||
c.JSON(200, serializer.Response{
|
||||
Code: 0,
|
||||
Msg: "Pong",
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user