Merge pull request #68 from 122cygf/main

修复了因为Referer导致不能下载的问题
This commit is contained in:
微凉
2021-03-31 08:04:51 +08:00
committed by GitHub
2 changed files with 4 additions and 3 deletions

View File

@@ -10,8 +10,8 @@ import (
// refresh access_token token by refresh_token // refresh access_token token by refresh_token
func RefreshToken(drive *conf.Drive) bool { func RefreshToken(drive *conf.Drive) bool {
log.Infof("刷新[%s]token...", drive.Name) log.Infof("刷新[%s]token...", drive.Name)
url := "https://websv.aliyundrive.com/token/refresh" url := "https://auth.aliyundrive.com/v2/account/token"
req := RefreshTokenReq{RefreshToken: drive.RefreshToken} req := RefreshTokenReq{RefreshToken: drive.RefreshToken , GrantType: "refresh_token"}
var token TokenResp var token TokenResp
if body, err := DoPost(url, req, ""); err != nil { if body, err := DoPost(url, req, ""); err != nil {
log.Errorf("tokenLogin-doPost出错:%s", err.Error()) log.Errorf("tokenLogin-doPost出错:%s", err.Error())

View File

@@ -57,6 +57,7 @@ type GetTokenReq struct {
// refresh_token request bean // refresh_token request bean
type RefreshTokenReq struct { type RefreshTokenReq struct {
RefreshToken string `json:"refresh_token"` RefreshToken string `json:"refresh_token"`
GrantType string `json:"grant_type"`
} }
// office_preview_url request bean // office_preview_url request bean
@@ -70,4 +71,4 @@ type OfficePreviewUrlReq struct {
type VideoPreviewUrlReq struct { type VideoPreviewUrlReq struct {
DriveId string `json:"drive_id"` DriveId string `json:"drive_id"`
FileId string `json:"file_id"` FileId string `json:"file_id"`
} }