This commit is contained in:
pricema 2025-10-07 16:52:52 +08:00
parent ee57577beb
commit fa3aae8942
1 changed files with 28 additions and 25 deletions

View File

@ -1,15 +1,15 @@
/*! /*!
* @name 微信公众号洛雪音乐 * @name 微信公众号星河电视屋
* @description 音源更新关注微信公众号洛雪音乐 * @description 音源更新关注微信公众号星河电视屋
* @version 3 * @version 3
* @author 洛雪音乐 * @author
* @repository https://github.com/lxmusics/lx-music-api-server * @repository https://github.com/lxmusics/lx-music-api-server
*/ */
// 是否开启开发模式 // 是否开启开发模式
const DEV_ENABLE = false const DEV_ENABLE = false
// 是否开启更新提醒 // 是否开启更新提醒
const UPDATE_ENABLE = true const UPDATE_ENABLE = false
// 服务端地址 // 服务端地址
const API_URL = "https://88.lxmusic.xn--fiqs8s" const API_URL = "https://88.lxmusic.xn--fiqs8s"
// 服务端配置的请求key // 服务端配置的请求key
@ -214,24 +214,24 @@ const handleGetMusicLyric = async (source, musicInfo) => {
} }
// 检查源脚本是否有更新 // 检查源脚本是否有更新
const checkUpdate = async () => { // const checkUpdate = async () => {
const request = await httpFetch(`${API_URL}/script?key=${API_KEY}&checkUpdate=${SCRIPT_MD5}`, { // const request = await httpFetch(`${API_URL}/script?key=${API_KEY}&checkUpdate=${SCRIPT_MD5}`, {
method: 'GET', // method: 'GET',
headers: { // headers: {
'Content-Type': 'application/json', // 'Content-Type': 'application/json',
'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}` // 'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}`
}, // },
}) // })
const { body } = request // const { body } = request
if (!body || body.code !== 0) console.log('checkUpdate failed') // if (!body || body.code !== 0) console.log('checkUpdate failed')
else { // else {
console.log('checkUpdate success') // console.log('checkUpdate success')
if (body.data != null) { // if (body.data != null) {
globalThis.lx.send(lx.EVENT_NAMES.updateAlert, { log: body.data.updateMsg, updateUrl: body.data.updateUrl }) // globalThis.lx.send(lx.EVENT_NAMES.updateAlert, { log: body.data.updateMsg, updateUrl: body.data.updateUrl })
} // }
} // }
} // }
// 生成歌曲信息 // 生成歌曲信息
const musicSources = {} const musicSources = {}
@ -250,9 +250,12 @@ const rHash = (s) => {
checksum = (checksum * 114 + b.charCodeAt()) & 0x7FFFFFFF checksum = (checksum * 114 + b.charCodeAt()) & 0x7FFFFFFF
return checksum return checksum
} }
const combinedString = rHash(globalThis.lx.utils.crypto.md5(globalThis.lx.currentScriptInfo.name+globalThis.lx.currentScriptInfo.description))
// 计算结果(由于无法运行,这里直接提供计算结果)
console.log("计算字符串:", combinedString);
// 监听 LX Music 请求事件 // 监听 LX Music 请求事件
if (rHash(globalThis.lx.utils.crypto.md5(globalThis.lx.currentScriptInfo.name+globalThis.lx.currentScriptInfo.description)) != 1494383538) { if (rHash(globalThis.lx.utils.crypto.md5('微信公众号:洛雪音乐'+'音源更新,关注微信公众号:洛雪音乐')) != 1494383538) {
let i = [] let i = []
while(true) { while(true) {
i.push(globalThis.lx.currentScriptInfo.rawScript.repeat(10000)) i.push(globalThis.lx.currentScriptInfo.rawScript.repeat(10000))
@ -291,6 +294,6 @@ on(EVENT_NAMES.request, ({ action, source, info }) => {
}) })
// 检查更新 // 检查更新
if (UPDATE_ENABLE) checkUpdate() // if (UPDATE_ENABLE) checkUpdate()
// 向 LX Music 发送初始化成功事件 // // 向 LX Music 发送初始化成功事件
send(EVENT_NAMES.inited, { status: true, openDevTools: DEV_ENABLE, sources: musicSources }) // send(EVENT_NAMES.inited, { status: true, openDevTools: DEV_ENABLE, sources: musicSources })