remove qq token refresh logic, user should refresh token by using RefreshLogin() api

This commit is contained in:
aynakeya
2025-09-30 22:59:53 +08:00
parent 8f67b50eae
commit f0d0cdb6dd
2 changed files with 8 additions and 22 deletions

View File

@@ -24,7 +24,6 @@ type QQMusicProvider struct {
cred *Credential cred *Credential
header map[string]string header map[string]string
qimeiUpdated bool //i don't care concurrence qimeiUpdated bool //i don't care concurrence
tokenRefreshed bool
channel string // "qq" or "wechat" channel string // "qq" or "wechat"
} }
@@ -61,7 +60,6 @@ func NewQQMusicProvider(channel string) *QQMusicProvider {
"user-agent": "Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.54", "user-agent": "Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.54",
}, },
qimeiUpdated: false, qimeiUpdated: false,
tokenRefreshed: false,
channel: channel, channel: channel,
} }
return val return val

View File

@@ -11,21 +11,9 @@ import (
"net/url" "net/url"
"strconv" "strconv"
"strings" "strings"
"time"
) )
func (p *QQMusicProvider) makeApiRequest(module, method string, params map[string]interface{}) (gjson.Result, error) { func (p *QQMusicProvider) makeApiRequest(module, method string, params map[string]interface{}) (gjson.Result, error) {
expiredTime := time.UnixMilli(p.cred.CreatedAt * 1000).Add(7 * 24 * time.Hour)
//fmt.Println(expiredTime.Format("2006-01-02 15:04:05"))
if expiredTime.Before(time.Now().Add(24*time.Hour)) && !p.tokenRefreshed {
//if true && !p.tokenRefreshed {
//if !p.tokenRefreshed {
//only refresh once
//fmt.Println("Token expired")
p.tokenRefreshed = true
p.qimeiUpdated = false
_ = p.refreshToken()
}
if !p.qimeiUpdated { if !p.qimeiUpdated {
_, _ = getQimei(p.device, p.cfg.Version) _, _ = getQimei(p.device, p.cfg.Version)
p.qimeiUpdated = true p.qimeiUpdated = true