Feat: upyun callback & authentication

This commit is contained in:
HFO4
2020-01-18 10:40:03 +08:00
parent 21ec3fc710
commit 5befbc21d0
9 changed files with 138 additions and 16 deletions

View File

@@ -140,7 +140,7 @@ func (fs *FileSystem) CancelUpload(ctx context.Context, path string, file FileHe
}
// GetUploadToken 生成新的上传凭证
func (fs *FileSystem) GetUploadToken(ctx context.Context, path string, size uint64) (*serializer.UploadCredential, error) {
func (fs *FileSystem) GetUploadToken(ctx context.Context, path string, size uint64, name string) (*serializer.UploadCredential, error) {
// 获取相关有效期设置
credentialTTL := model.GetIntSetting("upload_credential_timeout", 3600)
callBackSessionTTL := model.GetIntSetting("upload_session_timeout", 86400)
@@ -167,6 +167,7 @@ func (fs *FileSystem) GetUploadToken(ctx context.Context, path string, size uint
UID: fs.User.ID,
PolicyID: fs.User.GetPolicyID(),
VirtualPath: path,
Name: name,
},
callBackSessionTTL,
)