mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 17:41:57 +08:00
Feat: file uploading token sign for remote policy
This commit is contained in:
@@ -283,3 +283,18 @@ func FileUploadStream(c *gin.Context) {
|
||||
Code: 0,
|
||||
})
|
||||
}
|
||||
|
||||
// GetUploadCredential 获取上传凭证
|
||||
func GetUploadCredential(c *gin.Context) {
|
||||
// 创建上下文
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
var service explorer.UploadCredentialService
|
||||
if err := c.ShouldBindQuery(&service); err == nil {
|
||||
res := service.Get(ctx, c)
|
||||
c.JSON(200, res)
|
||||
} else {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +139,8 @@ func InitMasterRouter() *gin.Engine {
|
||||
{
|
||||
// 文件上传
|
||||
file.POST("upload", controllers.FileUploadStream)
|
||||
// 获取上传凭证
|
||||
file.GET("upload/credential", controllers.GetUploadCredential)
|
||||
// 更新文件
|
||||
file.PUT("update/*path", controllers.PutContent)
|
||||
// 创建文件下载会话
|
||||
|
||||
Reference in New Issue
Block a user