4
4
"context"
5
5
"fmt"
6
6
"net/http"
7
+ "net/url"
7
8
"strconv"
8
9
"strings"
9
10
@@ -68,6 +69,7 @@ func (x *Thunder) Init(ctx context.Context) (err error) {
68
69
PackageName : "com.xunlei.downloadprovider" ,
69
70
UserAgent : "ANDROID-com.xunlei.downloadprovider/8.31.0.9726 netWorkType/5G appid/40 deviceName/Xiaomi_M2004j7ac deviceModel/M2004J7AC OSVersion/12 protocolVersion/301 platformVersion/10 sdkVersion/512000 Oauth2Client/0.9 (Linux 4_14_186-perf-gddfs8vbb238b) (JAVA 0)" ,
70
71
DownloadUserAgent : "Dalvik/2.1.0 (Linux; U; Android 12; M2004J7AC Build/SP1A.210812.016)" ,
72
+ Space : x .Space ,
71
73
refreshCTokenCk : func (token string ) {
72
74
x .CaptchaToken = token
73
75
op .MustSaveDriverStorage (x )
@@ -167,6 +169,7 @@ func (x *ThunderExpert) Init(ctx context.Context) (err error) {
167
169
UserAgent : x .UserAgent ,
168
170
DownloadUserAgent : x .DownloadUserAgent ,
169
171
UseVideoUrl : x .UseVideoUrl ,
172
+ Space : x .Space ,
170
173
171
174
refreshCTokenCk : func (token string ) {
172
175
x .CaptchaToken = token
@@ -281,7 +284,7 @@ func (xc *XunLeiCommon) Link(ctx context.Context, file model.Obj, args model.Lin
281
284
_ , err := xc .Request (FILE_API_URL + "/{fileID}" , http .MethodGet , func (r * resty.Request ) {
282
285
r .SetContext (ctx )
283
286
r .SetPathParam ("fileID" , file .GetID ())
284
- // r.SetQueryParam("space", "" )
287
+ r .SetQueryParam ("space" , xc . Space )
285
288
}, & lFile )
286
289
if err != nil {
287
290
return nil , err
@@ -430,7 +433,7 @@ func (xc *XunLeiCommon) getFiles(ctx context.Context, folderId string) ([]model.
430
433
_ , err := xc .Request (FILE_API_URL , http .MethodGet , func (r * resty.Request ) {
431
434
r .SetContext (ctx )
432
435
r .SetQueryParams (map [string ]string {
433
- "space" : "" ,
436
+ "space" : xc . Space ,
434
437
"__type" : "drive" ,
435
438
"refresh" : "true" ,
436
439
"__sync" : "true" ,
@@ -440,6 +443,16 @@ func (xc *XunLeiCommon) getFiles(ctx context.Context, folderId string) ([]model.
440
443
"limit" : "100" ,
441
444
"filters" : `{"phase":{"eq":"PHASE_TYPE_COMPLETE"},"trashed":{"eq":false}}` ,
442
445
})
446
+ if xc .Space != "" {
447
+ r .SetQueryParamsFromValues (url.Values {
448
+ "with" : []string {
449
+ "withCategoryDiskMountPath" ,
450
+ "withCategoryDriveCachePath" ,
451
+ "withCategoryHistoryDownloadPath" ,
452
+ "withReadOnlyFS" ,
453
+ },
454
+ })
455
+ }
443
456
}, & fileList )
444
457
if err != nil {
445
458
return nil , err
0 commit comments