Files
lx-music-desktop/build-config/lib-update.js
ikun0014 cb2798cba9 refactor: 将QRC解密替换为纯JS实现并简化kw歌词获取 (#2845)
* 简化kw歌词获取 && kw歌词解密逻辑移动

将酷我歌词解密从主进程 native/IPC 方案迁移到渲染进程纯 JS 实现,
移除 kw_decodeLyric 主进程入口与 handle_kw_decode_lyric IPC 通道。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* tx歌词解密改用js实现

将 QRC 歌词的 3DES 解密由主进程 native 插件(qrc_decode.node)按原 C++
算法 1:1 移植为渲染进程纯 JS 实现,移除 tx_decodeLyric 主进程入口、
handle_tx_decode_lyric IPC 通道,以及 build 配置中对 qrc_decode.node
的引用与各平台预构建二进制。

注意:QRC 使用的是非标准 DES 变体(S2[23]=15、S4[53]=10,标准为
14、1),新实现已逐字节对照原 native 二进制保持一致。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* update

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: lyswhut <lyswhut@qq.com>
2026-06-07 11:14:17 +08:00

53 lines
1.5 KiB
JavaScript

const fs = require('fs')
const path = require('path')
const tar = require('tar')
const libDir = path.join(__dirname, 'lib')
const getGzipFiles = async() => {
const names = await fs.promises.readdir(libDir)
// for (const name of names) {
// if (name.endsWith('.node')) await fs.promises.unlink(path.join(libDir, name))
// }
return names.filter(name => name.endsWith('.gz'))
}
const unzip = async(filePath) => {
const targetDir = filePath.replace('.tar.gz', '')
if (fs.existsSync(targetDir)) await fs.promises.rm(targetDir, { recursive: true })
await fs.promises.mkdir(targetDir)
await tar.x({
file: filePath,
strip: 1,
C: targetDir,
})
return targetDir
}
const files = [
'better_sqlite3',
]
const moveFile = async(filePath) => {
const name = 'electron-' + path.basename(filePath).split('-electron-')[1]
for (const fileName of files) {
if (fileName == 'better_sqlite3' && !name.includes('linux')) continue
const targetPath = path.join(libDir, `${fileName}_${name}.node`)
if (fs.existsSync(targetPath)) await fs.promises.unlink(targetPath)
await fs.promises.rename(path.join(filePath, 'Release', fileName + '.node'), targetPath)
}
await fs.promises.rm(filePath, { recursive: true })
}
const run = async() => {
const files = await getGzipFiles()
for (const name of files) {
await moveFile(await unzip(path.join(libDir, name)))
}
for (const name of files) {
await fs.promises.unlink(path.join(libDir, name))
}
}
run()