ImFurina 5478041ddd chore(version): 更新api到4.28.0
Co-Authored-By: binaryify <binaryify@gmail.com>
2025-09-07 13:20:37 +08:00

31 lines
727 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const QRCode = require('qrcode')
const { generateChainId } = require('../util/index')
module.exports = (query) => {
return new Promise(async (resolve) => {
const platform = query.platform || 'pc'
const cookie = query.cookie || ''
// 构建基础URL
let url = `https://music.163.com/login?codekey=${query.key}`
// 如果是web平台则添加chainId参数
if (platform === 'web') {
const chainId = generateChainId(cookie)
url += `&chainId=${chainId}`
}
return resolve({
code: 200,
status: 200,
body: {
code: 200,
data: {
qrurl: url,
qrimg: query.qrimg ? await QRCode.toDataURL(url) : '',
},
},
})
})
}