From a0b0936c46878aacae1a86c5482d132b50adf0de Mon Sep 17 00:00:00 2001 From: foxhui Date: Fri, 12 Dec 2025 21:11:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9C=A8=20MacOS=20?= =?UTF-8?q?=E4=B8=8B=E5=88=9D=E5=A7=8B=E5=8C=96=E6=AD=A5=E9=AA=A4=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ lib/utils/init.js | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 791e3c6..4aac042 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **后端聚合** - 可根据请求的模型id自动选择可用的适配器且遵循配置文件中的优先级 +### Fixed +- **修复杂项** + - 修复在 MacOS 下初始化步骤缺少导致的浏览器启动失败 + ## [2.2.2] - 2025-12-12 ### Added diff --git a/lib/utils/init.js b/lib/utils/init.js index 0ef79f7..2d457c2 100644 --- a/lib/utils/init.js +++ b/lib/utils/init.js @@ -312,6 +312,24 @@ async function installCamoufox(platform, arch, proxyUrl) { await compressing.zip.uncompress(downloadPath, camoufoxDir); + // macOS 专用:复制 properties.json 到 MacOS 目录 + if (platform === 'darwin') { + const resourcesPath = path.join(camoufoxDir, 'Camoufox.app', 'Contents', 'Resources', 'properties.json'); + const macOSDir = path.join(camoufoxDir, 'Camoufox.app', 'Contents', 'MacOS'); + const macOSPath = path.join(macOSDir, 'properties.json'); + + if (fs.existsSync(resourcesPath)) { + // 确保目标目录存在 + if (!fs.existsSync(macOSDir)) { + fs.mkdirSync(macOSDir, { recursive: true }); + } + fs.copyFileSync(resourcesPath, macOSPath); + logger.info('初始化', `已复制 properties.json 到 MacOS 目录`); + } else { + logger.warn('初始化', `未找到 properties.json: ${resourcesPath}`); + } + } + logger.info('初始化', `Camoufox 安装成功: ${camoufoxDir}`); // 更新 config.yaml