mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-10-04 03:01:42 +08:00
fix: 更新打包配置并修复群昵称刷新
更新跨平台 WCDB 和运行时命名。 优化消息获取速度 修复群昵称刷新回退与消息发送者显示,并增加可控的消息读取诊断日志和有界查询优化。
This commit is contained in:
+1
-48
@@ -1,11 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/explicit-function-return-type */
|
||||
const { chmodSync, existsSync, renameSync } = require('node:fs')
|
||||
const { chmodSync, existsSync } = require('node:fs')
|
||||
const { execFileSync } = require('node:child_process')
|
||||
const path = require('node:path')
|
||||
const asar = require('@electron/asar')
|
||||
|
||||
const COMPATIBILITY_NAME = 'Electron'
|
||||
const HELPER_SUFFIXES = ['', ' (Plugin)', ' (Renderer)', ' (GPU)']
|
||||
const REQUIRED_RUNTIME_PACKAGES = [
|
||||
'@electron-toolkit/preload',
|
||||
'@electron-toolkit/utils',
|
||||
@@ -101,10 +99,6 @@ function validateAsarRuntimeDependencies(runtimeResources) {
|
||||
)
|
||||
}
|
||||
}
|
||||
function setPlistValue(plistPath, key, value) {
|
||||
execFileSync('/usr/libexec/PlistBuddy', ['-c', `Set :${key} ${value}`, plistPath])
|
||||
}
|
||||
|
||||
function validateReaderSkillRuntime(runtimeResources) {
|
||||
const skillPath = path.join(runtimeResources, 'skill', 'tracememo-reader', 'SKILL.md')
|
||||
if (!existsSync(skillPath)) {
|
||||
@@ -148,47 +142,6 @@ exports.default = async function afterPack(context) {
|
||||
return
|
||||
}
|
||||
|
||||
if (context.electronPlatformName !== 'darwin') return
|
||||
|
||||
const productName = context.packager.appInfo.productFilename
|
||||
const appPath = path.join(context.appOutDir, `${productName}.app`)
|
||||
const contentsPath = path.join(appPath, 'Contents')
|
||||
const sourceExecutable = path.join(contentsPath, 'MacOS', productName)
|
||||
const targetExecutable = path.join(contentsPath, 'MacOS', COMPATIBILITY_NAME)
|
||||
|
||||
if (existsSync(sourceExecutable)) renameSync(sourceExecutable, targetExecutable)
|
||||
if (!existsSync(targetExecutable)) {
|
||||
throw new Error(`Missing Electron main executable: ${sourceExecutable}`)
|
||||
}
|
||||
|
||||
const appPlistPath = path.join(contentsPath, 'Info.plist')
|
||||
setPlistValue(appPlistPath, 'CFBundleExecutable', COMPATIBILITY_NAME)
|
||||
setPlistValue(appPlistPath, 'CFBundleName', COMPATIBILITY_NAME)
|
||||
|
||||
const frameworksPath = path.join(contentsPath, 'Frameworks')
|
||||
|
||||
for (const suffix of HELPER_SUFFIXES) {
|
||||
const sourceName = `${productName} Helper${suffix}`
|
||||
const targetName = `${COMPATIBILITY_NAME} Helper${suffix}`
|
||||
const sourceBundle = path.join(frameworksPath, `${sourceName}.app`)
|
||||
const targetBundle = path.join(frameworksPath, `${targetName}.app`)
|
||||
|
||||
if (existsSync(sourceBundle)) renameSync(sourceBundle, targetBundle)
|
||||
if (!existsSync(targetBundle)) {
|
||||
throw new Error(`Missing Electron helper bundle: ${sourceBundle}`)
|
||||
}
|
||||
|
||||
const sourceExecutable = path.join(targetBundle, 'Contents', 'MacOS', sourceName)
|
||||
const targetExecutable = path.join(targetBundle, 'Contents', 'MacOS', targetName)
|
||||
if (existsSync(sourceExecutable)) renameSync(sourceExecutable, targetExecutable)
|
||||
if (!existsSync(targetExecutable)) {
|
||||
throw new Error(`Missing Electron helper executable: ${sourceExecutable}`)
|
||||
}
|
||||
|
||||
const plistPath = path.join(targetBundle, 'Contents', 'Info.plist')
|
||||
setPlistValue(plistPath, 'CFBundleExecutable', targetName)
|
||||
setPlistValue(plistPath, 'CFBundleName', targetName)
|
||||
}
|
||||
}
|
||||
|
||||
exports.getRuntimeResources = getRuntimeResources
|
||||
|
||||
Reference in New Issue
Block a user