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