mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: create upload session and pre-upload check
This commit is contained in:
@@ -311,7 +311,7 @@ func (handler Driver) signURL(ctx context.Context, path *url.URL, TTL int64) (st
|
||||
}
|
||||
|
||||
// Token 获取上传策略和认证Token
|
||||
func (handler Driver) Token(ctx context.Context, TTL int64, key string) (serializer.UploadCredential, error) {
|
||||
func (handler Driver) Token(ctx context.Context, TTL int64, uploadSession *serializer.UploadSession) (serializer.UploadCredential, error) {
|
||||
// 读取上下文中生成的存储路径和文件大小
|
||||
savePath, ok := ctx.Value(fsctx.SavePathCtx).(string)
|
||||
if !ok {
|
||||
@@ -326,7 +326,7 @@ func (handler Driver) Token(ctx context.Context, TTL int64, key string) (seriali
|
||||
|
||||
// 生成回调地址
|
||||
siteURL := model.GetSiteURL()
|
||||
apiBaseURI, _ := url.Parse("/api/v3/callback/upyun/" + key)
|
||||
apiBaseURI, _ := url.Parse("/api/v3/callback/upyun/" + uploadSession.Key)
|
||||
apiURL := siteURL.ResolveReference(apiBaseURI)
|
||||
|
||||
// 上传策略
|
||||
|
||||
Reference in New Issue
Block a user