mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Modify: auth instance as first param in SignURI/Request
This commit is contained in:
@@ -142,12 +142,14 @@ func (handler Handler) Source(
|
||||
|
||||
// 签名生成文件记录
|
||||
signedURI, err = auth.SignURI(
|
||||
auth.General,
|
||||
fmt.Sprintf("/api/v3/file/download/%s", downloadSessionID),
|
||||
expires,
|
||||
)
|
||||
} else {
|
||||
// 签名生成文件记录
|
||||
signedURI, err = auth.SignURI(
|
||||
auth.General,
|
||||
fmt.Sprintf("/api/v3/file/get/%d/%s", file.ID, file.Name),
|
||||
expires,
|
||||
)
|
||||
|
||||
@@ -79,7 +79,8 @@ func (handler Handler) Token(ctx context.Context, TTL int64, key string) (serial
|
||||
uploadRequest.Header = map[string][]string{
|
||||
"X-Policy": {policyEncoded},
|
||||
}
|
||||
auth.SignRequest(uploadRequest, time.Now().Unix()+TTL)
|
||||
remoteAuth := auth.HMACAuth{SecretKey: []byte(handler.Policy.SecretKey)}
|
||||
auth.SignRequest(remoteAuth, uploadRequest, time.Now().Unix()+TTL)
|
||||
|
||||
if credential, ok := uploadRequest.Header["Authorization"]; ok && len(credential) == 1 {
|
||||
return serializer.UploadCredential{
|
||||
|
||||
Reference in New Issue
Block a user