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