mirror of
https://github.com/AynaLivePlayer/miaosic.git
synced 2025-12-07 05:22:49 +08:00
remove qq token refresh logic, user should refresh token by using RefreshLogin() api
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user