Skip to content

Commit 29db39e

Browse files
authored
fix:配置文件路径问题
1 parent f8e82c7 commit 29db39e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/api/client.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ if (config.useNativeAxios === true) {
4141
} else {
4242
try {
4343
// 使用 src/bin/config.json 作为 TLS 指纹配置文件
44-
const configPath = path.join(__dirname, '..', 'bin', 'tls_config.json');
44+
// 检测是否在 pkg 环境中
45+
const isPkg = typeof process.pkg !== 'undefined';
46+
47+
// 根据环境选择配置文件路径
48+
const configPath = isPkg
49+
? path.join(path.dirname(process.execPath), 'bin', 'tls_config.json') // pkg 打包环境
50+
: path.join(__dirname, '..', 'bin', 'tls_config.json'); // 开发环境
4551
requester = fingerprintRequester.create({
4652
configPath,
4753
timeout: config.timeout ? Math.ceil(config.timeout / 1000) : 30,

0 commit comments

Comments
 (0)