diff --git a/internal/command/album.go b/internal/command/album.go index 7495c35..8a9503c 100644 --- a/internal/command/album.go +++ b/internal/command/album.go @@ -628,7 +628,7 @@ func RunAlbumDownloadFile(albumNames []string, options *DownloadOptions) { go func(flag *int32) { for atomic.LoadInt32(flag) == 0 { time.Sleep(time.Duration(1) * time.Minute) - if RefreshTokenInNeed(activeUser, config.Config.DeviceName) { + if RefreshWebTokenInNeed(activeUser, config.Config.DeviceName) { logger.Verboseln("update access token for download task") } } diff --git a/internal/command/download.go b/internal/command/download.go index 7a60e6a..b194659 100644 --- a/internal/command/download.go +++ b/internal/command/download.go @@ -231,7 +231,7 @@ func RunDownload(paths []string, options *DownloadOptions) { go func(flag *int32) { for atomic.LoadInt32(flag) == 0 { time.Sleep(time.Duration(1) * time.Minute) - if RefreshTokenInNeed(activeUser, config.Config.DeviceName) { + if RefreshWebTokenInNeed(activeUser, config.Config.DeviceName) { logger.Verboseln("update access token for download task") } } diff --git a/internal/command/sync.go b/internal/command/sync.go index b31b3e0..814b43a 100644 --- a/internal/command/sync.go +++ b/internal/command/sync.go @@ -314,7 +314,7 @@ func RunSync(defaultTask *syncdrive.SyncTask, fileDownloadParallel, fileUploadPa go func(flag *int32) { for atomic.LoadInt32(flag) == 0 { time.Sleep(time.Duration(1) * time.Minute) - if RefreshTokenInNeed(activeUser, config.Config.DeviceName) { + if RefreshWebTokenInNeed(activeUser, config.Config.DeviceName) { logger.Verboseln("update access token for sync task") userWebToken := NewWebLoginToken(activeUser.WebapiToken.AccessToken, activeUser.WebapiToken.Expired) panClient.WebapiPanClient().UpdateToken(userWebToken) diff --git a/internal/command/upload.go b/internal/command/upload.go index 899e368..e07edfc 100644 --- a/internal/command/upload.go +++ b/internal/command/upload.go @@ -232,7 +232,7 @@ func RunUpload(localPaths []string, savePath string, opt *UploadOptions) { go func(flag *int32) { for atomic.LoadInt32(flag) == 0 { time.Sleep(time.Duration(1) * time.Minute) - if RefreshTokenInNeed(activeUser, config.Config.DeviceName) { + if RefreshWebTokenInNeed(activeUser, config.Config.DeviceName) { logger.Verboseln("update access token for upload task") } } diff --git a/internal/command/utils.go b/internal/command/utils.go index 20fe986..ea9bc5c 100644 --- a/internal/command/utils.go +++ b/internal/command/utils.go @@ -140,8 +140,8 @@ func NewWebLoginToken(accessToken string, expired int64) aliyunpan.WebLoginToken } } -// RefreshTokenInNeed 刷新 webapi access token -func RefreshTokenInNeed(activeUser *config.PanUser, deviceName string) bool { +// RefreshWebTokenInNeed 刷新 webapi access token +func RefreshWebTokenInNeed(activeUser *config.PanUser, deviceName string) bool { if activeUser == nil { return false } @@ -191,7 +191,7 @@ func RefreshTokenInNeed(activeUser *config.PanUser, deviceName string) bool { // create new signature _, e := activeUser.PanClient().WebapiPanClient().CreateSession(nil) if e != nil { - logger.Verboseln("call CreateSession error in RefreshTokenInNeed: " + e.Error()) + logger.Verboseln("call CreateSession error in RefreshWebTokenInNeed: " + e.Error()) } return true } else { diff --git a/main.go b/main.go index d7e2cdd..6d523f3 100644 --- a/main.go +++ b/main.go @@ -84,7 +84,7 @@ func checkLoginExpiredAndRelogin() { command.TryLogin() } else { // 刷新过期Token并保存到配置文件 - command.RefreshTokenInNeed(activeUser, config.Config.DeviceName) + command.RefreshWebTokenInNeed(activeUser, config.Config.DeviceName) } command.SaveConfigFunc(nil) }