diff --git a/drivers/ilanzou/driver.go b/drivers/ilanzou/driver.go index 080e3b55129..875300e1820 100644 --- a/drivers/ilanzou/driver.go +++ b/drivers/ilanzou/driver.go @@ -123,14 +123,14 @@ func (d *ILanZou) Link(ctx context.Context, file model.Obj, args model.LinkArgs) query.Set("devType", "6") query.Set("devCode", d.UUID) query.Set("devModel", "chrome") - query.Set("devVersion", "120") + query.Set("devVersion", d.conf.devVersion) query.Set("appVersion", "") ts, err := getTimestamp(d.conf.secret) if err != nil { return nil, err } query.Set("timestamp", ts) - //query.Set("appToken", d.Token) + query.Set("appToken", d.Token) query.Set("enable", "1") downloadId, err := mopan.AesEncrypt([]byte(fmt.Sprintf("%s|%s", file.GetID(), d.userID)), d.conf.secret) if err != nil { @@ -143,7 +143,18 @@ func (d *ILanZou) Link(ctx context.Context, file model.Obj, args model.LinkArgs) } query.Set("auth", hex.EncodeToString(auth)) u.RawQuery = query.Encode() - link := model.Link{URL: u.String()} + realURL := u.String() + // get the url after redirect + res, err := base.NoRedirectClient.R().Get(realURL) + if err != nil { + return nil, err + } + if res.StatusCode() == 302 { + realURL = res.Header().Get("location") + } else { + return nil, fmt.Errorf("redirect failed, status: %d", res.StatusCode()) + } + link := model.Link{URL: realURL} return &link, nil } diff --git a/drivers/ilanzou/meta.go b/drivers/ilanzou/meta.go index f7c61e5a7fe..ca813c5efad 100644 --- a/drivers/ilanzou/meta.go +++ b/drivers/ilanzou/meta.go @@ -15,11 +15,12 @@ type Addition struct { } type Conf struct { - base string - secret []byte - bucket string - unproved string - proved string + base string + secret []byte + bucket string + unproved string + proved string + devVersion string } func init() { @@ -39,11 +40,12 @@ func init() { NoOverwriteUpload: false, }, conf: Conf{ - base: "https://api.ilanzou.com", - secret: []byte("lanZouY-disk-app"), - bucket: "wpanstore-lanzou", - unproved: "unproved", - proved: "proved", + base: "https://api.ilanzou.com", + secret: []byte("lanZouY-disk-app"), + bucket: "wpanstore-lanzou", + unproved: "unproved", + proved: "proved", + devVersion: "120", }, } }) @@ -63,11 +65,12 @@ func init() { NoOverwriteUpload: false, }, conf: Conf{ - base: "https://api.feijipan.com", - secret: []byte("dingHao-disk-app"), - bucket: "wpanstore", - unproved: "ws", - proved: "app", + base: "https://api.feijipan.com", + secret: []byte("dingHao-disk-app"), + bucket: "wpanstore", + unproved: "ws", + proved: "app", + devVersion: "121", }, } })