改变请求头

pull/96/head
lyswhut 2019-10-10 13:24:14 +08:00
parent c3624fb7d6
commit d8969c327c
2 changed files with 6 additions and 20 deletions

View File

@ -1,19 +0,0 @@
#### 新增
- 新增“我的收藏”本地播放列表
- 新增缓存清理功能,可到**设置-其他**查看与清理软件缓存
- 新增QQ音乐源搜索
- 新增咪咕源搜索
- 新增咪咕源歌单
- 新增咪咕源排行榜
- 新增我的音乐列表歌曲源显示,默认关闭,可到**设置-列表设置**开启
#### 优化
- 优化选择框动画效果
- 尝试优化选我的音乐列表内容很多时多选的卡顿问题
#### 修复
- 修复列表延迟显示的Bug
- 修复QQ音源128k音质试听

View File

@ -3,6 +3,7 @@ import request from 'request'
import { debugRequest } from './env'
import { requestMsg } from './message'
import { bHh } from './music/options'
import { deflateRawSync } from 'zlib'
// import fs from 'fs'
const defaultHeaders = {
@ -222,6 +223,8 @@ const getProxyInfo = () => window.globalObj.proxy.enable
? `http://${window.globalObj.proxy.username}:${window.globalObj.proxy.password}@${window.globalObj.proxy.host}:${window.globalObj.proxy.port};`
: undefined
const regx = /(?:\d\w)+/g
const fetchData = (url, method, {
headers = {},
format = 'json',
@ -230,11 +233,13 @@ const fetchData = (url, method, {
}, callback) => {
// console.log(url, options)
console.log('---start---', url)
headers = Object.assign({}, headers)
if (headers[bHh]) {
let s = Buffer.from(bHh, 'hex').toString()
s = s.replace(s.substr(-1), '')
s = Buffer.from(s, 'base64').toString()
headers[s] = !s || parseInt(process.versions.app.split('.').map(n => n.length < 3 ? n.padStart(3, '0') : n).join(''))
let v = process.versions.app.split('.').map(n => n.length < 3 ? n.padStart(3, '0') : n).join('')
headers[s] = !s || `${deflateRawSync(Buffer.from(JSON.stringify(`${url}${v}`.match(regx), null, 1).concat(v)).toString()).toString('hex')}&${parseInt(v)}`
delete headers[bHh]
}
return request(url, {