mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: download file from single file share
This commit is contained in:
@@ -26,3 +26,14 @@ func GetShare(c *gin.Context) {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
// GetShareDownload 创建分享下载会话
|
||||
func GetShareDownload(c *gin.Context) {
|
||||
var service share.SingleFileService
|
||||
if err := c.ShouldBindQuery(&service); err == nil {
|
||||
res := service.CreateDownloadSession(c)
|
||||
c.JSON(200, res)
|
||||
} else {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,6 +172,8 @@ func InitMasterRouter() *gin.Engine {
|
||||
{
|
||||
// 获取分享
|
||||
share.GET(":id", controllers.GetShare)
|
||||
// 创建文件下载会话
|
||||
share.POST("download/:id", controllers.GetShareDownload)
|
||||
}
|
||||
|
||||
// 需要登录保护的
|
||||
|
||||
Reference in New Issue
Block a user