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>
This commit is contained in:
co-authored by
Claude Opus 4.8
lyswhut
parent
f0342b852b
commit
cb2798cba9
@@ -10,23 +10,6 @@ const better_sqlite3_fileNameMap = {
|
||||
[Arch.armv7l]: 'linux-arm',
|
||||
}
|
||||
|
||||
const qrc_decode_fileNameMap = {
|
||||
win32: {
|
||||
[Arch.x64]: 'win32-x64',
|
||||
[Arch.ia32]: 'win32-ia32',
|
||||
[Arch.arm64]: 'win32-arm64',
|
||||
},
|
||||
linux: {
|
||||
[Arch.x64]: 'linux-x64',
|
||||
[Arch.arm64]: 'linux-arm64',
|
||||
[Arch.armv7l]: 'linux-arm',
|
||||
},
|
||||
darwin: {
|
||||
[Arch.x64]: 'darwin-x64',
|
||||
[Arch.arm64]: 'darwin-arm64',
|
||||
},
|
||||
}
|
||||
|
||||
const replaceSqliteLib = async(electronNodeAbi, arch) => {
|
||||
// console.log(await fs.readdir(path.join(context.appOutDir, './resources/')))
|
||||
// if (context.electronPlatformName != 'linux' || context.arch != Arch.arm64) return
|
||||
@@ -40,22 +23,11 @@ const replaceSqliteLib = async(electronNodeAbi, arch) => {
|
||||
await fsPromises.copyFile(filePath, targetPath)
|
||||
}
|
||||
|
||||
const replaceQrcDecodeLib = async(electronNodeAbi, platform, arch) => {
|
||||
console.log('replace qrc_decode lib...', platform, electronNodeAbi, qrc_decode_fileNameMap[platform][arch])
|
||||
const filePath = path.join(__dirname, `./lib/qrc_decode_electron-v${electronNodeAbi}-${qrc_decode_fileNameMap[platform][arch]}.node`)
|
||||
const targetPath = path.join(__dirname, '../build/Release/qrc_decode.node')
|
||||
const targetDir = path.dirname(targetPath)
|
||||
if (fs.existsSync(targetDir)) await fsPromises.unlink(targetPath).catch(_ => _)
|
||||
else await fsPromises.mkdir(targetDir, { recursive: true })
|
||||
await fsPromises.copyFile(filePath, targetPath)
|
||||
}
|
||||
|
||||
|
||||
module.exports = async(context) => {
|
||||
const { electronPlatformName, arch } = context
|
||||
const electronVersion = context.packager?.info?._framework?.version ?? require('../package.json').devDependencies.electron.replace(/^[^\d]*?(\d+)/, '$1')
|
||||
const electronNodeAbi = nodeAbi.getAbi(electronVersion, 'electron')
|
||||
await replaceQrcDecodeLib(electronNodeAbi, electronPlatformName, arch)
|
||||
if (electronPlatformName !== 'linux' || process.env.FORCE) return
|
||||
const bindingFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp')
|
||||
const bindingBakFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp.bak')
|
||||
|
||||
@@ -35,7 +35,6 @@ const options = {
|
||||
'node_modules/node-gyp-build',
|
||||
'node_modules/bufferutil',
|
||||
'node_modules/utf-8-validate',
|
||||
'build/Release/qrc_decode.node',
|
||||
'dist/**/*',
|
||||
],
|
||||
asar: {
|
||||
|
||||
@@ -25,7 +25,6 @@ const unzip = async(filePath) => {
|
||||
}
|
||||
|
||||
const files = [
|
||||
'qrc_decode',
|
||||
'better_sqlite3',
|
||||
]
|
||||
const moveFile = async(filePath) => {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,8 +1,6 @@
|
||||
const path = require('path')
|
||||
const ESLintPlugin = require('eslint-webpack-plugin')
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development'
|
||||
|
||||
module.exports = {
|
||||
target: 'electron-main',
|
||||
output: {
|
||||
@@ -18,7 +16,6 @@ module.exports = {
|
||||
'electron-font-manager': 'electron-font-manager',
|
||||
bufferutil: 'bufferutil',
|
||||
'utf-8-validate': 'utf-8-validate',
|
||||
'qrc_decode.node': isDev ? path.join(__dirname, '../../build/Release/qrc_decode.node') : path.join('../build/Release/qrc_decode.node'),
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user