fix: 修复 issues #1019 的跟进问题 (#1068)

* issues #1019 的迫真修复

* 修复 issues #1019

* 修复 issues #1019

* 改回 pickedLyric() 逻辑

* 更进一步的避免取词卡死问题

* 更新网易云 api 到 4.2.0

* Update README.md

* Revert "Update README.md"

This reverts commit b862ef7d4dabd40c8fe57e4837fc6220806a1456.
This commit is contained in:
是虹川飴 2021-12-06 18:27:24 +08:00 committed by GitHub
parent 8341727882
commit 0d3df4a1e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 286 additions and 317 deletions

View file

@ -117,7 +117,7 @@ const createRequest = (method, url, data, options) => {
headers: headers,
data: queryString.stringify(data),
httpAgent: new http.Agent({ keepAlive: true }),
httpsAgent: new https.Agent({ keepAlive: true, rejectUnauthorized: false }),
httpsAgent: new https.Agent({ keepAlive: true }),
}
if (options.crypto === 'eapi') settings.encoding = null
@ -127,7 +127,7 @@ const createRequest = (method, url, data, options) => {
settings.httpAgent = new PacProxyAgent(options.proxy)
settings.httpsAgent = new PacProxyAgent(options.proxy)
} else {
var purl = qs.parse(options.proxy)
const purl = qs.parse(options.proxy)
if (purl.hostname) {
const agent = tunnel.httpsOverHttp({
proxy: {
@ -142,6 +142,8 @@ const createRequest = (method, url, data, options) => {
console.error('代理配置无效,不使用代理')
}
}
} else {
settings.proxy = false
}
if (options.crypto === 'eapi') {
settings = {
@ -172,13 +174,19 @@ const createRequest = (method, url, data, options) => {
}
} catch (e) {
// console.log(e)
answer.body = body
try {
answer.body = JSON.parse(body.toString())
} catch (err) {
// console.log(err)
// can't decrypt and can't parse directly
answer.body = body
}
answer.status = res.status
}
answer.status =
100 < answer.status && answer.status < 600 ? answer.status : 400
if (answer.status == 200) resolve(answer)
if (answer.status === 200) resolve(answer)
else reject(answer)
})
.catch((err) => {