mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-21 21:47:00 +08:00
fix: 加固退出清理
退出应用时终止后台 进程 移除运行时动态安装 Python 依赖
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
* onebot/script.js. See docs/third-party/wechat-chatter/NOTICE.md.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
/* eslint-disable @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-require-imports */
|
||||
const { execFileSync } = require('node:child_process')
|
||||
const fs = require('node:fs')
|
||||
const os = require('node:os')
|
||||
@@ -84,31 +84,6 @@ for (const required of [executable, script, config]) {
|
||||
if (!fs.existsSync(required)) throw new Error(`运行时文件缺失:${required}`)
|
||||
}
|
||||
|
||||
const pythonPackages = path.join(outputDir, 'python')
|
||||
const pilkPackage = path.join(pythonPackages, 'pilk')
|
||||
if (!fs.existsSync(pilkPackage)) {
|
||||
console.log('[wechat-personal] 安装项目内语音编码器 pilk')
|
||||
fs.mkdirSync(pythonPackages, { recursive: true })
|
||||
try {
|
||||
execFileSync(
|
||||
'python3',
|
||||
[
|
||||
'-m',
|
||||
'pip',
|
||||
'install',
|
||||
'--disable-pip-version-check',
|
||||
'--no-compile',
|
||||
'--target',
|
||||
pythonPackages,
|
||||
'pilk==0.2.4'
|
||||
],
|
||||
{ stdio: 'inherit' }
|
||||
)
|
||||
} catch {
|
||||
console.warn('[wechat-personal] pilk 安装失败,将使用 OneBot 内置的 Go SILK 编码器')
|
||||
}
|
||||
}
|
||||
|
||||
function patchPerSendPayload(scriptPath) {
|
||||
let source = fs.readFileSync(scriptPath, 'utf8')
|
||||
if (source.includes('var activeTriggerX1Payload = ptr(0);')) return
|
||||
|
||||
Reference in New Issue
Block a user