mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2025-12-07 07:33:10 +00:00
fix(eslint): fix files which have eslint problems
This commit is contained in:
parent
fe28194445
commit
9d18639464
@ -17,7 +17,7 @@ module.exports = async (query, request) => {
|
||||
if (query.unblock === 'true') {
|
||||
try {
|
||||
const result = await match(query.id, source)
|
||||
logger.info('开始解灰', query.id, result)
|
||||
logger.info('Starting unblock(uses modules unblock):', query.id, result)
|
||||
// avoid optional chaining for compatibility
|
||||
let url
|
||||
if (Array.isArray(result)) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@neteasecloudmusicapienhanced/api",
|
||||
"version": "4.29.16",
|
||||
"version": "4.29.17",
|
||||
"description": "为停更的网易云音乐 NodeJs API 提供持续的维护!",
|
||||
"scripts": {
|
||||
"dev": "nodemon app.js",
|
||||
|
||||
@ -235,7 +235,7 @@ async function consturctServer(moduleDefs) {
|
||||
if (ip == '::1') {
|
||||
ip = global.cnIp
|
||||
}
|
||||
// logger.info(ip)
|
||||
logger.info('Requested from ip:', ip)
|
||||
obj[3] = {
|
||||
...obj[3],
|
||||
ip,
|
||||
@ -258,11 +258,11 @@ async function consturctServer(moduleDefs) {
|
||||
const source = process.env.UNBLOCK_SOURCE
|
||||
? process.env.UNBLOCK_SOURCE.split(',')
|
||||
: ['pyncmd', 'bodian', 'kuwo', 'qq', 'migu', 'kugou']
|
||||
logger.info('Starting unblock:', source)
|
||||
logger.info('Starting unblock(uses general unblock):', source)
|
||||
const { url } = await match(req.query.id, source)
|
||||
song.url = url
|
||||
song.freeTrialInfo = 'null'
|
||||
logger.info('Unblock success!')
|
||||
logger.info('Unblock success! url:', song.url)
|
||||
}
|
||||
if (song.url && song.url.includes('kuwo')) {
|
||||
const proxy = process.env.PROXY_URL
|
||||
|
||||
@ -6,8 +6,8 @@ describe('测试获取歌曲是否正常', () => {
|
||||
const qs = {
|
||||
id: 2709812973,
|
||||
level: 'exhigh',
|
||||
realip: '125.88.253.199',
|
||||
// realIP: global.cnIp,
|
||||
//realip: '125.88.253.199',
|
||||
realIP: global.cnIp,
|
||||
}
|
||||
|
||||
axios
|
||||
|
||||
@ -33,11 +33,20 @@ const chinaIPRangesRaw = [
|
||||
// 将原始字符串段转换为数值段并计算总数(在模块初始化时完成一次)
|
||||
function ipToInt(ip) {
|
||||
const parts = ip.split('.').map(Number)
|
||||
return ((parts[0] << 24) >>> 0) + (parts[1] << 16) + (parts[2] << 8) + parts[3]
|
||||
const a = (parts[0] << 24) >>> 0
|
||||
const b = parts[1] << 16
|
||||
const c = parts[2] << 8
|
||||
const d = parts[3]
|
||||
return a + b + c + d
|
||||
}
|
||||
|
||||
function intToIp(int) {
|
||||
return [ (int >>> 24) & 0xFF, (int >>> 16) & 0xFF, (int >>> 8) & 0xFF, int & 0xFF ].join('.')
|
||||
return [
|
||||
(int >>> 24) & 0xff,
|
||||
(int >>> 16) & 0xff,
|
||||
(int >>> 8) & 0xff,
|
||||
int & 0xff,
|
||||
].join('.')
|
||||
}
|
||||
|
||||
const chinaIPRanges = (function buildRanges() {
|
||||
@ -47,7 +56,7 @@ const chinaIPRanges = (function buildRanges() {
|
||||
const r = chinaIPRangesRaw[i]
|
||||
const start = ipToInt(r[0])
|
||||
const end = ipToInt(r[1])
|
||||
const count = r[2] || (end - start + 1)
|
||||
const count = r[2] || end - start + 1
|
||||
arr.push({ start, end, count, location: r[3] || '' })
|
||||
total += count
|
||||
}
|
||||
@ -139,7 +148,12 @@ module.exports = {
|
||||
const segSize = chosen.end - chosen.start + 1
|
||||
const ipInt = chosen.start + Math.floor(random() * segSize)
|
||||
const ip = intToIp(ipInt)
|
||||
logger.info('Generated Random Chinese IP:', ip, 'location:', chosen.location)
|
||||
logger.info(
|
||||
'Generated Random Chinese IP:',
|
||||
ip,
|
||||
'location:',
|
||||
chosen.location,
|
||||
)
|
||||
return ip
|
||||
},
|
||||
// 生成chainId的函数
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user