mirror of https://github.com/Xhofe/alist
fix(xunlei):check captchaToken
parent
041b3587bf
commit
6a67d1cf69
|
@ -117,11 +117,9 @@ func (driver XunLeiCloud) Save(account *model.Account, old *model.Account) error
|
||||||
|
|
||||||
client := GetClient(account)
|
client := GetClient(account)
|
||||||
// 指定验证通过的captchaToken
|
// 指定验证通过的captchaToken
|
||||||
if client.captchaToken != "" {
|
if account.CaptchaToken != "" {
|
||||||
client.Lock()
|
client.UpdateCaptchaToken(strings.TrimSpace(account.CaptchaToken))
|
||||||
client.captchaToken = account.CaptchaToken
|
|
||||||
account.CaptchaToken = ""
|
account.CaptchaToken = ""
|
||||||
client.Unlock()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if client.token == "" {
|
if client.token == "" {
|
||||||
|
|
|
@ -269,3 +269,14 @@ func (c *Client) Request(method string, url string, callback func(*resty.Request
|
||||||
}
|
}
|
||||||
return c.Request(method, url, callback, account)
|
return c.Request(method, url, callback, account)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) UpdateCaptchaToken(captchaToken string) bool {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
|
||||||
|
if captchaToken != "" {
|
||||||
|
c.captchaToken = captchaToken
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue