mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-07-07 02:32:06 +08:00
feat: 新增 eapi 解析接口和使用 demo
This commit is contained in:
26
module/eapi_decrypt.js
Normal file
26
module/eapi_decrypt.js
Normal file
@ -0,0 +1,26 @@
|
||||
const { eapiResDecrypt, eapiReqDecrypt } = require('../util/crypto')
|
||||
|
||||
module.exports = async (query, request) => {
|
||||
const hexString = query.hexString
|
||||
const isFormat = query.isFormat != 'false'
|
||||
if (!hexString) {
|
||||
return {
|
||||
status: 400,
|
||||
body: {
|
||||
code: 400,
|
||||
message: 'hex string is required',
|
||||
},
|
||||
}
|
||||
}
|
||||
// 去除空格
|
||||
let pureHexString = hexString.replace(/\s/g, '')
|
||||
return {
|
||||
status: 200,
|
||||
body: {
|
||||
code: 200,
|
||||
data: isFormat
|
||||
? eapiReqDecrypt(pureHexString)
|
||||
: eapiResDecrypt(pureHexString),
|
||||
},
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user