@@ -1067,7 +1067,7 @@ func sortedJsonStringify(obj interface{}) (string, error) {
10671067}
10681068
10691069// yun139EncryptedRequest handles the common encrypted request/response flow.
1070- func (d * Yun139 ) yun139EncryptedRequest (url string , body interface {}, headers map [string ]string , aesKeyHex string , resp interface {}) ([]byte , error ) {
1070+ func (d * Yun139 ) yun139EncryptedRequest (ctx context. Context , url string , body interface {}, headers map [string ]string , aesKeyHex string , resp interface {}) ([]byte , error ) {
10711071 // 1. Decode AES key
10721072 aesKey , err := hex .DecodeString (aesKeyHex )
10731073 if err != nil {
@@ -1094,6 +1094,7 @@ func (d *Yun139) yun139EncryptedRequest(url string, body interface{}, headers ma
10941094
10951095 // 4. Make the request
10961096 res , err := base .RestyClient .R ().
1097+ SetContext (ctx ).
10971098 SetHeaders (headers ).
10981099 SetBody (payload ).
10991100 Post (url )
@@ -1177,7 +1178,7 @@ func (d *Yun139) step3_third_party_login(dycpwd string) (string, error) {
11771178 }
11781179
11791180 // 使用通用加密请求函数
1180- decryptedLayer1StrBytes , err := d .yun139EncryptedRequest (ssoLoginURL , ssoRequestBodyRaw , ssoLoginHeaders , KEY_HEX_1 , nil )
1181+ decryptedLayer1StrBytes , err := d .yun139EncryptedRequest (context . TODO (), ssoLoginURL , ssoRequestBodyRaw , ssoLoginHeaders , KEY_HEX_1 , nil )
11811182 if err != nil {
11821183 return "" , fmt .Errorf ("step3 encrypted request failed: %w" , err )
11831184 }
@@ -1251,7 +1252,7 @@ func (d *Yun139) loginWithPassword() (string, error) {
12511252 return newAuth , nil
12521253}
12531254
1254- func (d * Yun139 ) andAlbumRequest (pathname string , body interface {}, resp interface {}) ([]byte , error ) {
1255+ func (d * Yun139 ) andAlbumRequest (ctx context. Context , pathname string , body interface {}, resp interface {}) ([]byte , error ) {
12551256 url := "https://group.yun.139.com/hcy/family/adapter/andAlbum/openApi" + pathname
12561257
12571258 headers := map [string ]string {
@@ -1269,7 +1270,7 @@ func (d *Yun139) andAlbumRequest(pathname string, body interface{}, resp interfa
12691270 "accept-encoding" : "gzip" ,
12701271 }
12711272
1272- return d .yun139EncryptedRequest (url , body , headers , KEY_HEX_1 , resp )
1273+ return d .yun139EncryptedRequest (ctx , url , body , headers , KEY_HEX_1 , resp )
12731274}
12741275
12751276func (d * Yun139 ) handleMetaGroupCopy (ctx context.Context , srcObj , dstDir model.Obj ) error {
@@ -1298,7 +1299,7 @@ func (d *Yun139) handleMetaGroupCopy(ctx context.Context, srcObj, dstDir model.O
12981299 }
12991300
13001301 var resp base.Json
1301- _ , err := d .andAlbumRequest (pathname , body , & resp )
1302+ _ , err := d .andAlbumRequest (ctx , pathname , body , & resp )
13021303 return err
13031304}
13041305
0 commit comments