mirror of
https://github.com/foxhui/WebAI2API.git
synced 2026-06-16 21:03:59 +08:00
fix: 修复无需鉴权的 Socks5 代理无法使用的问题
This commit is contained in:
+16
-9
@@ -17,6 +17,16 @@ const log = (msg) => console.log(`[postinstall] ${msg}`);
|
||||
const warn = (msg) => console.warn(`[postinstall] ⚠️ ${msg}`);
|
||||
const error = (msg) => console.error(`[postinstall] ❌ ${msg}`);
|
||||
|
||||
/**
|
||||
* 补丁文件映射: 源文件名 -> 目标文件名
|
||||
* 供 preflight.js 自检系统复用
|
||||
*/
|
||||
export const CAMOUFOX_PATCHES = {
|
||||
'camoufox-js@0.8.3.locale.patched.js': 'locale.js',
|
||||
'camoufox-js@0.8.3.pkgman.patched.js': 'pkgman.js',
|
||||
'camoufox-js@0.8.3.utils.patched.js': 'utils.js' // SOCKS5 代理修复
|
||||
};
|
||||
|
||||
/**
|
||||
* 复制 camoufox-js 补丁文件到 node_modules
|
||||
*/
|
||||
@@ -33,13 +43,7 @@ function patchCamoufoxJs() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 补丁文件映射: 源文件名 -> 目标文件名
|
||||
const patches = {
|
||||
'camoufox-js@0.8.3.locale.patched.js': 'locale.js',
|
||||
'camoufox-js@0.8.3.pkgman.patched.js': 'pkgman.js'
|
||||
};
|
||||
|
||||
for (const [srcName, destName] of Object.entries(patches)) {
|
||||
for (const [srcName, destName] of Object.entries(CAMOUFOX_PATCHES)) {
|
||||
const srcPath = path.join(patchDir, srcName);
|
||||
const destPath = path.join(targetDir, destName);
|
||||
|
||||
@@ -59,5 +63,8 @@ function patchCamoufoxJs() {
|
||||
log('补丁应用完成。');
|
||||
}
|
||||
|
||||
// 执行
|
||||
patchCamoufoxJs();
|
||||
import { fileURLToPath as _fileURLToPath } from 'url';
|
||||
const isMainModule = process.argv[1] === _fileURLToPath(import.meta.url);
|
||||
if (isMainModule) {
|
||||
patchCamoufoxJs();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user