Feat: file uploading token sign for remote policy

This commit is contained in:
HFO4
2019-12-28 15:50:56 +08:00
parent 132c7a8fcb
commit cf8b5f4d1e
15 changed files with 377 additions and 5 deletions

View File

@@ -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))
}
}

View File

@@ -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)
// 创建文件下载会话